Basic windows commands (ping, ipconfig) need admin rights - looking for an option
Solution 1
Srart normal cmd prompt and look at output of the following commands
set path
dir %windir%\system32\ping.exe
dir %windir%\syswow64\ping.exe
dir %windir%\sysnative\ping.exe
Thought, they will show you a problem. May be ping is not found by %path% or somehow...
Solution 2
In an effort to narrow down the issue try the following:
- open command prompt
- make sure you are on the
C:\
directory - type this:
windows\system32\ipconfig /all
That will point to the default location for the command... You can also follow the path out to see if the ipconfig.exe is there in the first place. If that doesn't work or the file is not there, it could be corrupt or you could possibly have a virus designed to disable these commands.
CodeSalad
Updated on June 09, 2022Comments
-
CodeSalad almost 2 years
On my main pc (Win 7 64bit) basic windows commands like ping and ipconfig suddenly need admin rights.
If I start a normal command-line window, these commands are not found anymore ("X is not recognized as an internal or external command, operable program or batch file.")
If I start the command-line window with "Run as Administrator" everything works as expected.
On my second PC (Win 7 32 bit) I do not need admin rights. And I strongly believe that I did not need admin rights on my main pc a couple of weeks ago. Something must have changed, thus I think there must be some (registry) switch or something.
any ideas? thanks a lot
[edit]
I am still the admin user - just starting cmd normally, not with "run as admin"
[edit2]
It indeed was the PATH, variable. Problem was, that Path was saved as the wrong type of string in the registry
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\Path
has to be a REG_EXPAND_SZ as explained in this thread. Path being of the wrong type of string made it unable to expand %SystemRoot%. Make sure that both your system PATH as well as your user PATH environment variables are of type REG_EXPAND_SZ.
-
CodeSalad over 11 yearsI already checked the PATH variable. all necessary paths are in there. Also, if PATH was wrong, they wouldn't be found in admin-cmd either. thanks though!
-
Maximus over 11 yearsI mean, PATH may be different under Admin and in normal console.
-
Harry Johnston over 11 yearsGiven the error message you're getting, there is almost certainly a problem with the path. One other thing you could try as a diagnostic measure is explicitly specifying the path to the executable on the command line. The problem might be bad permission settings on the executable or the system directory.
-
CodeSalad over 11 yearsI just updated my question. It was indeed the PATH. It was saved as the wrong type of string in the registry. thanks
-
Christian Aichinger about 10 yearsThe author of the question already fixed his problem. Further, you can not rely on Windows always being installed in
C:\Windows
. Using%windir%
is a more robust solution.