Community
    • Login

    Deleting file in Execute console

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    5 Posts 2 Posters 4.3k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Александр ШапошниковА
      Александр Шапошников
      last edited by

      Answer, please, if there is any npp-console command (such as npp-save) for deleting file. I need to delete old executable file before compilation on g++. Maybe you know another way to prevent running of the old exe-file if compilation is failed. Example:
      PP_SAVE: C:\Qt\MinGW\projects\02\test3.c
      CD: C:\Qt\MinGW\projects\02
      Current directory: C:\Qt\MinGW\projects\02
      g++ “test3.c” -o test3 -march=native -O3 -std=c++11
      Process started >>>
      test3.c: In function ‘int main()’:
      test3.c:54:23: error: ‘vu33’ was not declared in this scope
      for (; c3_Iter != vu33.end(); c3_Iter++)
      **<<< Process finished. (Exit code 1)
      NPP_RUN: test3 **

      Claudia FrankC 1 Reply Last reply Reply Quote 0
      • Claudia FrankC
        Claudia Frank @Александр Шапошников
        last edited by

        @Александр-Шапошников

        use the standard cmd shell del command.

        Cheers
        Claudia

        1 Reply Last reply Reply Quote 0
        • Александр ШапошниковА
          Александр Шапошников
          last edited by

          Thanks, Claudia.
          But:
          Result of adding command " del $(NAME_PART).exe" in Execute script:

          NPP_SAVE: C:\Qt\MinGW\projects\02\test3.c
          CD:
          Current directory: C:\Qt\MinGW\projects\02
          del test3.exe
          CreateProcess() failed with error code 2:
          the specified file was not found

          Result of adding command “NPP_RUN del test.exe”
          NPP_RUN: del test.exe

          • the specified file was not found
          Claudia FrankC 1 Reply Last reply Reply Quote 0
          • Claudia FrankC
            Claudia Frank @Александр Шапошников
            last edited by Claudia Frank

            @Александр-Шапошников

            you need to call it from within the cmd shell.
            See NppExec notes

            4.4. Using cmd.exe

            NppExec by itself does not support standard console commands such as “copy”, “move”, “mkdir”, “for” etc. Actually, these commands are part of system’s command interpreter (cmd.exe). So, you can use cmd.exe to perform such commands. For example, you can type the following commands in NppExec’s Console or inside NppExec’s script:

            // create a directory C:\Backup
            cmd /c mkdir C:\Backup
            // save current Notepad++'es file
            NPP_SAVE
            // copy current file to C:\Backup
            cmd /c copy "$(FULL_CURRENT_PATH)" "C:\Backup\$(FILE_NAME)" /Y 
            // change current directory
            cd C:\Backup
            // list all .txt files in C:\Backup
            cmd /c for %f in (*.txt) do @echo %f
            

            If you want to see what happens within the cmd shell, replace /C with /K
            and console will stay open.

            Cheers
            Claudia

            Александр ШапошниковА 1 Reply Last reply Reply Quote 2
            • Александр ШапошниковА
              Александр Шапошников @Claudia Frank
              last edited by

              @Claudia-Frank

              It works!

              Thank you!

              1 Reply Last reply Reply Quote 0
              • First post
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors