i want to copy a file to system32 folder using a batch file. but when i try to do this it says "Access denied" i also can not copy anything to my C:\ drive also. i tried using xcopy and copy to do this. i don't know what is the parameter to get the administrator permission. so, can anyone help me?
program:
@echo off
xcopy abc.dll "C:\Windows\System32\" -y
pause
output:
D:abc.dll
Access denied
Press any key to continue . . .
Should be doable one of two ways.
The first is to make a shortcut to your batch file, right click -> properties and on the Shortcut tab of the properties, click the Advanced button to find a checkable "run as admin" option.
The second (NOT TESTED) is to add a bunch of stuff to the top of your batch file (Reference) - I don't want to include it in the answer because I have not tested it.
@echo off
copy /Y abc.dll "C:\Windows\System32\"
pause
right click the batch file and run as administrator and make sure the abc.dll is in the same folder as your batch file.
hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With