Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have some scripts to do some work for me on Windows 7, and one issue I have is that my most used script lives on a flash drive, clears out the Drivers folder, then opens the Drivers folder for me automatically. Is there any way to have it close the original Windows Explorer window where I clicked the icon? I can't put a shortcut on my desktop because the flash drive letter changes a lot

share|improve this question
Are you open to the script being a power shell script or must it be a batch script? – Scott Chamberlain Mar 17 '12 at 19:09
I don't know about Windows 7, but on XP you can go to Disk Management and assign a drive letter to a flash drive while it is plugged-in and afterwards it will always be assigned that drive letter when you plug it in again (assuming the letter is not in use by something else at the time). – martineau Mar 17 '12 at 19:23
@ScottChamberlain I would much rather it be the regular .BAT or .CMD script as it should run on Windows 2000 or higher – Canadian Luke Mar 17 '12 at 19:44
@martineau Yes, 7 and Vista can as well; my issue is that this will be in other computers as well, and sometimes I have 3 or 4 other drives plugged in on USB that I scan for as well (I work in a computer shop) – Canadian Luke Mar 17 '12 at 19:44
Luke: OK, then maybe your script could begin by executing this free program which closes all open Explorer windows -- which is overkill but might be acceptable -- only thing is I don't know if it'll work on Win7... – martineau Mar 18 '12 at 19:53

You must log in to answer this question.

Browse other questions tagged .