Simplify UNC usage in command line batch files » Computer internet security 
information computer networking security
 
|
|
|
News
|
Advertise
|
|
Products
|
Contact
 



Simplify UNC usage in command line batch files

Sunday, February 18, 2007, 15:43
This news item was posted in Computer security Systems category and has 0 Comments so far.

Many times a UNC path does not work properly in a command line bat file. This is a hold over from DOS, a compromise to ensure backward compatibility.

I have found a little known command (At least to me). Actually there are two of them.
PUSHD, and POPD
Call PUSHD with a UNC share as a single argument and it automatically maps the UNC share to a drive letter. (It starts at Z: and moves backward). So, if we wanted to run a few command line programs within our share we would call it like this:
pushd \\server\sharecommand1.exe command2.exe

When you are finished, and want to remove the mapping you call popd. Putting it all together we have this:
pushd \\server\sharecommand1.exe command2.exepopd

I have tested this with Windows NT 4 SP6, and it works all the way through Vista…so you are safe using it on any of these versions of Windows.
Check out our Windows Admin Tools

Original post by Steve Wiseman and software by Elliott

Related posts






You can leave a response, or trackback from your own site.

Leave a Reply