Oddly, in Windows, even when you are logged on as an administrator, your batch files (*.bat, *.btm, *.cmd) don’t have administrative privileges to do things such as correct the time, or update the C:\Windows\system32\drivers\etc\hosts. file. There are three ways around this.
Unfortunately, according to the phases of the moon, Windows will not let you select the run-as-administrator option. I cannot see any pattern when it lets you and does not let you.
To detect whether your current script is running under administrative privilege type
Windows considers it necessary for whomever runs a bat file, not who composes it, to manually OK administrative privileges, even if they have not the first clue what they are. I can think of only one way around this.
You need hypothetical utility trigger.exe to run bat files as administrator without pestering the user for an OK. You schedule your bat file with the task manager to run some time in the distant future. You run a little utility you invoke with:
that reschedules mybat.bat 1 second into the future, lets the task manager launch it, then puts it back. Unfortunately, I know of no such little utility. Microsoft would probably be quite annoyed with me if I wrote one. It is more complicated than you would think. Trigger.exe itself must not require run as administrator. It must talk to a permanently running service that does the dirty work. It has to fiddle with Windows files without Windows panicking. From Windows point of view, it is malware.
If I were Microsoft, I would implement a legitimate simplified trigger.exe. There is no great danger in running a task now, but just in case, I would add a check box allow on demand to each task. Getting rid of those idiotic Do you want to allow this app to make changes to your PC? prompts would be a great selling point for a future OS (Operating System).
This page is posted
Optional Replicator mirror
Your face IP:[220.127.116.11]
You are visitor number|