简体   繁体   中英

cmd / DOS / Batch command rename files as a Administrator

i want to rename a file named somefile.exe to somefile2.exe in CMD or batch file(.bat)

when i do this in explorer i have to rename the file as a Admin. like this:

在此处输入图片说明

(sorry for swedish)

ok, i need to click "Continue" ("Fortsätt") and i can rename the file! very simple!

but in CMD.exe or batch file it says "Access Denied" im using:

rename somefile.exe somefile2.exe

how can i do this in CMD or batch file? rename a file as a Admin?

Right-click your command prompt shortcut and select Run as administrator .

Then, run your batch file.

Try the RunAs command. You can run command as another user. see here - runas

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM