2

I am trying to use the -l parameter in a notepad++ command line to open a file and have the highlighting be set to highlight for C++.

I typed in the command:

 notepad++ -lC++ file.cpp

For some reason this does not work.

Notepad++ is already added to the PATH.

  • 1
    What is it doing when that command is entered? For instance is the error: "'notepad++' is not recognized as an internal or external command, operable program or batch file."? – Jason Aller May 2 '15 at 4:53
  • there is no error that the program returns, it just doesnt set the syntax highlighting to C++ format. The file opens with no highlighting. – Stephen May 2 '15 at 7:31
2

The language names you see in the menus are not the names you need to use. You can see a list of all the languages in the langs.xml file in your Notepad++ data directory, which is usually:

%APPDATA%\Notepad++\langs.xml

In that file you will see the name property for C++ files is actually cpp.

notepad++ -lcpp file.cpp
1

Thank you @heavyd for your answer. I used this code to open a command line compiling environment and open a new .cpp file in notepad++ with syntax highlighting.

Here is how I used it:

@echo off
set /p newprogram="Enter Program Name:"


start cmd /C "cd C:\source\ && notepad++ -lcpp %newprogram%.cpp"
start cmd /K "E:\VisualStudio\VC\vcvarsall.bat && cd C:\source\"

exit

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.