Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
    
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 '12 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%?) –  HopelessN00b Jul 24 '12 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? –  Mike Pennington Jul 24 '12 at 20:51

1 Answer 1

up vote 3 down vote accepted

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.

share|improve this answer
    
How does the autorun batch file know what drive letter has been assigned to the USB? –  Mike Pennington Jul 24 '12 at 19:40
    
Presumably, it would be the "current" drive letter when the autorun.bat is running. Try this method stackoverflow.com/questions/866623/… –  Chris Nava Jul 24 '12 at 20:42

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.