xchar
asked on
How to set environmental variable %windir% (Win 7)
How can I set environmental (system?) variable %windir% to be C:\Windows, globally and permanently? (Windows 7 64b)
My PC is having multiple problems, which I suspect are all due to windir somehow getting unset. If I type set windir in a cmd-line window, it says:
Environment variable windir not defined.
If I go to Computer>Properties>Advanc ed system settings it says:
Windows cannot find %windir%\System32\systempr opertiesad vanced.exe .
I get a similar "cannot find" if I try to use System Restore.
If I try to install anything, or try to Run regedit, msconfig, taskmgr, etc:
The system could not find the environment option that was entered.
I can set windir=C:\Windows in a cmd-line window, but it is in effect only within that window, and is gone on reboot.
Thanks for any suggestions...bearing in mind that I cannot use regedit, System Restore, or systempropertiesadvanced.e xe.
--Charles
My PC is having multiple problems, which I suspect are all due to windir somehow getting unset. If I type set windir in a cmd-line window, it says:
Environment variable windir not defined.
If I go to Computer>Properties>Advanc
Windows cannot find %windir%\System32\systempr
I get a similar "cannot find" if I try to use System Restore.
If I try to install anything, or try to Run regedit, msconfig, taskmgr, etc:
The system could not find the environment option that was entered.
I can set windir=C:\Windows in a cmd-line window, but it is in effect only within that window, and is gone on reboot.
Thanks for any suggestions...bearing in mind that I cannot use regedit, System Restore, or systempropertiesadvanced.e
--Charles
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
@ashraf882--
If you mean Advanced system settings in Control Panel, that just gives me:
Windows cannot find %windir%\System32\systempr opertiesad vanced.exe .
If you mean Advanced system settings in Control Panel, that just gives me:
Windows cannot find %windir%\System32\systempr
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Go to C:\Windows\System32 and click systempropertiesadvanced.e xe.
ASKER
@Dustin Loftis--
Running C:\Windows\System32\sysdm. cpl gives this, twice:
C:\Windows\System32\System Properties ComputerNa me.exe.
The system could not find the environment option that was entered.
@ashraf882--
Clicking on C:\Windows\System32\system properties advanced.e xe gives:
C:\Windows\System32\System Properties Advanced.e xe.
The system could not find the environment option that was entered.
Running C:\Windows\System32\sysdm.
C:\Windows\System32\System
The system could not find the environment option that was entered.
@ashraf882--
Clicking on C:\Windows\System32\system
C:\Windows\System32\System
The system could not find the environment option that was entered.
You may need to set that variable in that CMD prompt. Then you should be able to run those commands, at least from within that prompt.
ASKER
@Dustin Loftis:
If by "that variable" you mean %windir%, no soap. I set windir to C:\Windows, and it shows up as C:\Windows via echo or set or cd, but running sysdm.cpl still gives the same result as above. :-(
Same for SystemPropertiesAdvanced.e xe.
If by "that variable" you mean %windir%, no soap. I set windir to C:\Windows, and it shows up as C:\Windows via echo or set or cd, but running sysdm.cpl still gives the same result as above. :-(
Same for SystemPropertiesAdvanced.e
Is your %systemroot% variable set properly?
Is your Path variable set?
Is your Path variable set?
ASKER
@Dustin Loftis:
SystemRoot=C:\Windows
Path=C:\Windows\system32;C :\Windows; C:\Windows \System32\ Wbem;C:\Pr ogram Files (x86)\ATI Technologies\ATI.ACE\Core- Static;C:\ Program Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\Progr am Files (x86)\Common Files\Roxio Shared\10.0\DLLShared\;C:\ ;C:\c;C:\U 0.D;C:\U1. D;C:\U2.D; C:\U3.D;c: \SE3;c:\se 4
(All those strange items at the end of the Path are ones I put there long ago, but I don't remember how and I don't know where they're stored.)
SystemRoot=C:\Windows
Path=C:\Windows\system32;C
(All those strange items at the end of the Path are ones I put there long ago, but I don't remember how and I don't know where they're stored.)
If you use Windows+R (Run), then type %windir% and enter, does it bring up your windows directory? If so, this is no the issue!
ASKER
@JonLambert--
Windows+R %windir% gives:
Windows cannot find '%windir%'. Make sure you typed the name correctly, then try again.
Windows+R %windir% gives:
Windows cannot find '%windir%'. Make sure you typed the name correctly, then try again.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
@JonLambert--
Nope, see 3rd paragraph of original question. I can't get to the Env Vbls button.
Nope, see 3rd paragraph of original question. I can't get to the Env Vbls button.
try running c:\Windows\Syswow64\System Properties Advanced.e xe
lol. He can't do that, either.
Try running %systemroot%, xchar.
Try running %systemroot%, xchar.
ASKER
No go with System64 or %systemroot%.
Unlike %windir%, %systemroot% does show up as C:\Windows.
So does that suggest that %windir% is not the (only) problem?
When I get the error message
"The system could not find the environment option that was entered."
maybe it's something unknown that's missing.
Unlike %windir%, %systemroot% does show up as C:\Windows.
So does that suggest that %windir% is not the (only) problem?
When I get the error message
"The system could not find the environment option that was entered."
maybe it's something unknown that's missing.
I saying to run the 32 bit verion in SYSWOW (i.e. not System32) .. he hasn't tried that as far as the thread goes.
Anyhow, how about setting windir in the registry in the following key: HKEY_LOCAL_MACHINE\SYSTEM\ CurrentCon trolSet\Co ntrol\Sess ion Manager\Environment
Anyhow, how about setting windir in the registry in the following key: HKEY_LOCAL_MACHINE\SYSTEM\
ASKER
@JonLambert--
I cd'd into C:\WIndows\SysWOW64 and then typed systempropertiesadvanced.e xe. Did you have something else in mind?
The only way I know to modify the Registry is with regedit--which doesn't work for me now. Is there another way?
I cd'd into C:\WIndows\SysWOW64 and then typed systempropertiesadvanced.e
The only way I know to modify the Registry is with regedit--which doesn't work for me now. Is there another way?
yep ... use REG.EXE .. the following should do the trick
Reg ADD HKLM\SYSTEM\CurrentControl Set\Contro l\Session Manager\Environment /v WINDIR /t REG_EXPAND_SZ /d C:\Windows
Reg ADD HKLM\SYSTEM\CurrentControl
ASKER
@JonLambert--
Thanks, that's just what I needed to know. Should prove useful in the future.
BUT...when I copied and pasted your Reg ADD line into a cmd line, it said:
ERROR: Invalid syntax. Type "REG ADD /?" for usage.
The example given by REG ADD /? seems to match the syntax of yours, so I'm perplexed.
Thanks, that's just what I needed to know. Should prove useful in the future.
BUT...when I copied and pasted your Reg ADD line into a cmd line, it said:
ERROR: Invalid syntax. Type "REG ADD /?" for usage.
The example given by REG ADD /? seems to match the syntax of yours, so I'm perplexed.
Sorry I didn't try it, put quotes around the reg path i.e. Reg ADD "HKLM\SYSTEM\CurrentContro lSet\Contr ol\Session Manager\Environment" /v WINDIR /t REG_EXPAND_SZ /d C:\Windows
ASKER
Jon--
THanks for keeping after this. With quotes added, I get:
ERROR: Axxwaa is denied..
THanks for keeping after this. With quotes added, I get:
ERROR: Axxwaa is denied..
ASKER
[typos corrected]
Jon--
THanks for keeping after this. With quotes added, I get:
ERROR: Access is denied..
Jon--
THanks for keeping after this. With quotes added, I get:
ERROR: Access is denied..
I'd run a repair on Windows.
Try running it from an elevated command prompt (i.e. Type CMD in the Windows search bar, right click, run as administrator .. not saying you don't know already .. just avoiding another post just in case !)
ASKER
@JonLambert--
I'm grateful to you for spelling out the steps--and I'm sure that others who are, like me, nonexperts will be too when they stumble onto this discussion. Saves me a LOT of googling for further info. I would never have guessed how to get an elevated command prompt. I'm learning a lot more than I expected to when I posed a question that I thought would be real simple to answer.
Nevertheless, clicking on CMD, then on "Run as administrator" gives me the same fail:
C:\Windows\System32\cmd.ex e.
The system could not find the environment option that was entered.
Heck, the system must know which option it can't find--why doesn't it just tell me which one?
I'm grateful to you for spelling out the steps--and I'm sure that others who are, like me, nonexperts will be too when they stumble onto this discussion. Saves me a LOT of googling for further info. I would never have guessed how to get an elevated command prompt. I'm learning a lot more than I expected to when I posed a question that I thought would be real simple to answer.
Nevertheless, clicking on CMD, then on "Run as administrator" gives me the same fail:
C:\Windows\System32\cmd.ex
The system could not find the environment option that was entered.
Heck, the system must know which option it can't find--why doesn't it just tell me which one?
ASKER
@Dustin_Loftis--
You said: "I'd run a repair on Windows." Did you mean Startup Repair, which I got to via f8 during bootup?
It found nothing to fix. (While I was on the System Recovery page, I also tried Windows
Memory Diagnosis--nothing found. And I tried System Restore several times, using
recent and older dates--in all cases, it "Did not complete successfully. Files & settings
not changed.")
Or did you mean to use more daunting procedures, such as described here?:
http://www.sevenforums.com/tutorials/3413-repair-install.html
You said: "I'd run a repair on Windows." Did you mean Startup Repair, which I got to via f8 during bootup?
It found nothing to fix. (While I was on the System Recovery page, I also tried Windows
Memory Diagnosis--nothing found. And I tried System Restore several times, using
recent and older dates--in all cases, it "Did not complete successfully. Files & settings
not changed.")
Or did you mean to use more daunting procedures, such as described here?:
http://www.sevenforums.com/tutorials/3413-repair-install.html
I've done a bit of googling on your issue and it looks like a lot of people have had this problem, and it suspected that malware has caused the issue. The only resolution anyone has is to do a complete rebuild of the computer. Sorry it's not good news!
ASKER
@JonLambert--
Well, that's depressing. :-( But thanks for the summary. What search terms did you use? Can you give me an URL or 2 that discuss the problem?
Does "a complete rebuild of the computer" mean reformatting the hard disk and then reinstalling Windows 7? Or is there more to it? Or less?
I'll wait a day or so to see if anyone shows up here with a less drastic suggestion. Then I'll distribute points to everyone who has tried to help. Even though my problem was not solved simply, I've learned a lot. Thanks!
Well, that's depressing. :-( But thanks for the summary. What search terms did you use? Can you give me an URL or 2 that discuss the problem?
Does "a complete rebuild of the computer" mean reformatting the hard disk and then reinstalling Windows 7? Or is there more to it? Or less?
I'll wait a day or so to see if anyone shows up here with a less drastic suggestion. Then I'll distribute points to everyone who has tried to help. Even though my problem was not solved simply, I've learned a lot. Thanks!
Do a google search on "The system could not find the environment option that was entered", you will find many people in your situation. ... None I coudl find with a resolution.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Glad to hear you didn't need to go down the rebuild path!
I'm also having this issue , exactly as @xchar, Unfortunately , I can't boot into safemode, My PC gets stuck at CALSSPNP.SYS Please help
ASKER
@jeremiah Ajiboye--
As I said back in 2010, I don't really know how I cured my pc. You say you can't boot into safemode. Can you boot into Windows normally? If yes, I'd suggest trying the msconfig route that I used.
First run msfconfig, by typing it into either the Run box or at a Cmd prompt. Then:
"I typed msconfig . A tabbed menu popped up and I clicked the Tools tab. I found System Properties in the long list and Launched it. Then: Advanced system settings > Advanced > Environmental Variables (at the bottom) > System variables > New > windir C:\Windows. Ditto for User variables."
[Note: There was a typo in my posted comments--should be C:\Windows, not C; .]
--Charles
As I said back in 2010, I don't really know how I cured my pc. You say you can't boot into safemode. Can you boot into Windows normally? If yes, I'd suggest trying the msconfig route that I used.
First run msfconfig, by typing it into either the Run box or at a Cmd prompt. Then:
"I typed msconfig . A tabbed menu popped up and I clicked the Tools tab. I found System Properties in the long list and Launched it. Then: Advanced system settings > Advanced > Environmental Variables (at the bottom) > System variables > New > windir C:\Windows. Ditto for User variables."
[Note: There was a typo in my posted comments--should be C:\Windows, not C; .]
--Charles
windows7InDepth2.jpg