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
NppExec by itself can not redirect console program's output into a text file. (*) And, again, you can do it via cmd.exe:
cmd /c program.exe >program.txt
or even
cmd /c for /? >for.txt
By the way, cmd.exe allows to execute several commands one after another while each previous command is completed successfully. For example:
cmd /c for /? >for.txt && type for.txt cmd /c C: && cd C:\Backup && for %f in (*.txt) do @echo %f
You can always type
cmd /?
for more details about cmd.exe and its commands. You'll be surprised how powerful it is :)
Don't forget you can execute .bat and .cmd files in the same way as executable files [3.3] - but the file extension (.bat or .cmd) can not be omitted in this case. (*) The batch files (.bat or .cmd) allow to implement sequences of commands with simple algorithms, so you can use them when single cmd's commands are not enough.
(*) Starting from NppExec ver. 0.6 RC3, it is possible to execute batch files (such as .bat and .cmd) without specifying their extension, as well as it is possible to avoid explicit usage of "cmd /C" to execute the command interpreter's commands. A new advanced option "ChildProcess_RunPolicy" was introduced for this. Set its value to 1 or 2 according to the desired behavior. Refer to "doc\NppExec\NppExec_TechInfo.txt" for further details.
Finally, a few words about the Delayed Expansion ( https://ss64.com/nt/delayedexpansion.html
). According to cmd's help, this option can be turned on by specifying
cmd /V:ON
Here is an example of running a batch file that relies on the Delayed Expansion (thus using /V:ON). This example assumes that the current document is a batch file (thus using "$(FULL_CURRENT_PATH)") and you want to run it in its own separate console window (thus using NPP_RUN):
NPP_RUN cmd /V:ON /C "$(FULL_CURRENT_PATH)"
See also: Do something (how-to) [3.3]; Console output redirection [4.5]; Grab date & time to NppExec variable [4.6.5]; Run and terminate PowerShell process [4.6.7]; Send several commands to external tool [4.6.9].