Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I just messed up my Windows 7 Enterprise 64-bit.

I tried to install CMake - and during installation i got an error saying something like it can't set the path variable, because it is too long (I can't reproduce the exact error message as the installer won't start now anymore).

So - what I did then was to open control panel -> sytem and security -> system -> advanced system settings -> environment variables

and i added the cmake bin folder manually to the end of the PATH system variable and saved.

But well - now nothing works anymore. If i try to open 'Advanced system settings' again, i get the error

C:\Windows\system32\system32\systempropertiesadvanced.exe
The filename or extension is too long.

if I try to open regedit

C:\Windows\regedit.exe
The filename or extension is too long.

I still can open a cmd prompt, but not elevated. If i try to start cmd as administrator, i'll get the same error.

I don't want to restart my computer as i think it will not be able to boot up in the current state. I don't know how to change my Path variable back to what it was before

//edit:

I see now a bit better what i did wrong.

beside extending the path variable, i also set a new system Envrionment variable called

OPENCV_ROOT

but unfortunately i had the System Path in the clipboard when copy pasting it. so, what i have now is something like this:

OPENCV_ROOT = .....;%OPENCV_ROOT%\bin;....

PATH = .....;%OPENCV_ROOT%\bin;....

this is obviously very bad. I try to delete the OPENCV_ROOT variable, but without being able to start any elevated application, it seems impossible

Help?

share|improve this question
    
Have you tried recreating the original registry key in a .reg text file and then overwriting your current key with it? support.microsoft.com/kb/310516#appliesto –  Tog Mar 9 '12 at 10:20
    
i didn't try yet, but doesn't a reg file just execute regedit? –  Mat Mar 9 '12 at 10:24
    
Regedit may be used to do the merge but it doesn't open the front end. I don't know if it will produce the same error or not but it can't hurt. –  Tog Mar 9 '12 at 10:34
    
just tried, produces the same error :( –  Mat Mar 9 '12 at 11:09
    
Just looking at free utilities but most of them depend on regedit to work. There is one called reg scanner that can delete the values in entries but I've never used it so I can't vouch for it. –  Tog Mar 9 '12 at 15:37

2 Answers 2

I'm not sure if Safe Mode does anything with the PATH var, but it might be worth a try. Failing that, you could try booting into BartPE or WinPE, and running regedit that way.

Once booted into *PE, launch regedit, click on HKLM, and go File → Load Hive.

#include <stdregistrywarning.h>

Navigate to \WindowsDIR\system32\config and select the file 'SYSTEM'. You might want to make a copy of this file, first. Just in case. Give the Hive a name to be loaded as. Eg: OfflineSYS. I say WindowsDIR, meaning where Windows is installed on your laptop's hard disk – not where Windows PE is running from.

Then navigate to HKLM\OFFLINESYS\CurrentControlSet\Control\Session Manager\Environment

Now find the REG_SZ value path (if that's the one that's too long), and edit it so it's shorter.

Navigate back to HKLM, and unload the hive. Exit regedit, reboot into Windows 7.

share|improve this answer

So you can open cmd, then there is a set command can be used to set variable, try to set PATH and OPENCV_ROOT to empty and inside the cmd execute C:\Windows\system32\system32\systempropertiesadvanced.exe.

share|improve this answer
    
good idea, but gives the same error when i try to launch systempropertiesadvanced.exe –  Mat Mar 9 '12 at 12:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.