%WINDIR% not working


  1. Posts : 49
    Windows 7 Pro
       #1

    %WINDIR% not working


    For the last two days something has got corrupted in my system (Windows 7 Pro 64 bit).
    All of the shortcuts to Notepad, Paint, Explorer etc. in my Quick Start bar have lost their icons. When I click these icons I get the message:
    [Window Title]
    Windows
    [Main Instruction]
    Can't open this item
    [Content]
    It might have been moved, renamed, or deleted. Do you want to remove this item?
    [Yes] [No]
    I can still run these components by typing their name in the Search box in the Start menu, or by going to find them in the C:\Windows\System32 directory and double clicking them.
    These shortcuts are set to %WINDIR%\System32\notepad.exe. The problem seems to be with the value of %WINDIR%. If I change the shortcut to C:\WINDOWS\SYSTEM32\notepad.exe then it works fine.
    If I run SystemPropertiesAdvanced.exe, I can see the value of WINDIR is set to C:\Windows.
    If in a command window I type "ping 192.168.0.7" (without the quotes), it says "'ping' is not recognized as an internal or external command, operable program or batch file." I imagine this is due to the same basic cause.
    What is going on here? How can I diagnose and correct this?
    I have tried doing a system restore back to a time when my PC was working properly. It made no difference to this problem.

    Thanks - Rowan
      My Computer


  2. Posts : 5,092
    Windows 7 32 bit
       #2

    Do you have a Restore Point prior to the error? It looks like something has caused you to lose one or more environment variables. A restore point would be the simplest fix. If you don't have one then they will need to be set by hand.

    Edit: for backing up the Registry ERUNT is handy.
      My Computer


  3. Posts : 49
    Windows 7 Pro
    Thread Starter
       #3

    Thanks for your suggestions.

    I have already restored to a restore point before which I'm pretty sure the system was working correctly. It didn't fix the problem.

    Also, loss of environment variables does not seem to explain the symptoms. If I run c:\windows\system32\SystemPropertiesAdvanced.exe (which I have to do explicitly, since the shortcuts to it use %WINDIR%), it tells me that WINDIR is set to C:\Windows, which is surely correct. Also PATH and other likely environment variables seem to be set to sensible things. But if in a CMD window I say set windir, it says "Environment variable windir not defined". If I say echo %WINDIR%, it says %WINDIR%.

    So it's not apparently that the environment variable has lost its value (otherwise why is SystemPropertiesAdvanced showing it to me correctly? It's like it's lost its ability t0 retrieve the value (except for SystemPropertiesAdvanced).

    Thanks - Rowan
      My Computer


  4. Posts : 5,092
    Windows 7 32 bit
       #4

    Try this. Open a command prompt and type set and hit <Enter>

    Open an Elevated command prompt and do the same thing. From what you say, variables shown in the Admin command window should be missing in the normal user command window.
      My Computer


  5. Posts : 10,796
    Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1
       #5

    Indeed do #4 . Post screenshot of the output
      My Computer


  6. Posts : 49
    Windows 7 Pro
    Thread Starter
       #6

    I have discovered that, as someone suggested in a related thread, if I quit Explorer using Task Manager and then run Explorer again, all the problems temporarily disappear and things work properly. The other thread said that this was only a temporary solution, so I'm expecting the problems to reappear shortly. But this must provide a pointer to where the root problem is, mustn't it?

    Rowan
      My Computer


  7. Posts : 2
    Windows 7 Professional 64 bit
       #7

    I have this exact same problem and it's causing issues with other programs I have installed. Did you ever find a solution?
      My Computer


  8. Posts : 2
    Windows 7 Professional 64 bit
       #8

    In case anyone comes across this thread I found a solution. Please read here All Geek, All the Time: Path Over 2048 Chars Kills Windir Environment Variable
      My Computer


  9. Posts : 6,285
    Windows 10 Pro X64
       #9

    Good find, thanks for sharing.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 17:58.
Find Us