If you have ever tried working with UNC paths with the CMD either at the console or using a batch file you likely have run into a problem like this:
CMD does not support UNC paths as current directories.
Luckily there are a couple useful commands to overcome this limitation. The commands are "pushd" and "popd".
'Pushd' used with a UNC path will mount the path as a network drive and automatically save the network drive to it's working directory.
We can now run commands against our network location.
To disconnect the share we can simply use the 'popd' command.
This is how it may look in a batch file.
@echo off pushd "\\Server\Share\Folder" "Commands to execute" pushd