Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Batch: Open a specific file in a specific program?

How do i tell windows to open C:\test\test.txt in WordPad, when Notepad is my default program for .txt files?

like image 667
Lassa Avatar asked Apr 12 '12 21:04

Lassa


2 Answers

The accepted answer didn't work for me. I am not sure if it was because of the program I was trying to run, or because the path had spaces in (even though I wrapped it in quotes), or something else.

Anyway, I was able to do it be adding an empty string after the start command.

For example:

start "" "C:\My Programs\myprogram.exe" "C:\My Files\myfile.txt"
like image 109
musefan Avatar answered Sep 21 '22 15:09

musefan


You can add the direct path to the executable like

start C:\Windows\System32\write.exe [FILE]
like image 44
corn3lius Avatar answered Sep 19 '22 15:09

corn3lius