0

Robocopy is failing when it is activated by clicking on my "run_bckup.bat" file.

Although the batch file has Admin-privileges, the following line fails: Robocopy "%src%" "%trgt%" .. /B ..

But starting the DOS-Window (open as Administrator) & running the same file "run_bckup.bat" succeeds!!

My Question: Is there a setting that allows me to activate robocopy by clicking on my batch-file, and the flag "/B" is used?

Here are the Robo reports for the 2 cases above.

==== 1. ROBOCOPY REPORT ON "RUNNING BY CLICKING" on "run_bckup.bat" ==== (this method failed)

ERROR : You do not have the Backup and Restore Files user rights. ***** You need these to perform Backup copies (/B or /ZB).

Source : c:\Utils - bckup\ Dest : G:\Utils - bckup\ Files : . Options : . /NFL /S /E /DCOPY:DAT /COPY:DATS /PURGE /B /XO /XA:SHT /R:5 /W:1

--- END OF REPORT 1 --

==== 2. ROBOCOPY REPORT ON RUNNING by OPEN DOS-Window, and then run "run_bckup.bat" ==== (this method succeeded)

Source : c:\Utils - bckup\ Dest : G:\Utils - bckup\ Files : . Exc Files : NTUSER Exc Dirs : AppData Templates Administrator

Options : . /NFL /S /E /DCOPY:DAT /COPY:DATS /PURGE /B /XO /XA:SHT /R:5 /W:1

       Total    Copied   Skipped  Mismatch    FAILED    Extras
Dirs :         1         1         0         0         0         0

Files : 19 19 0 0 0 0 Bytes : 31.4 k 31.4 k 0 0 0 0 --- END OF REPORT 2-------------

Thanks, UL

1 Answer 1

0

The /B and /Z flags require admin rights. How you are launching them does not provide those rights, except when you are right clicking and launching as administrator.

If you want to just click and have that happen try a shortcut to your real script file with the "run as administrator" option set.

Failing that Powershell has some wonderful abilities to self escalate you might want to check out.

Or use a scheduled task.

1
  • @ Tim; Probably, practically speaking, the best i can expect. Many thanks. UL ( Shortcut failed..)
    – Uri L
    Jan 4, 2018 at 20:56

You must log in to answer this question.

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