JSI Tip 3458. How do I delete all the printer mappings in a batch?


If your batch contains net use * /d /y, all the net use mappings, will be deleted.

To delete all the printer mappings made with the net use command, include the following in your batch:

for /f "Skip=4 Tokens=2" %%i in ('net use') do @if not "%%i"=="command" @if not "%%i" LSS "LPT1" @if  not "%%i" GTR "LPT9" net use %%i /d




Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish