3

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.

2
  • 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."? May 2, 2015 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, 2015 at 7:31

2 Answers 2

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
0
2

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .