Making a Windows shortcut start relative to where the folder is?
I have a game that uses this file structure:
GAME FOLDER ->data ->data->run.bat
I want to put a shortcut to
run.bat in GAME FOLDER, but if I move it, or someone else installs it it won't work, because the target is wrong. Is there a way to make the target and "start in" relative to GAME FOLDER?
Making a Windows shortcut start relative to where the folder is , Right click on your /bat/ folder and click Create Shortcut. On Windows 7 you will get bat - Shortcut in the current directory. On Windows XP you Right click on your /bat/ folder and click Create Shortcut. On Windows 7 you will get bat - Shortcut in the current directory. On Windows XP you will get Shortcut to bat. Right click on the shortcut you just created and click Properties. Change Target (under the Shortcut tab on Windows 7) to the following:
According to Microsoft, if you leave the
'Start In' box empty, the script will run in the current working directory. I've tried this in Windows 7 and it appears to work just fine.
Using relative paths for Windows shortcuts, You can use the usual context-menu "New/Create shortcut" of Windows for this relative paths inside itself and will have a working directory of whatever folder the Another option is have your shortcut start cmd.exe instead with whatever you Right click on your /bat/ folder and click Create Shortcut. On Windows 7 you will get bat - Shortcut in the current directory. On Windows XP you will get Shortcut to bat. Right click on the shortcut you just created and click Properties.
Try using Relative (a Windows command-line application).
Basically, a shortcut could have a relative link, but Windows gives no way to actually make one.
How to Create Portable Shortcut with Relative Path in Windows , Windows does not support relative paths in shortcuts. programs in a flash drive, you'll have to launch each program by going inside its respective folder. Under the “Shortcut” tab delete “C:\Windows” in “Start in” field to make it blank. Create a shortcut from a folder. Open the Windows File Explorer by pressing the Windows key and E at the same time. Browse to the folder that contains the program for which you'd like to create a shortcut. Right-click on the program and select Create Shortcut from the drop-down menu that appears.
If you can set a system variable (something like %MyGameFolder%), then you can use that in your paths and shortcuts, and Windows will fill in rest of the path for you (that is,
Here is a small primer. You can either set this value via a batch file, or you can probably set it programmatically if you share how you're planning to create your shortcut.
How to create a Windows shortcut, How do I create a shortcut to a file path? this posting will describe how to create program shortcuts on the root folder of a USB drive that preserve the relative path of the USB drive’s folder structure (such that these shortcuts will always work no matter what drive letter Windows assigns the drive). It will also aim to preserve the icon of the application in the new shortcut.
You can make a relative shortcut manually by changing the file path. First in the usual context-menu you create a new shortcut of Windows for your file and in the properties -> location of your file:
Shortcut - Create with Relative Path, How do I create a shortcut with a relative path for USB drives? To create a desktop shortcut to a file, first, locate the file somewhere in File Explorer. Hold down the Alt key on your keyboard and then drag and drop the file or folder to your desktop. The words “Create Link in Desktop” will appear. Release the mouse button to create the link. Holding down Alt is necessary.
How to create a shortcut with relative path, How to Create a Shortcut with a Relative Path relative to the directory of which the shortcut file itself resides only if the Start in field is empty, Instead, click Start to open the Start menu, right-click the “All Programs” option, and then choose “Open” to head to your personal user-specific start menu folder. You can also click “Open All Users” to open up the system-wide Start folder applied to all users. And now,
Relative, %windir%\system32\cmd.exe /c start . Set the "Start in" directory (i.e. cwd) to be a relative path: (Example for a shortcut on the Desktop. ) Go to the shortcut tab, delete all text in the “Start in” field so that it is blank. This will ensure that when the shortcut is run it will look at the current folder first. Now modify the “Target” path so that it reads “%windir%\explorer.exe” followed by the relative path to your program and/or document “folder\myprogram.exe”.
Create Relative Path Shortcut in Windows, Relative lets you create relative shortcuts in Windows. As the name implies, relative shortcuts can be moved along with their parent directory tree and still point to the same Starting with Windows Vista, there is a command line function: