Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: %WINDIR% not working

05 Feb 2014   #1
rowanbradley

Windows 7 Pro
 
 
%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 System SpecsSystem Spec
.
05 Feb 2014   #2
MilesAhead

Windows 7 32 bit
 
 

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 System SpecsSystem Spec
06 Feb 2014   #3
rowanbradley

Windows 7 Pro
 
 

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 System SpecsSystem Spec
.

06 Feb 2014   #4
MilesAhead

Windows 7 32 bit
 
 

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 System SpecsSystem Spec
06 Feb 2014   #5
Kaktussoft

Microsoft Community Contributor Award Recipient

Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1
 
 

Indeed do #4 . Post screenshot of the output
My System SpecsSystem Spec
06 Feb 2014   #6
rowanbradley

Windows 7 Pro
 
 

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 System SpecsSystem Spec
04 Nov 2014   #7
BSmith67

Windows 7 Professional 64 bit
 
 

I have this exact same problem and it's causing issues with other programs I have installed. Did you ever find a solution?
My System SpecsSystem Spec
04 Nov 2014   #8
BSmith67

Windows 7 Professional 64 bit
 
 

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 System SpecsSystem Spec
04 Nov 2014   #9
Ztruker

Windows 10 Pro X64
 
 

Good find, thanks for sharing.
My System SpecsSystem Spec
Reply

 %WINDIR% not working




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
customize %windir% folder during install
Hello. How I can customize c:\windows folder to something other during installation? I tried to google it before ask, but found only customization of install folder (Program Files/ProgramData) and profiles location.
Installation & Setup
SFC can't repair mmdevapi.dll and %windir% folder perms are wrong
I'm trying to fix a Dell Inspiron 1545 running 32 bit Win7 Home Premium. Pentium T4300 cpu@2.1gHz. 3GB ram. Background: They brought me the laptop saying it was running slow and not able to get on the Internet. Ha! I found a multitude of problems and have worked my way through most of them. Many...
Performance & Maintenance
CMD WONT OPEN MISSING AND CANNOT FIND %windir%\system32\cmd.exe
Hi there and I appreciate ur time for looking at this, it has been a last resort, my cmd will not open, there is no icon, i dont seem to have the file %windir%\system32\cmd.exe and when i go to cmd properties it says this "the name %windir%\system32\cmd.exe specified in the target box is not valid....
Software
Windows cannot find %windir%
Hi! I'm distraught. I have a problem and I can't resolve it. ;( It's computer in a firm and I can't reinstall Windows. When I type in cmd: echo %path% -> the answer is: %path%. When I try check environmment variables (in Advanced System Settings) I have an error "Windows cannot find...
General Discussion
Internet not working, windows update, ping, DNS, etc. working fine
Hello, I've got a Dell laptop here that isn't functioning properly. I can't get this to work for the life of me! I am currently using this laptop with a different hard drive, it's the install on the SSD that doesn't work. I know that the quick fix would be to simply reload windows, but I don't...
Network & Sharing


Our Sites

Site Links

About Us

Find 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 05:35.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App