Menu

TIP: Run external command and keep shell open

John T.
2007-07-26
2012-11-13
  • John T.

    John T. - 2007-07-26

    Hey everyone,

        While I'm writing python code, I get aggravated because the shell closes before I can see what the errors/messages where. This forces me to open up my shell, navigate to the directory, and then execute the script. I find that quite  inconvenient. So I figured out that entering "cmd.exe /k python "$(FULL_CURRENT_PATH)"" will keep the shell open even after script execution is completed. BTW, remove the outer quotes from the command and substitute "python" for whatever command you want to run.

                Cordially,
                John Tims

     
    • MJG

      MJG - 2007-07-29

      Cool tip!  Thanks for posting it.  --Joel

       
      • Nobody/Anonymous

        Awesome, I have been struggling to get this to work for ages. Try this for a PHP syntax check:

        cmd.exe /k C:\php\php-cgi.exe -l "$(FULL_CURRENT_PATH)"

        Obviously you have to download the PHP ZIP file and extract it somewhere, then change the "C:\php\php-cgi.exe" to the path you extracted it to...

        Have fun...

         
    • Nobody/Anonymous

      I had a similar problem to overcome but even worse in that the program I needed to execute is not on the system path and its path also had spaces.

      I needed to run >c:\program files\html help workshop\hhc.exe c:\my documents\help_project.hhp

      In order to be able to run this command on whatever file I was looking at in Notepad++ I created a batchfile in the Notepad++ directory called CompileHhp.bat containing this:

      "c:\program files\html help workshop\hhc.exe" %1
      pause

      And then created a Notepad++ run command of the form:

      $(NPP_DIRECTORY)\CompileHpp.bat "$(FULL_CURRENT_PATH)"

      Hope this is useful to someone.

      Neutrino.

       
    • Nobody/Anonymous

      I improved this further so that I can run just this one script and it automatically runs the correct tool based on the file extension of the file being edited. This batch file is invoked in the same manner as above using the Run command:

      $(NPP_DIRECTORY)\Execute.bat "$(FULL_CURRENT_PATH)"

      Here is Execute.bat:

      @echo off
      REM A batch file for executing a command on the file currently being edited.
      if /i %~x1 == .hhp goto HtmlHelpProject
      if /i %~x1 == .py goto Python
      goto NoMatch

      :HtmlHelpProject
      echo Executing tool associated with Html Help project.
      "c:\program files\html help workshop\hhc.exe" %1
      goto End

      :Python
      echo Executing tool associated with Python script.
      "c:\program files\python24\python.exe" -m %~n1
      goto End

      :NoMatch
      echo The current file has no execute tool associated with it.
      goto End

      :End

      pause