Take the 2-minute tour ×

Is there any serious consequence if I accidentally delete environmental variable in Windows 7? I know some program might not be able to run, but will that cause the system to crash at startup?

share|improve this question
Why take the chance? My guess is a lot of things won't work right. If you look in the registry a lot of programs are called using pieces of system variables, e.g. %systemroot%. –  John T Jan 8 '11 at 10:24
@John T: systemroot is not a real environmental variable. –  harrymc Jan 8 '11 at 12:12
@harrymc: It is a real environment variable. It doesn't matter if it's on "the list" or not - it is set automatically by smss.exe, the Session Manager, and is inherited by all other processes. (Open ProcExp, double-click on smss - or any process for that matter - and open Environment.) –  grawity Jan 8 '11 at 12:16
@grawity: I tested it and you are right: "set systemroot=xxx" does change it. Sorry, @John T. –  harrymc Jan 8 '11 at 15:13
add comment

3 Answers

up vote 2 down vote accepted

Critical environment variables are somewhat protected and cannot be permanently changed or deleted through regular methods. They can be changed via the command prompt using SET VariableName= but that change is isolated to that Command prompt session only.

They can be changed via the HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment registry key. I should not have to tell you that they are protected for a reason.

If you seriously think that they've been tampered with then plug your system hard drive into another computer or use a LiveCD (so it's not being booted from). Check the log files in Windows\System32\Config. A System restore may be in order if that is the problem.

share|improve this answer
add comment

But will that cause the system to crash at startup?

Not the operating system, no. Poorly written applications maybe. Windows should be using functions like this to get paths to special locations, not environment variables.

The critical ones are created at boot-time, anyway.

share|improve this answer
add comment

This will not cause Windows itself to crash, but some startup programs might crash or go crazy.

The best is to restore the system back to before the delete was done.

share|improve this answer
add comment

Your Answer


