You could use a PowerShell command. Stick this in your batch script and it'll create a shortcut to %~f0
in %userprofile%Start MenuProgramsStartup
:
powershell "$s=(New-Object -COM WScript.Shell).CreateShortcut('%userprofile%Start MenuProgramsStartup\%~n0.lnk');$s.TargetPath='%~f0';$s.Save()"
If you prefer not to use PowerShell, you could use mklink
to make a symbolic link. Syntax:
mklink saveShortcutAs targetOfShortcut
See mklink /?
in a console window for full syntax, and this web page for further information.
In your batch script, do:
mklink "%userprofile%Start MenuProgramsStartup\%~nx0" "%~f0"
The shortcut created isn't a traditional .lnk file, but it should work the same nevertheless. Be advised that this will only work if the .bat file is run from the same drive as your startup folder. Also, apparently admin rights are required to create symbolic links.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…