0

What's the proper way to shut down all of the instances of internet explorer for the current user using batch commands? I have this. There can be multiple users logged into the same computer. What am I missing?

taskkill /IM iexplore.exe

4
  • /U [username] will allow you to specify a user.
    – Wutnaut
    Jun 2, 2014 at 21:22
  • How do I specify the current user?
    – EThan
    Jun 2, 2014 at 21:24
  • %USERNAME% I believe.
    – Wutnaut
    Jun 2, 2014 at 21:28
  • @Wutnaut The /U switch only specifies the user context under which the command should run - it doesn't necessarily filter its effectiveness down to processes run only by that user. Easy fix: Don't run it as an Administrator.
    – Iszi
    Jun 2, 2014 at 21:38

1 Answer 1

2

TASKKILL does support filtering by username, but it's not with the /U switch, as @Wutnaut suggested. Try this:

TASKKILL /FI "USERNAME EQ %USERDOMAIN%\%USERNAME%" /IM IEXPLORE.EXE

The /FI switch allows filtering based on several properties. Here, we're calling the %USERDOMAIN% and %USERNAME% environment variables to get the current user's identity for that filter.

In any case, the filter should not be necessary if you're running from a non-elevated command prompt. Without elevation, you should not be able to control the processes of other users. (This may be dependent on the rights of the current user on the system, and the UAC configuration.)

You may also want to consider adding /T to catch any child processes of Internet Explorer, and/or /F to forcefully terminate everything in case something's hung.

Run TASKKILL /? to get more information about these switches, and proper syntax.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .