-
Notifications
You must be signed in to change notification settings - Fork 104
/
mkshortcut.vbs
executable file
·67 lines (57 loc) · 2.09 KB
/
mkshortcut.vbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
rem cscript mkshortcut.vbs [/param:arg] /target:link
rem /target:%LOCALAPPDATA%\wsltty\bin\mintty.exe
rem /wdir:%USERPROFILE%
rem /icon:%LOCALAPPDATA%\wsltty\wsl.ico
rem deprecated: /icon:%LOCALAPPDATA%\lxss\bash.ico
rem deprecated: %
rem /arguments:--wsl -o Locale=C -o Charset=UTF-8 /bin/wslbridge -t /bin/bash
rem deprecated: ~
rem /arguments:--wsl -o Locale=C -o Charset=UTF-8 /bin/wslbridge -C~ -t /bin/bash
rem deprecated: -l
rem /arguments:--wsl -o Locale=C -o Charset=UTF-8 /bin/wslbridge -t /bin/bash -l
rem General - Name:
name = Wscript.Arguments.Named("name") & ".lnk"
set wshell = WScript.CreateObject("WScript.Shell")
wscript.echo "Creating " & name
set lnk = wshell.CreateShortcut(name)
rem Target:
rem lnk.TargetPath = Wscript.Arguments.Named("target")
rem lnk.Arguments = Wscript.Arguments.Named("arguments")
lnk.TargetPath = wshell.ExpandEnvironmentStrings("%target%")
minttyargs = wshell.ExpandEnvironmentStrings("%minttyargs%")
bridgeargs = wshell.ExpandEnvironmentStrings("%bridgeargs%")
lnk.Arguments = minttyargs & " " & bridgeargs
rem wscript.echo "minttyargs: " & minttyargs
rem wscript.echo lnk.Arguments
rem Start in:
rem wdir = Wscript.Arguments.Named("wdir")
wdir = wshell.ExpandEnvironmentStrings("%wdir%")
if IsEmpty(wdir) then
lnk.WorkingDirectory = "%USERPROFILE%"
else
lnk.WorkingDirectory = wdir
end if
rem Icon:
rem icon = Wscript.Arguments.Named("icon")
rem rem iconoffset = Wscript.Arguments.Named("iconoffset")
rem rem icon = icon & ", " & iconoffset
icon = wshell.ExpandEnvironmentStrings("%icon%")
rem wscript.echo "icon: " & icon
lnk.IconLocation = icon
rem rem lnk.IconLocation = "%LOCALAPPDATA%\lxss\bash.ico"
rem lnk.IconLocation = "%LOCALAPPDATA%\wsltty\wsl.ico"
rem Shorcut key:
rem lnk.HotKey = "ALT+CTRL+W"
rem Run:
rem 1: Normal 7: Minimized 3: Maximized
rem lnk.WindowStyle = 1
min = Wscript.Arguments.Named("min")
if min then
lnk.WindowStyle = 7
end if
rem Comment:
rem lnk.IconLocation = Wscript.Arguments.Named("desc")
rem lnk.Description = "WSLtty"
lnk.Save
wscript.echo "Created " & name
wscript.echo