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, eg : \\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!
双引号适合我
cmd.exe /c "\\127.0.0.1\c$\temp\Test Folder\test.cmd"
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.