Reputation: 57926
I have created a small command that will let me launch Internet Explorer. However, I wish to close the small command prompt that shows up when I launch IE. How can I do this? This is my current code:
"%ProgramFiles%\Internet
Explorer\iexplore.exe"
http://localhost/test.html
PAUSE
I am guessing if I take out the Pause. It will close the CMD box upon closing IE??
Also is there another command that I can use to simply create a command that will let me add something to the Menu with a small icon, which in turn runs the above. Is this complicated? Any tutorials I can use?
Thanks all
Upvotes: 9
Views: 74630
Reputation: 51
Command Prompt always takes the empty space as separator, unless it's enclosed in double quotes. So, if any Path, or Program/File Name, or anything includes empty space/es, must closed in quotes.
"C:/Program
files/..."
path/directory or "Any
Program/Command/File.exe/cmd/txt..."
Program/Command/File Name includes space/es.Syntax:
> start /?
Starts a separate window to run a specified program or command.
START ["title"] [/D path] (start swiches here...) [command/program] (com/prog-parameters here)
start "" /d "Drive:/the/Program/Path/..." "Command/Program Name.extension" "File-Name.extension"
So, it's usual fault:
If you don't set the 1st set of quotes ""
for title (even if there's nothing to enclose), then the START
command takes whats inside the 1st quotes set (eg. path! or Program Name!) and sets it as title... and of course, it messing up.
Upvotes: 0
Reputation: 1
A little late here, but running it in minimized mode or invisible mode might be another option. Source: https://www.winhelponline.com/blog/run-bat-files-invisibly-without-displaying-command-prompt/
Running .BAT or .CMD files in minimized mode To run a batch file in a minimized window state, follow these steps:
Upvotes: 0
Reputation: 3567
You can also launch your program with the /c
switch, which terminates the cmd once its finished executing
for example
cmd /c "%ProgramFiles%\InternetExplorer\iexplore.exe" http://localhost/test.html
Upvotes: 2
Reputation: 101666
@echo off
start "" "%ProgramFiles%\Internet Explorer\iexplore.exe" "http://www.example.com"
exit /b
But you really should not force IE, but use the default browser:
@echo off
start http://www.example.com
exit /b
exit /b does not work on win9x IIRC, so if you need to support every version of windows and close the terminal window if the user double clicks your batch file, go with:
@echo off
start http://www.example.com
cls
Upvotes: 4
Reputation: 125498
you need this on the end
&& exit
For example
"%ProgramFiles%\Internet Explorer\iexplore.exe" http://google.co.uk && exit
Upvotes: 9
Reputation: 176179
Use the start
command:
start "title" "%ProgramFiles%\Internet Explorer\iexplore.exe" http://www.example.com
Upvotes: 17
Reputation: 11628
You have to add 'start' in front of every program you launch, elsewhere your script is going to wait until it's finished.
Upvotes: 1