1

I have a folder on my PC. Within that folder, there is a shortcut (.lnk) and an executable file (.exe). When I click on the shortcut, the .exe file should run.

I have managed to achieve this no problem, however when I send this file to my laptop and try to use the shortcut I get an error because the file paths are different on both computers (the .lnk filepath only works on my PC because the username is different).

How can I make it so that the shortcut can run this exe file no matter what file paths the device I am using is? I have tried things such as ..\foldername\appname.exe however windows seems to want me to use a file path beginning with 'C:'.

here is me trying to make a new shortcut

1 Answer 1

1

This is Windows trying to be 'helpful'… & failing.

The path to your Downloads folder isn't C:\Downloads, it's actually C:\Users\[yourname]\Downloads which is 'helpfully' hidden from you.
If you actually go in via Local Disk C: which should be further down your sidebar, currently out of sight, you can dig your way down to see how it really works.

This, however, will be different for each user so Windows does, this time actually helpfully, give you certain shortcuts you can use to target "the current user" without having to know their name. There isn't one directly to downloads, but there is one to 'your profile' - %USERPROFILE%
So, if you set your path to %USERPROFILE%\Downloads\[path]\[to]\[folder] then it should be able to find the right location for any user.

There's a list of all these useful shortcuts at Pureinfotech: Complete list of environment variables on Windows 10

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .