There are 3 possible issues.
- The file does not exist.
- C:\windows\system32 is not in the system path variable.
- Something within the .cmd file is changing the path variable
.
Does C:\windows\system32\robocopy.exe exist?
Does your cmd file execute C:\windows\system32\robocopy.exe or does it just call robocopy? If the latter, change the statement to include the full path to the file.
Does the error only occur when you run that cmd file? If you just open a command prompt window and type in robocopy, does the program execute? Does anything in the cmd file reference %path%?
If you open a command prompt window and run this command, what does it show?
where robocopy
.