|
Question : Batch script for temporary mapped net drive
|
|
Does anyone know the syntax for a batch that will do the following?: 1. check to see if a mapped drive exists 2. if so, validate that a file exists on the remote drive 3. if neither, create map with a specified drive letter 4. if server not found, return gui error message 5. only if both successful, launch executeable on the mapped drive 6. delete the mapped drive when the program is exited and don't prompt for y/n 7. return gui message if map successfully deleted
This script is for a doc mgmt prog. This works, but it is missing the delete drive and file check portions:
net use K: /d net use K: \\servername\sharename /user:username password /persistent:no K:\sharename\executeable
Thanks.
|
Answer : Batch script for temporary mapped net drive
|
|
Hi GisGeek, Something like this?
@echo off if not exist K:\ net use K: \\servername\sharename /user:username password /persistent:no
:runit if exist K:\sharename\executable start K:\sharename\executeable if not exist K:\sharename\executable goto remap goto end
:remap net use K: /del net use K: \\servername\sharename /user:username password /persistent:no if exist K:\sharename\executable goto runit net send %computername% Executable does not exist!
:end net use K: /del
|
|
|
|