How do I get current logged in user name when running a batch file as administrator

خرید بک لینک

I have a batch file I can run to modify permissions to a folder in program files. It runs fine when the current user has local admin privileges, but for users who aren't I have to enter the domain administrator password for the changes to take place. When I double check the permissions setting on the folder, it shows the domain admin having full control over said folder.

How do I ensure that the current user logged in the windows gets full permission?

This is what I have as part of that batch file:

icacls "program files directory" /grant %userdomain%%useame%:F

Recent Questions...

ما را در سایت Recent Questions دنبال می‌کنید

برچسب: نویسنده: استخدام کار بازدید: 240 تاريخ: پنجشنبه 3 تير 1395 ساعت: 15:43

صفحه بندی