1

I'm testing a solution for a user getting access denied when running a scheduled backup batch script or by double-clicking it.

I've noticed I have the same issue for a simple xcopy call. Specifically, if I run the xcopy string or call the batch file containing the script from cmd, it works and the file is copied, but if I double-click the file the terminal window shows up for a while and then closes, and the file is not copied. I've tried several solutions like adding a "C:" or "Cd" line, entering the full path to xcopy.exe and adding a call to cmd.exe with the /C parameter at the beginning of xcopy line. Any possible combination of these solutions brought no changes.

Edit: by adding a pause as suggested by @MicroservicesOnDDD I notice I'm getting "access denied". Now I've tried creating another bat with "runas /noprofile /user:\ ". It asks me for password and runs the other bat from which I'm still getting an access denied. I'm using a domain user set as administrator for this computer and I'm doing all this on my default desktop. (C:\Users\\Desktop)

2
  • 1. Add a "PAUSE" command to the end of the batch file and see if there are any error messages. 2. Often the environment is different, which means the path (where commands are searched), the current directory (this happens very often). or permissions (did you create cmd.exe as Administrator before trying the batch file? and when you double-click, are you logged in as a regular user having fewer rights?) HTH Feb 19, 2020 at 17:08
  • You need full paths to the files/folders not xcopy.
    – Mark
    Feb 19, 2020 at 21:03

1 Answer 1

-1

I've just found out it was the goddamn antivirus causing the access denied issue. Sorry for bothering you.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .