Cannot run as administrator windows

  • 303
  • 0
  • 2018-07-11

Cannot run as administrator windows

I'm setting some Environment Variavle key value in Regedit,

and suddenly many icon in the task bar become empty,

many program cannot be executed such as regedit/gpedit.msc/environment variable in contro panel,

and though I can use Win+R and type cmd to execute cmd,

or goto "C:\Windows\System32\cmd.exe" to exxecute,

but I can't exeute as administrtor, if I right click and choose run as admin, it just stuck and no reaction,

other program frequently prompt message  "some environment variable not found"


My main purpose now is to add some Path to environment variable, but now I can't open it from control panel, also the cmd cannot be run as admin that is I can't execute setx command,

so all the way is blocked @@


and the most terrible point is, I know it's very likely caused by my action on regedit registry value,

So maybe I can simply solve it by restore regedit or add some registry,

but now even regedit cannot be open @@


In the process I do lots of google, even I once think to reinstall windows but that'll lose all my installed program@@,

finally luckily find the solution in this post,

first key is, I can open cmd but can't run as administrator,

by Start your PC in safe mode in Windows 10 then can default exexute anything as adminstrator 

after use safe mode login windows, then execute cmd, it'll directly run as administrator,

and type set and press enter, I find the variable windir doesn't exist in environment variable collection.


You should add windir to environment variable


One way is using cmd ,  use setx windir C:\Windows /m

Usage of setx


Or you can try if you can open regedit in safe mode, if you can,

goto HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment

and right click to add a new variable, the type is string,

and name and value are  windir   and  C:\Windows

after adding the variable and close the regedit,  ALL PROBLEMS ARE SOLVED!!!!!!




For problem 'Cannot run as administrator windows', another possibility is setting UAC, also try to google `enable UAC`