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

后端 未结 15 2428
自闭症患者
自闭症患者 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:59

    After making the shortcut as you have, set the following in Properties:

    Target: %comspec% /k "data\run.bat"

    • Drop the /k if you don't want the prompt to stay open after you've run it.

    Start In: %cd%\data

    0 讨论(0)
  • 2020-11-30 21:00

    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.

    Source: http://support.microsoft.com/kb/283065

    0 讨论(0)
  • 2020-11-30 21:03

    The method that proposed by 'leoj' does not allow passing parameters with spaces. Us it:

        cmd.exe /v /c %CD:~0,2%"%CD:~2%\bat\bat\run.bat" "Par1-1 Par1-2" Par2
    

    Which will be similar double quote written as in path

        C:"\Program Files\anyProgram.exe" "Par1-1 Par1-2" Par2
    
    0 讨论(0)
提交回复
热议问题