Is it possible to make a shortcut to a relative path in Windows that runs as admin?

后端 未结 3 1830
借酒劲吻你
借酒劲吻你 2021-01-01 10:25

To create a shortcut with a relative path, set the target to the following.

%windir%\\system32\\cmd.exe /c start your_relpath\\app.exe [your_args]

3条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-01 10:57

    I didn't find an easy way but that's fine. I was concerned that shortcuts with absolute paths would break between computers. I didn't realize that Windows corrected them automatically. This seems sufficient, though relative paths would have been more elegant.

    Although shortcuts, when created, point to specific files or folders, they may break if the target is moved to another location. Microsoft Windows has standard algorithms for fixing up shortcuts when they are moved. Windows 9x-based versions of Windows use a simple search algorithm to fix broken shortcuts.[1] On Windows NT-based operating systems and the NTFS file system, the target object's unique identifier is stored in the shortcut file and Windows can use the Distributed Link Tracking service for tracking the targets of shortcuts, so that the shortcut may be silently updated if the target moves to another hard drive.[4]

    http://en.wikipedia.org/wiki/File_shortcut#Microsoft_Windows

提交回复
热议问题