If you’re running a batch script from a network share, you might see a message like this:
CMD.EXE was started with the above path as the current directory. UNC paths are not supported. Defaulting to Windows directory.
This is just a warning message and not an error but it can still cause confusion among users even if the script works perfectly. You can allow the Command Prompt to use UNC paths as the current directory by adding a value to the registry.
Under the HKey Current User, drill down to Software\Microsoft\Command Processor. Add a value if it doesn’t already exist, called DisableUNCCheck. It should be a DWORD value. Make the data a 1 (in hexadecimal) to allow UNC paths.
Of course, you can script adding this registry value by running something like this:
reg add “HKCU\Software\Microsoft\Command Processor” /v DisableUNCCheck /t REG_DWORD /d 0x1 /f
After making this registry change, you will be able to make UNC paths as the current directory.
The only reason this is not set by default is that it may cause problems with certain applications if the console used to launch them is closed. I have yet to see any of these problems. If needed, you can set this registry value to 0x0 (Hex) to re-enable the check.
You can read more about it in the Microsoft Knowledge Base: http://support.microsoft.com/kb/156276