• Microsoft Crazy Facts

    Sunday, August 02, 2009

    You may be surprised if you know that you can not create a folder with a name "con".If you don't believe then try it out creating a folder and renameing it to con.

    Explanation
    In windows the folder name and the special system variables share the same interface, so when you create a folder with a system variable name it will consider that folder already exist!! these special system variables are available irrespective of path

    You cannot create a folder with these names also:

    CON, NUL, COM1, COM2, COM3, LPT1, LPT2, LPT3,COM1 to COM9 and LPT1 to

    LPT9....

    CON means console, COM1 means serial port 1, LPT1 means parallel port 1.

    About this post
    I wanted to delete all the values under key which has a subkey with others values. A program when i run adds some values under the main key. I found if I delete that values the program runs again from the beginnig that i mean it removes the time limitation of the program. When i need it, I have to go Run, Type regedit on the Run box and have to delete that values. Then I search on the net and try to find the method to delete the values. But the values changes when I run the program and the reg file is somehow find helpless. Then I searched for deleting the key so that it does not matter if values changed. But still there is problem that when delete the main key using reg file, it also delete all subkeys under the main key. So I found still there is problem. Now here is how i fixed the problem using the same method.

     
    Look at the picture above, How to delete the values under example key using reg file but keeping all values under sub keys
    Yes you surely say that it is very easy using reg file with entries
    Windows Registry Editor Version 5.00

    [HKEY_CURRENT_USER\Software\example]
    "123"=-
    But what happen if the value "123" keep changing(as i said above) then job will be more tedious. yes?
    Now here is  how i solved the problem.
    First export the registry from the key "example". 
    Edit the exported file with notepad. It will be like this
    Windows Registry Editor Version 5.00

    [HKEY_CURRENT_USER\Software\example]
    "123"="123456"

    [HKEY_CURRENT_USER\Software\example\ex1]
    "ex"="123"

    [HKEY_CURRENT_USER\Software\example\ex1\ex2]
    "ex"="1234569"

    Now edit the entries like this
    Windows Registry Editor Version 5.00

    [-HKEY_CURRENT_USER\Software\example]

    [HKEY_CURRENT_USER\Software\example\ex1]
    "ex"="123"

    [HKEY_CURRENT_USER\Software\example\ex1\ex2]
    "ex"="1234569"
    Now run the reg file, it will delete all the values under "example" but keeping all the subkeys and values.

    If there is any good method than this please inform me by commenting but it must be simple.