Search code examples
cmdremote-accesspsexec

cmd exited with error code 1


I am trying to search a file on remote PC using PSEXEC, however I am getting the above mentioned error.

Can any please suggest any change in the command or some thing else, that can assist in making it work. Online search suggests that this isn't the issue of PSEXEC, instead is caused by explorer.exe on remote host.

I have added picture of my result. I have tried the command with quotes on file name and without. both have same error.

enter image description here


Solution

  • This command dir exists with code 1 and message "File Not Found". Because you run cmd with param /c than it return same error code like dir and it is equal 1.

    It is correct behaviour.

    If you want to find a file, than use command where /r c:\ d.txt. This command was added in Windows 7.

    Or use dir /S /P "d.txt" for older OS