Solved

Create ".BAT" file to "Start & Shut Down" Internet Explorer USING A KEYBOARD Key? WIN XP

Posted on 2004-09-17
6
372 Views
Last Modified: 2013-12-04
I'm new to using BATCH files, therefore my knowledge is extremely limited.

I'm using WIN XP Pro!

My question:

How do I create a ".BAT" file using "notepad" to "Start & Shut Down" Internet Explorer by USING A KEY ON MY KEYBOARD?

A Detailed answer would be greatly appreciated since my knowledge with batch files is very limited.

THANKS A BUNCH!
0
Comment
Question by:crepair
  • 2
6 Comments
 
LVL 82

Expert Comment

by:oBdA
Comment Utility
Save this batch someplace as SwitchIE.cmd (or whatever you want to name it). Create a shortcut to it someplace. Right-click the shortcut, choose "Properties", and enter a key in the "Key combination" field ("I", for example). In addition, set the shortcut to start the command in a minimized window (IE will still appear in a regular window).
The script will (without further warning) close any open instances of IE if it finds some; if it doesn't, it will start IE instead.

====8<----[SwitchIE.cmd]----
@echo off
setlocal
set Process=%ProgramFiles%\Internet Explorer\iexplore.exe

for %%a in ("%Process%") do set ExeFile=%%~nxa

tasklist | find /i "%ExeFile%" >NUL
if errorlevel 1 (
  start "" "%Process%"
) else (
  taskkill %ExeFile% >NUL
)
====8<----[SwitchIE.cmd]----
0
 
LVL 11

Expert Comment

by:turn123
Comment Utility
The script errored when I ran it.

ERROR: Invalid Argument/Option - 'iexplore.exe'.
Type "TASKKILL /?" for usage.
0
 
LVL 82

Accepted Solution

by:
oBdA earned 500 total points
Comment Utility
The "taskkill" line should have been
taskkill /im %ExeFile% >NUL
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

In today's information driven age, entrepreneurs have so many great tools and options at their disposal to help turn good ideas into a thriving business. With cloud-based online services, such as Amazon's Web Services (AWS) or Microsoft's Azure, bus…
The term "Bad USB" is a buzz word that is usually used when talking about attacks on computer systems that involve USB devices. In this article, I will show what possibilities modern windows systems (win8.x and win10) offer to fight these attacks wi…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now