As part of a network engineering team, one of the common problems we have is lack of access to CLI tools when we are diagnosing various windows machines

While the perfect world is to get the server and desktop teams to install these utilities on all systems, the real world is that it won't happen for all machines. My idea: give team members a read-onlyNote 1 USB that they can insert into machines so they can diagnose issues, even if that windows machine can't mount a corporate network share.

However, this plan depends on yet another activity... when the USB is plugged into a windows machine, I need whatever drive letter is assigned to somehow be put into the Windows %PATH% (hopefully automatically). How can I do this from resources installed on the USB itself?

Note 1: Read-only to avoid the obvious issues with security and virus infections

  • I edited your title to more accurately reflect the problem at hand, since it seems what is on the USB stick is less important.
    – MDMarra
    Jul 24, 2012 at 18:47
  • Why do you need the drive letter in the %PATH% variable? Wouldn't it be easier to open your command window from the USB stick? (So it's at E: (or whatever) instead of C:\[userprofilepath] or %systemroot%?) Jul 24, 2012 at 20:39
  • No it's not easier to open from the command window... Why should people have to depend on being in the same directory as the USB? What if you need to cd around the machine in question and you aren't in the USB root? Jul 24, 2012 at 20:51

1 Answer 1


You can use the setx command to set the PATH that will be given to newly opened shells. Combine that with an autorun batch file and you should be in good shape. You will have to reverse the procedure before ejecting the drive though.

As an alternative, have a cmdln.bat on the drive that opens a shell with environment configured how you would like it. That way there are no changes to the target machine.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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