Starting notepad++ from Windows CMD, CMD doesn't close anymore ...



  • Hello,
    I start notepad++ (Portable version) from a Windows CMD like:

    rem run some code …
    start “” /Normal “%npppath%\notepad++.exe” -multiInst -notabbar -nosession -ro -x10 -y10 “%bcLogs%\Logs\P0102Warn.txt”
    rem run some code …
    EXIT

    In the past notepad++ opens and the cmd was closed after exit.
    Now: the cmd exits no more - only when notepad++ is closed then also the cmd closes.

    Testing with winword.exe is OK: winword.exe starts and cmd closed.

    What has been changed ???
    Changes in npp?
    Changes in Windows?

    Volker01



  • @volker001 .

    I’ve occasionally noticed that: usually when running Notepad++ from a batch file, the notepad++.exe process goes into the background, and the batch is able to continue to run and end as I would expect. But every once in a while, the same batch file will decide to wait for Notepad++ to exit before continuing.

    Or sometimes it’s one computer consistently backgrounds NPP, but copy the same .bat to another computer, and it consistently waits for NPP.

    I’ve never been able to figure out what’s causing it – though there are some NPP options that I have found consistently block (make the .bat wait until the command completes). I’ve got a script that I want to block (so that it can be used for svn commit messages), and in that one, if I call it as

    @echo off
    rem     backup config/session
    copy "\usr\local\apps\notepad++\config.xml" "\usr\local\apps\notepad++\config.xml.arcdiffbak"       > NUL
    copy "\usr\local\apps\notepad++\session.xml" "\usr\local\apps\notepad++\session.xml.arcdiffbak"     > NUL
    
    rem     blocking instance of notepad++, so that commit will complete once this instance is exited
    "\usr\local\apps\notepad++\notepad++.exe" -multiInst -nosession %*
    
    rem     restore the config/session
    move /Y "\usr\local\apps\notepad++\config.xml.arcdiffbak" "\usr\local\apps\notepad++\config.xml"       > NUL
    move /Y "\usr\local\apps\notepad++\session.xml.arcdiffbak" "\usr\local\apps\notepad++\session.xml"     > NUL
    

    You appear to be using the -multiInst and -nosession options as well, so it may be that you’ve put it into blocking mode. Normally, I would think your START should launch it as a separate process, so it shouldn’t wait… but as I said, I have inconsistent results sometimes.



  • Thank you, for your answer,

    now i have checked a liitle bit more and i found the master.bat start with an mtee splitter.
    (http://ritchielawrence.github.io/mtee/)
    “test.bat” 2>&1 | mtee_versions\mtee.exe /C “test_bat.log”

    Without the splitter notepad++ works as expected.
    So i think there changes from microsoft in windows.


Log in to reply