@vitalii-dovgan said in Notepad++ v8.3.2 release - Declare variables, not war:
Hmm, I tried to reproduce it today with different scenarios - and could not. Though it was stably reproducible yesterday.
Now I’m having a strong confidence that the issue was connected to improper invocation of Notepad++ from my side. Sorry for the previous misleading.
Anyway, as the result I’ve created a batch script that can be used to add a context menu item “Edit with Notepad++” for a single file and “Open in Notepad++” for a folder, using either a portable or an installed version of Notepad++. If interested, you can place this file directly into the Notepad++ folder and run it there.
The content of “npp_context_menu.cmd” :
@echo off
echo Initialization...
set EXEDIR=%~dp0
set "EXE=%EXEDIR:\=\\%notepad++.exe"
set REGFILE=npp_context_menu.reg
if exist "%REGFILE%" del "%REGFILE%"
echo Writing "%REGFILE%"...
1>>"%REGFILE%" echo Windows Registry Editor Version 5.00
1>>"%REGFILE%" echo.
1>>"%REGFILE%" echo [HKEY_CLASSES_ROOT\*\shell]
1>>"%REGFILE%" echo.
1>>"%REGFILE%" echo [HKEY_CLASSES_ROOT\*\shell\notepadpp_edit_file]
1>>"%REGFILE%" echo @="Edit with &Notepad++"
1>>"%REGFILE%" echo "Icon"="\"%EXE%\",0"
1>>"%REGFILE%" echo.
1>>"%REGFILE%" echo [HKEY_CLASSES_ROOT\*\shell\notepadpp_edit_file\command]
1>>"%REGFILE%" echo @="\"%EXE%\" -nosession \"%%1\""
1>>"%REGFILE%" echo.
1>>"%REGFILE%" echo [HKEY_CLASSES_ROOT\Directory\shell]
1>>"%REGFILE%" echo.
1>>"%REGFILE%" echo [HKEY_CLASSES_ROOT\Directory\shell\notepadpp_edit_folder]
1>>"%REGFILE%" echo @="Open in &Notepad++"
1>>"%REGFILE%" echo "Icon"="\"%EXE%\",0"
1>>"%REGFILE%" echo.
1>>"%REGFILE%" echo [HKEY_CLASSES_ROOT\Directory\shell\notepadpp_edit_folder\command]
1>>"%REGFILE%" echo @="\"%EXE%\" -multiInst -nosession -openFoldersAsWorkspace \"%%1\""
1>>"%REGFILE%" echo.
REM Converting to UCS-2 LE (not mandatory)
if exist "%~dp0..\sfk\sfk.exe" set PATH=%PATH%;%~dp0..\sfk
sfk atow "%REGFILE%" -tofile "%REGFILE%"
if not exist "%REGFILE%" goto ErrorNoRegFile
echo Registering "%REGFILE%"...
start "Registering %REGFILE%" "%REGFILE%"
goto Done
:ErrorNoRegFile
echo ERROR: "%REGFILE%" does not exist!
pause
goto Done
:Done
This invokes Notepad++ using its -nosession command line argument to not affect the opened file history (this is especially useful when opening a folder).