I'm new to PS scripting, and really pleased with what I achieved over the weekend! Stitching a lot of map tiles together using parts of the filename to determine their position.
But I am stuck on trying to run an EXE with arguments, from within a JSX. I can do it OK without arguments.
Something such as this, although the argument will vary, which works fine at the command line:
"C:\Program Files\MAPC2MAPC64\mapc2mapc64.exe" "C:\Users\Ian\Desktop\9 SP test tiles\stitched\SP.tfw"
I have searched and tried various examples in File.Execute tutorial. I'm using Windows 10.
Running an EXE *with arguments*
Re: Running an EXE *with arguments*
Code: Select all
system('start "" "C:\Program Files\MAPC2MAPC64\mapc2mapc64.exe" "C:\Users\Ian\Desktop\9 SP test tiles\stitched\SP.tfw"')
Re: Running an EXE *with arguments*
Perfect (nearly!), I had to use double backslashes (to Escape the backslash I think?).
Using a variable for the argument, I ended up with:
Many thanks!
Using a variable for the argument, I ended up with:
Code: Select all
var arg = ' "C:\\Users\\Ian\\Desktop\\9 SP test tiles\\stitched\\SP.tfw"'
system('start "" "C:\\Program Files\\MAPC2MAPC64\\mapc2mapc64.exe"'+arg)
Re: Running an EXE *with arguments*
Really weird, that was working, now doesn't seem to be....
****EDIT: Now it is (silly typo).
****EDIT: Now it is (silly typo).
Last edited by IanC on Mon Nov 30, 2020 11:16 pm, edited 4 times in total.
Re: Running an EXE *with arguments*
Yes, you are right, I did not test it, but wrote from memory - double backslashes are necessary 

Re: Running an EXE *with arguments*
Did you correct that typo in your posted code, what that was?
Re: Running an EXE *with arguments*
Nothing important, it was only one of the folder names in the argument
Thanks again for your help.
