Batch file that runs cmd.exe, a command, and then stays open at prompt

batchcommand line

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?

Best Answer

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

Related Question