• Login
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 Apr 23, 2017, 10:13 PM

    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 **

    C 1 Reply Last reply Apr 23, 2017, 10:27 PM Reply Quote 0
    • C
      Claudia Frank @Александр Шапошников
      last edited by Apr 23, 2017, 10:27 PM

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

      use the standard cmd shell del command.

      Cheers
      Claudia

      1 Reply Last reply Reply Quote 0
      • А
        Александр Шапошников
        last edited by Apr 24, 2017, 10:28 AM

        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
        C 1 Reply Last reply Apr 24, 2017, 10:39 AM Reply Quote 0
        • C
          Claudia Frank @Александр Шапошников
          last edited by Claudia Frank Apr 24, 2017, 10:40 AM Apr 24, 2017, 10:39 AM

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

          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 Apr 24, 2017, 12:32 PM Reply Quote 2
          • А
            Александр Шапошников @Claudia Frank
            last edited by Apr 24, 2017, 12:32 PM

            @Claudia-Frank

            It works!

            Thank you!

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