Create recursive shortcuts in Windows

    We all know what a shortcut is. And what happens if you make a shortcut link to yourself?
    Creating a shortcut to a shortcut leads to its copying. And what happens if you forcefully create such a shortcut byte?

    But, I’m not telling you about this, but about how you can create a folder from which all programs crash with errors.
    Yes, only by sight: you won’t even have time to click on the folder.

    It will be impossible to enter such a folder with ordinary file managers.

    But this was not without a shortcut, and I will tell you how to do it and what you can use it for.

    Background


    When I was at university, it was full of time, and I studied Windows in every possible way.
    I rummaged through all the system folders, the entire registry, looked for glitches and found them.
    It was a long time ago, but I remembered about one interesting “glitch”, which I will discuss in this post.

    Once I noticed that if you drag any folder to Start => All Programs, then a folder is created there, not a shortcut.
    You can drag it to the desktop and it will look like a folder, but behave like a shortcut.
    This puzzled me, and I began to dig deeper.
    I discovered that such folders themselves are created in the "Network Neighborhood" and behave the same.

    I realized that it is impossible to see the "real" insides of the folder using the explorer.
    By running the console, I was able to get to the files inside.

    There were two files: desktop.ini and target.lnk

    If you rename or delete one of the files, the explorer will begin to show real insides.

    In the file desktop.ini I found the following text:
    [.ShellClassInfo]
    CLSID2={0AFACED1-E828-11D1-9187-B532F1E9575D}
    Flags=2
    

    And the shortcut referred to the folder that I created at the beginning.

    I was interested in this because I realized that there might still be files inside such a folder, and no one will see them.
    At the university, all computers were with limited access, and any student could delete my folder with personal files, but I did not have a computer then.
    And there were no flash drives then. Floppy disks are not reliable, so storing your files on university computers was not safe.

    And I realized that no one will see my files in such a folder, and I can access my folder at the direct address inside the shortcut folder.
    But this did not give protection to personal files: the folder could still be deleted along with my data.

    I fumbled on with an interesting folder, tried to replace the target.lnk file with my own, and see what happens.
    You can change the shortcut icon, and the folder icon in this case also changes.

    And then I created a shortcut to the same desktop.ini file, renamed it to target.lnk

    I did not immediately believe such an effect, and did not understand what was going on: after renaming, the explorer immediately issued an error and restarted.
    I climbed back into the created folder, and as soon as I saw it, the explorer flew out again.

    I began to research the strange effect and realized that the explorer was trying to get the properties of the shortcut folder, and they were redirected to the folder itself again. The result is a loop.
    I tried to enter the folder with different programs: even Total Commander crashed when I tried to enter it, even if it was delayed. It was possible to enter it only using the console.

    And I realized that this folder will store my data well, and none of the students can even click on it to delete it.

    Sequencing


    Next, I will tell you how to make such a folder, untie the binding to the path, and how to create such a “protected” folder on a USB flash drive that would “work”, as expected, on all computers.

    In order for the folder- killer shortcut to work, as expected, there should be the following:

    • the folder must have a System attribute
    • the folder should have a desktop.ini file with the correct content
    • in the folder there should be a target.lnk shortcut that refers to the desktop.ini file in the same folder

    When creating such a folder using Explorer, there are pitfalls

    • the System attribute for the folder must be set before creating internal files
    • you must first write the data to desktop.ini and only then put it in a folder
    • Before putting the target.lnk shortcut in the folder, you need to re-enter it

    Create a “protected” folder that works on all Windows file systems

    1. create an empty folder, preferably not on the desktop
    2. create a subfolder, put your data there and remember the path
    3. set the system attribute to the original folder
    4. create a text file desktop.txt and write data to it, as described above
    5. rename desktop.txt to desktop.ini
    6. create a shortcut on desktop.ini called target.lnk and the explorer will restart

    Now you need to go to your subfolder only at the address and, preferably, not in the explorer (due to the preservation of the previous paths).
    For example, in the console write explorer.exe <folder address>, and the history will not be saved so that no one can calculate the path.

    To automate the creation of such a folder, I wrote a script:
    Dim arg, WSHShell, fsobj, file, link
    Set arg = WScript.Arguments
    Set WSHShell = WScript.CreateObject("WScript.Shell")
    Set fsobj = WScript.CreateObject("Scripting.FileSystemObject")
    If arg.Length = 0 Then
    WSHShell.Popup "Перетащите папку на этот файл"
    End If
    If arg.Length > 0 Then
    'Задаем атрибут папки Системный
    fsobj.GetFolder(arg(0)).Attributes = 1
    'Пишем файл desktop.ini
    Set file = fsobj.OpenTextFile(arg(0) + "\desktop.ini", 2, True)
    file.Write "[.ShellClassInfo]" + vbCrLf
    file.Write "CLSID2={0AFACED1-E828-11D1-9187-B532F1E9575D}" + vbCrLf
    file.Write "Flags=2" + vbCrLf
    file.Close
    'Создаем ярлык target.lnk который ссылается на desktop.ini
    Set link = WSHShell.CreateShortcut(arg(0) + "\target.lnk")
    link.TargetPath = arg(0) + "\desktop.ini"
    link.Save
    WSHShell.Popup "Папка-убийца создана"
    End If
    

    It must be saved to a file called mkFolderKiller.vbs, and drag the folder onto it.

    Binding a path to a protected folder

    The created folder will strictly depend on its original address.
    If you rename it, then you can go into it.
    And I found a solution, although not ideal, but which allows you to change the address of the folder.

    We need to create an empty folder in a place where the user cannot get into.
    For example, deep in the system files (if you have access).
    We set the System attribute to it, and write the desktop.ini file there, but we are in no hurry to make a shortcut.

    Now, on another disk, where the data folder should be, do the same, for example, on D: \.
    Take the shortcut of the desktop.ini file from the C: \ drive and put it in the folder on the D: \ drive. Only after that we make a shortcut in the folder of the C: \ drive.

    As a result, the folder on the D: \ drive will execute its “function”, which we need, even if we change its address.

    Protecting a folder on a USB flash drive

    There is nothing special to say.
    I think many have guessed that you can create a folder in which there will be "protected" folders for all letters of the alphabet.
    And access to your protected folder can only be obtained by you knowing the full address.

    conclusions


    Everyone can create this folder for fun, for tests or for primitive protection.

    Is this a reliable protection?

    Of course not. There are many other ways more reliable than this.
    It is not difficult for an experienced user to figure out and get into such a “protected” folder.
    But this will puzzle for a while. And ordinary users will not be able to get there at all.

    On which versions of Windows will this folder work?

    Personally, I conducted all the experiments at the university, on Windows XP and 2000.
    And, over time, on Windows Vista, 7 and Windows 8.
    Regardless of the bit depth of the system, it works on all versions.

    Does this folder harm the computer?

    Of course not. All she does is loop the process that wants to access her, and this will cause him to restart.

    How to delete such a killer folder?

    You can go to the folder using the console and rename one of the two files or remove the System flag from the folder.
    Or rename the root folder to neutralize the loop.

    If you can not wait to try

    You can download the file from the ShortcutKiller.rar link ,
    unzip it into the C: \ TEMP \ 1234 folder, and re-enter it.
    There is folder 1 in the archive with two desktop.ini and target.lnk files attached only to this path.

    I hope the article was interesting to you, and that I managed to explain everything well.
    I found many more different glitches that are not written about anywhere, maybe I'll tell you another time :)

    Also popular now: