(Commands for running with admin privileges) (Commands for running with normal privileges) Here's a brief snippet of example code: IF EXIST %SYSTEMROOT%\SYSTEM32\WDI\LOGFILES GOTO GOTADMIN This can be used in a batch file to check privilege level, and branch to whichever commands you desire based on that result. So, running "IF EXIST" on the WDI\LogFiles folder will return true if run as admin, and false if not run as admin. The WDI folder always has a LogFiles folder inside it. The WDI folder exists on every install of Windows from at least 7 onward, and it requires admin privileges to access. Basically, I simply use the "IF EXIST" command to check for the Windows\System32\WDI\LogFiles folder. Here's a simple method I've used on Windows 7 through Windows 10.
0 Comments
Leave a Reply. |