[SOLVED] Batch - Open IE or Notepad Full Screen

jcgriff2

Co-Founder / Admin
BSOD Instructor/Expert
Microsoft MVP (Ret.)
Staff member
Joined
Feb 19, 2012
Posts
21,541
Location
New Jersey Shore
I should know this by now, but. . .

I want to include in a batch script the command necessary to open Notepad or IE (or default browser) full screen (/max).

1. This works - Notepad & my test file - just fine:
Code:
start /max notepad "%userprofile%\documents\test1.txt"

2. This brings up a MAX CMD screen (no Notepad):
Code:
start /max "%userprofile%\documents\test1.txt"

3. This just brings up Notepad with the specified file (text1.txt), but of course does not maximize Notepad:
Code:
start notepad "%userprofile%\documents\test1.txt"

4: This brings up a new regular (size-wise) CMD screen: (NO Notepad):
Code:
start "%userprofile%\documents\test1.txt"

Why doesn't #4 bring up Notepad opened with the specified file? I've used similar code in various posts and believe (or thought...) that the file ext would/should cause Notepad to open...?

Same questions re: Internet Explorer (or user's default browser).

I want to open the user's default web browser with the specified HTML file, but can't get it to work correctly.

5. This works - brings up a maximized IE screen containing the specified file:
Code:
start /max "%programfiles%\internet explorer\iexplore" "%userprofile%\documents\test1.html"

6. This simply brings up a MAXimized CMD screen - no IE or other browser:
Code:
start /max "%userprofile%\documents\test1.html"

How can I code my batch script to open the HTML file using the user's default web browser app?

Thanks,

John
 
Hi John,

I had a quick play with this. To get this working I had to use the cd command to the specific folder that contains the html/txt file.

From here I was able to launch the txt and html file by running start /max file.txt this launched in notepad full screen. When running start /max file.html this launched the html file in max screen with my default browser.

But there is also another way, remove the "" around the file path will make it work...Only issue with this is if the user has a space in their username.

Turn this
Code:
start /max "%userprofile%\documents\test1.html"

Into this
Code:
start /max %userprofile%\documents\test1.html
 

Has Sysnative Forums helped you? Please consider donating to help us support the site!

Back
Top