3

I basically have a file, for example, something.txt, and I want to be able to automatically open up that file using Notepad++.

I had atempted using the start command in a batch file, but i didnt understand much, so I just came here to ask you.

6
  • 1
    <full path to>\notepad++ "something.txt" Commented Feb 7, 2020 at 21:46
  • Ok :D Is that for the start command? I guess so Commented Feb 7, 2020 at 21:51
  • 1
    start is not needed. Just execute the program Notepad++ with the filename as parameter. Commented Feb 7, 2020 at 21:54
  • Ok :D Done it :D It worked, thanks very much Commented Feb 7, 2020 at 22:03
  • 3
    It may be safer to use @Start "" "%ProgramFiles%\Notepad++\notepad++.exe" "F:\ull\Path to\something.txt" or @Start "" "%ProgramFiles(x86)%\Notepad++\notepad++.exe" "F:\ull\Path to\something.txt", depending upon the install location of the program. I'll be surprised however if the installation didn't add the respective registry entry under [HKLM|HKCU]\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\notepad++.exe, to save you having to provide its full path. If something.txt is in the current directory, and your %PATHEXT% contains .EXE, just use @Start notepad++ something.txt. Commented Feb 7, 2020 at 22:08

1 Answer 1

3

Try this (don't forget the double quotes)

"C:\Program Files\Notepad++\notepad++.exe" something.txt
Sign up to request clarification or add additional context in comments.

5 Comments

Hey, I put this line you sent me here onto a start command and it still started normally on the default notepad.
Ok I looked at the other comments, people said that I don't need start. I removed it. It worked. Thanks everyone.
If you don't use Start, and you're trying it from a batch script, the script will wait for it to be closed before it continues or closes. If there are no more commands to run after opening your file in Notepad++, and you use Start the cmd.exe window will close instead of staying open in the background. If there are more commands to run, and they're not dependent upon having read the file content and closed Notepad++, Start will mean that those commands will continue to run without waiting for you to close Notepad++. Open a Command Prompt window and enter start /? for its info.
@MantvydasViršilas please accept the answer if you are happy with it ;-)
@Mantvydas: start takes the first quoted string as a window title, so when you added start you opened an (unneeded) cmd instance with the title C:\Program Files\Notepad++\notepad++.exe, which in turn starts something.txt with its default editor (which happens to be the Windows Notepad). If you need to use start for some reason, the syntax would be start "title" "program" "parameter"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.