While implementing the suggestions in the topic Drag and Drop to a Powershell script we discovered that PowerShell consolidates multiple spaces into one. This is blocking us from dragging and dropping files through Windows Explorer into .bat/.ps1 constructs with multiple spaces.
This can easily be verified by the following command:
powershell -command "& echo {"a a"}"
This will result in:
a a
whereas the following result is expected:
a a
How can this be achieved?
Please note that your provided solution must fit into the Windows Explorer drag-and-drop .bat -> .ps1 flow. Currently in the .bat file we have:
powershell.exe -Command "& '%PSScript%' '%*'"
which obviously results in PowerShell stripping the duplicate spaces.