I'm trying to run Internet Explorer from a batch file/scheduled task.

My batch file contains (in its entirety):

cd "%ProgramFiles%\Internet Explore"
iexplore.exe http://superuser.com -nohome

When I run the batch file the URL picks up the command line argument, rather than acting on it.

http://superuser.com%20-nohome/

I'm sure I'm doing something silly, but don't see what at the moment. What is the solution?

This is on Windows 7 Home Premium, with Internet Explorer 8.

UPDATE in response to comments:

I got the nohome from some site or other, possilby thw one mentioned in the comments. The previous attempt was actually using nohangrecovery which is documented Internet Explorer Command-Line Options.

My original attempt looked like this (which is actually as per the MSDN documentation:

cd "%ProgramFiles%\Internet Explore"
iexplore.exe -nohangrecovery http://superuser.com

This results in the address bar containing:

http://-nohangrecovery%20http//superuser.com

Sorry if this is a duplicate - I couldn't see any matches when I searched.

link|improve this question

80% accept rate
1  
Is it possible that \Internet Explore is a typo? Isn't it Internet Explorer? – MaxMackie Jul 4 '11 at 13:18
That's a good point - well spotted. Its workng anyway, probably cos the bat file is in the Internet Explorer folder and I'm just clicking on it at the moment. – Jon Egerton Jul 4 '11 at 13:22
It might be because iexplore.exe is in the PATH which means that even if you're 'cd' ing to another directory, Windows is still finding the exe in the PATH. – MaxMackie Jul 4 '11 at 13:42
feedback

3 Answers

up vote 4 down vote accepted

Please refer to the documentation for Internet Explorer command-line options. Command-line options should go before the URL, and -nohome is not even a supported option. Where did you learn about -nohome?

link|improve this answer
Nohome is mentioned on this page referencing command line arguments. tek-tips.com/viewthread.cfm?qid=73898 It seems very outdated and this switch is possibly no longer supported as it is not referenced in newer material – Joe Taylor Jul 4 '11 at 11:56
It's all right with William's solution! Since "iexplore" is a "known command" for Windows, you can start it everywhere using use "start iexplore -nohome bol.com.br/"; (1 command line) instead of entering Internet Explorer folder and then executing that (2 command lines). – kokbira Jul 4 '11 at 11:56
Fair comment about nohome. I had already tried other args and ordering. What I pasted into the question was based on other searches on google. See my update for more. – Jon Egerton Jul 4 '11 at 12:55
Curses - just noticed that the option I'm trying to use is IE9, not IE8. Guess that makes your re-pointer to the docu the answer!!! – Jon Egerton Jul 4 '11 at 13:10
feedback

Just use this command:

"%ProgramFiles%\Internet Explorer\iexplorer.exe" http://superuser.com

No need for the cd\

link|improve this answer
feedback

If you're just trying to open up Super User every time you log in via a batch file then simply put in:

cd "%ProgramFiles%\Internet Explore"
iexplore.exe http://superuser.com

However, if you're doing this to log in for 100 days consecutively then this won't work. I won't tell you why, but it won't :-)

link|improve this answer
lol - no I'm not. I'm mostly on StackOVerflow and I just lost a run of 29 consec days there by not paying attention on Sunday!!! The URL in the example is subbed in for the real one that I'm using. – Jon Egerton Jul 4 '11 at 12:54
Ah ok, I lost a 94 day run by having a hungover Sunday, was gutted. If you just remove the -nohome parameter it should work fine. I've tested it here and its working ok. – Joe Taylor Jul 4 '11 at 14:13
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.