Re: Exit code 2 when using the “del” command to delete/erase a remote file

BatchPatch Forums Home Forums Re: Exit code 2 when using the “del” command to delete/erase a remote file

#9619
doug
Moderator

Exit code 2 means that it can’t find the specified file. In this case it’s throwing the error because it can’t find “del” since that’s not an executable file in Windows.

You have three options.

1. Use Remote Command 3 or 4 with the following syntax, because they incorporate the cmd.exe /C behind the scenes.

del c:test.txt /F /Q

2. In Remote Command 1 or 2 run the following:

cmd.exe /C del C:test.txt /F /Q

3. In Local Process/Command run the following:

cmd.exe /C del \$computerc$test.txt /F /Q