0

On Windows 10, I lost all my path variables and now I want to recover every shortcut (code, notepad, npm, java, etc).

'where' is not recognized ... , 'code' is not recognized ...

I don't want to look for each file individually through the explorer. Now I wanted to use "where" to gather paths quickly, but it turns out that it does not work because I've deleted its own path.

I noticed that I have this file C:\Windows\System32\where.exe installed, but changing PATH from System (or User ??) variable won't work. How to fix it in order to run it anywhere?

2
  • check variable %pathext% PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC order and check if you have some other file named where with different .eXtension using: dir /b /a:a /s \where.exe
    – Io-oI
    Commented May 23, 2021 at 1:22
  • Check: C:\Windows\System32\where.exe C:\Windows\SysWOW64\where.exe C:\Windows\WinSxS\amd64_microsoft-windows-where_31bf3856ad364e35_10.0.19041.1_none_13c446a37d881982\where.exe C:\Windows\WinSxS\wow64_microsoft-windows-where_31bf3856ad364e35_10.0.19041.1_none_1e18f0f5b1e8db7d\where.exe
    – Io-oI
    Commented May 23, 2021 at 1:26

2 Answers 2

2

I noticed that I have this file C:\Windows\System32\where.exe installed, but changing PATH from System (or User ??) variable won't work. How to fix it in order to run it anywhere?

The "basic" (default) Path (System) variable under Windows 10 for Windows\System32 is %SystemRoot%\system32. Adding this path to your Path (System) variables should enable where from the command line, I believe.

Note that this doesn't include any other standard Path (System) variables, including:

%SystemRoot%
%SystemRoot%\System32\Wbem
%systemroot%\System32\WindowsPowerShell\v1.0\

and likely C:\Program Files (x86)\Windows Live\Shared. This also doesn't include standard PATH (User) variables such as C:\Users\Your_User_Name\AppData\Local\Microsoft\WindowsApps.

I don't want to look for each file individually through the explorer. Now I wanted to use "where" to gather paths quickly, but it turns out that it does not work because I've deleted its own path.

As already indicated in harrymc's answer, where cannot do what you wish. It doesn't "discover" executable files or "remember" Path\PATH variables. If the relevant paths do not exist in your environment variables, where cannot "find" those paths. You are going to have to go through Explorer\executables manually unless you use a system restore, as already detailed.

1
  • Thank you for the explanation. I was using the wrong path C:\Windows\System32\where.exe instead of simply C:\Windows\System32. However it didn't find a thing. I ended up using the explorer anyways
    – testing_22
    Commented Apr 8, 2021 at 14:37
1

Where works by searching the PATH. If the path is incorrect, it will not find anything.

The easiest way to recover your PATH is, if you have System Restore enabled, to rollback Windows to a time before this change was done.

For more details see the tutorial How to Do a System Restore of Windows 10.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .