1.

Solve : Forcing a file to open in IE/relative link problem?

Answer»

Hello All,

I'm trying to WRITE a batch file which will forcibly open an .htm file in IE for when IE isn't the default browser.

I've tried doing this by using the start command:

start iexplore test.htm

and although IE opens, it automatically treats test.htm as a URL, rather than just a file.

test.htm is a file in the same folder as the bat file.

I know an absolute file link to the file (ie: C:\docs\test.htm) will work, but I can't really use this as the location of the bat file and test.htm will change.

Therefore, does anyone know how I can refer to this file so that it will open in IE without being TREATED as an URL?

Any HELP much appreciated.If the HTM and the batch are always in the same directory then you can prefix the HTM file name with the path of the batch as follows:

start iexplore "%~dp0.\test.htm"

... whereas %~dp0 will RESOLVE into the drive and path of the batch file.

DOS IT HELP? Ahhh, that makes perfect sense.

I did start to go down this root, but couldn't quite GET the hang of the syntax to retrieve the path.

Thanks very much for your assistance.

Cheers.



Discussion

No Comment Found