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

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.