I have written a powershell script that I'd like to be able to run from a batch script on Windows.
The powershell script is located in blizzard-main.ps1.
The CMD script looks like this:
@ECHO OFF
powershell -command "& { . %~dp0%\blizzard-main.ps1; Blizzard-Main %1}"
:EOF
The strange error I get when running this is:
. : The term 'C:\Users\mzr\Documents\GitHub\ProductionTools\Blizzard\Dist\Blizzard\bin\1'
is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is
correct and try again.
At line:1 char:7
+ & { . C:\Users\mzr\Documents\GitHub\ProductionTools\Blizzard\Dist\Blizzard\bin\1 ...
[SNIP]
If I debug the script using echo like this:
@ECHO OFF
ECHO powershell -command "& { . %~dp0%\blizzard-main.ps1; Blizzard-Main %1}"
:EOF
I get this interesting output:
powershell -command "& { . C:\Users\mzr\Documents\GitHub\ProductionTools\Blizzard\Dist\Blizzard\bin\1}"
So clearly something has been messed up. If I remove the %1, the script is executed, but then the first parameter isn't being passed the way it should.