Making a Windows shortcut start relative to where the folder is?

后端 未结 15 2437
自闭症患者
自闭症患者 2020-11-30 20:36

I have a game that uses this file structure:

GAME FOLDER
->data
->data->run.bat

I want to put a shortcut to run.bat i

15条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-30 20:37

    Easiest Solution:> Enviroment Variables handy little critters.

    If the other person is to install/uncompress whatever to wherever on their respective system drive (usualy c:).

    For demonstration purposes call our app "test.exe" (could be any executable/file doesn't have to be exe) and it is to be installed/uncompressed to folder MYCOMPANY\MYAPP\

    Then just make a shortcut that uses %SystemDrive%\MYCOMPANY\MYAPP\test.exe as target and %SystemDrive%\MYCOMPANY\MYAPP\ as start in.

    So now you would like to deploy it. Using an app like "WinRAR".

    Easy way is using self-extraction zip file, neatly packaged as an ".exe" I would use one for my shortcut and another for the app. There is ways to make one self-extraction zip file that extracts different files to different directories, but i haven't played with it yet.

    Another way is to make a selfextract for the shorcut, embed it inside the selfextract for the app and then apply a run once script,being that you know where the file is going to be. etc.

    If you want to enable the installer to use custom installation/uncompress directories, then rather have a look at NSIS a scriptable install system.

    Play around it's fun, hope my info helped.

提交回复
热议问题