Describe the bug
To get the ApplicationData and LocalApplicationData user folders on Windows, a complex PowerShell command line is used, but can be broken if the user's PowerShell profile script has unexpected output.
To Reproduce
Steps to reproduce the behavior:
- Add the following to your PowerShell
$Profile script:
- Run
dw "output application/json --- true"
- Get a stack trace of
java.nio.file.InvalidPathException: Illegal char <?> at index 0 …
Expected behavior
The AppData and LocalAppData folders are available as simple environment variables (APPDATA and LOCALAPPDATA, respectively), or you can use the simple PowerShell expressions [Environment]::GetFolderPath('ApplicationData') and [Environment]::GetFolderPath('LocalApplicationData') without compiling C# code via Add-Type to get at the low-level Windows API. But if you use PowerShell, be sure to include the -NoProfile and -NonInteractive parameters for the powershell.exe, otherwise the user profile script is implicitly executed before your -Command parameter, which can have unexpected results, and can even block execution.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: Windows 10 version 20H2
- Windows PowerShell 5.1.19041.546
- DataWeave Command Line : V1.0.9
- DataWeave Runtime: V2.3.2-SNAPSHOT