here's my problem, I'm doing an internship in a company and I was asked to find a way to make a shortcut in a folder that is in my Pc but I want it to work in any other computer.
To do so, I want to replace the "C:/users/username/desktop/folder"
for a "Variable".
Than in every computer or user that i want to use this shortcut, I just have to say that "variable" means "C:/users/username"
or "D:/"
or wherever i put the folder in.
CodePudding user response:
This should already be happening automatically when you create the shortcut. Meaning, the SpecialFolderDataBlock entry (and the known folder entry) will exist and its base location is a non-computer specific folder id a offset into the main id list for the user/computer specific part. EnvironmentVariableDataBlock also exists when applicable.
Because the .lnk format is documented, you could create a shortcut that only contains a EnvironmentVariableDataBlock for example if you really wanted to...
CodePudding user response:
Refer to How to create shortcut to Computer on the user's desktop
You can try this vbscript to create a shortcut to %userprofile%
on the Desktop :
Just open your notepad or your notepad and save it as CreateShortcut.vbs
With CreateObject("WScript.Shell")
With .CreateShortcut(.SpecialFolders("Desktop") & "\User Profile.lnk")
.TargetPath = "%userprofile%"
.Description = "Open User Profile Folder"
.Save
End With
End With