CMD does not support UNC paths as current directories

Nelson picture Nelson · Jul 13, 2017 · Viewed 23.1k times · Source

We have batch scripts that seem to run fine however I am editing one of them to include some new work and when manually running the script (by double-clicking from windows explorer) I get the above error message each time a pushd command in the script is encountered. These are pushd commands that have been there since the year dot and the scripts are running fine. Is there a difference between the batch script running manually and when started by a scheduler? How can I disable the error message when running manually (if this is possible)?

Answer

Arsalan Kazmi picture Arsalan Kazmi · Nov 26, 2018

I have some advice - consider rewriting your script in PowerShell. PowerShell allows the current working directory to be on a network. PowerShell as a whole is more versatile and powerful than CMD is. It's also cross-platform. Consider switching.