AL_1
AL_1

Reputation: 112

How do i open a file in a program with batch?

I want to open a file that is in a directory down (folder/file.bat) but i want to open it in Notepad++ not cmd.exe. And i want to do this without changing the default program.

How would i do this in batch

I've tried this:

start "" "C:\Program Files (x86)\Notepad++\notepad++.exe" -%server%\run.bat

But it doesn't work.

Upvotes: 1

Views: 1919

Answers (1)

Su Leong
Su Leong

Reputation: 66

I didnt exactly understand your question. But from what I understood I tried the following.

For me I just tried simply putting the filename as an argument to notepad++.exe In my example I kept the file in D:\Test\Notepad++.bat and the Test file Test.txt in D:\Test.txt I wrote this command and it works for me

start "" "C:\Program Files\Notepad++\notepad++.exe" ..\Test.txt

Hope it helps

The link here shows the command line arguments which can be passed to notpad++.exe

Upvotes: 3

Related Questions