Rather new to running batch files from command line so this is probably a really easy question, but I couldn't find the answer after some searching, so ...
I want my batch file to run a file in another directory with some parameters, like this:
directory\script.sh -param val -param val
It works OK when I put the batch file in the same directory (so I don't need the "directory\" part above), but it doesn't work when I'm running it from a different directory. In this case the command looks like
"long directory path with some spaces\script.sh" -param val -param val
And the problem is that the parameters don't seem to be getting properly passed to the script. In other words, I get the same error as I get if I run the script from its own directory without parameters. Any idea how I can fix this? Thanks in advance!
noob question about running programs from other directories
Moderator: DosItHelp
Re: noob question about running programs from other director
Hmm, should work. Does the content of "val" relate to the path where the script is placed? Note that the working directory stays the folder where the Batch file is placed.
Try changing the working directory:
Regards
aGerman
Try changing the working directory:
Code: Select all
pushd "long directory path with some spaces"
script.sh -param val -param val
popd
Regards
aGerman
Re: noob question about running programs from other director
This fix worked fine. Thanks!
By the way, no, the value of val didn't relate to the path where the script was placed.
By the way, no, the value of val didn't relate to the path where the script was placed.