1

I am currently remoting into a computer through SSH and need to start up a process that will not close when the SSH connection has been closed. For this I am using the cmdlet Invoke-WmiProcess.

But I am running into a unique problem. When I run the .bat file on the host computer. The .bat file cannot locate the other .bat files within the same directory. My thought is it has something to do with the working directory. But I can not figure out how to get this to change.

  • You can change the working directory using cd, just like in .bat files. – LPChip Sep 11 at 14:58
  • Use call"%~dp0other_batch_file.bat" in the first batch file... – aschipfl Sep 11 at 15:09
  • @LPChip It still doesn't work. However, I found a solution. While I couldn't change this from powershell. Adding the line pushd from inside the Bat file solved the problem of using relative paths for all nested bat files, and their nested functions. – moonshineTheleocat Sep 11 at 16:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.