Reputation: 4216
I am trying to call a batch file from a PowerShell 5.0 Script. The path for the batch file is :
\\192.168.0.1\hde_path\Tools Powershell\abc.cmd
So, my path has a white space inside it and I tried to call it in the following way..
cmd.exe /c "'\\192.168.0.1\hde_path\Tools Powershell\abc.cmd'"
Now, it gives the error:
The system can not find the file specified.
But, please note:
Again, when I am putting abc.cmd file in some path where the path does not have any space in it, e.g. : \192.168.0.1\hde_path\Tools\abc.cmd and I call it using the following command, it runs perfectly fine.
cmd.exe /c '\\192.168.0.1\hde_path\Tools\abc.cmd'
Please help!
Upvotes: 3
Views: 83
Reputation: 560
Double quotes works for me
cmd.exe /c "\\127.0.0.1\c$\temp\Test Folder\test.cmd"
Upvotes: 3
Reputation: 23395
Either
cmd.exe /c '\\192.168.0.1\hde_path\Tools Powershell\abc.cmd'
or
cmd.exe /c "\\192.168.0.1\hde_path\Tools Powershell\abc.cmd"
Should work.
Upvotes: 1