Jump to content

Recommended Posts

Posted

 

The problem I always come across in BAT files is that it uses the "command.com" NOT the "cmd.com" to run stuff, which is very inconvenient sometimes.

 

Unless you've done something very strange, then .BAT will run in cmd.exe (try it - put the word pause in test.bat and run it - you'll see cmd.exe appear in taskmgr but no command.com)

 

if you want to have a slightly shorted command to unmap all drives then:

 

for %i in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do net use %i: /d

should work - you can test that at a command prompt.

 

In a batch file you need to double up the % signs:

 

for %%i in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do net use %%i: /d

Posted

I tag on /persistent:no to the end of a mapping so that the drive isn't mapped permanently.

 

net use p: \\servername\public /persistent:no

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...