Open text file and program shortcut in a Windows batch file

Mark Ursino picture Mark Ursino · Jul 12, 2011 · Viewed 312.2k times · Source

I have two files in the same folder that I'd like to run. One is a .txt file, and the other is the program shortcut to an .exe. I'd like to make a batch file in the same location to open the text file and the shortcut then close the batch file (but the text file and program remain open).

I tried this with no luck:

open "myfile.txt"
open "myshortcut.lnk"

Also didn't work:

start "myfile.txt"
start "myshortcut.lnk"

Answer

Mark Ursino picture Mark Ursino · Jul 12, 2011

I was able to figure out the solution:

start notepad "myfile.txt"
"myshortcut.lnk"
exit