Batch script to launch an application
I've a simple batch script npp.bat to open a file in Notepad++
"C:\Program Files\(x86)\Notepad++\notepad++.exe" %1
Notepad++ launches with the file when I run npp <file_name>>
but the command window waits for the application to exit. I don't want it to wait.
Solution 1:
Use start
instead:
start "" "command here"
Edit: Do not miss the first pair of empty quotes, this is the title of the process/window.
start <title> <command> <parameters>
See start /?
for further details.
Solution 2:
I wanted to be able to do "npp file.txt" on the command prompt and be able to edit files using Notepad++. For this, I created a new folder, added it to Windows PATH, and created a file there called npp.bat with the following content:
@echo off
start "" "C:\Program Files\Notepad++\notepad++.exe" %1
Very useful when I'm working on the console and need to edit a file.