Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I would like to make a batch file that:

  1. Opens cmd.exe
  2. Within that Command Prompt runs net use to display mapped share paths
  3. Leaves the window open so that I can run additional commands if I wish to

How can I do this?

share|improve this question

1 Answer 1

up vote 18 down vote accepted

Put in your batch file

start cmd.exe /k "net use"

From cmd /?

Starts a new instance of the Windows XP command interpreter

CMD [/A | /U] [/Q] [/D] [/E:ON | /E:OFF] [/F:ON | /F:OFF] [/V:ON | /V:OFF] [[/S] [/C | /K] string]

/C Carries out the command specified by string and then terminates
/K Carries out the command specified by string but remains

share|improve this answer
    
I am not entirely sure why, but the batch file with that first line opened about 100 windows... –  AaronLS Feb 9 '10 at 22:06
5  
Oh, I know why, I named my batch file "net use.bat", and therefore cmd.exe tried to run "net use" and found the batch file first since it was the closest, therefore it was recursively running the batch file. LOL :() –  AaronLS Feb 9 '10 at 22:09
1  
@aaronls That is hilarious:) –  phoebus Feb 9 '10 at 22:13
    
Sorry, should have been more specific. Perhaps you should use net.exe use next time... proof you can never assume anything. –  heavyd Feb 9 '10 at 22:48
2  
davr's "hilarious" batch file quickly brought my Win 7 machine to a halt. It wouldn't respond to Ctrl+Shift+Esc, Ctrl+Alt+Delete, Ctrl+Break etc. Make sure your documents are saved first. –  Qwertie Mar 21 '12 at 23:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.