이제보니 프롬프트에서 VBS 파일 이름만 입력해도 그냥 실행이 되는구나...
wscript나 cscript는 옵션 줄 때만 필요한 거군.
set WshShell = WScript.CreateObject("WScript.Shell")
set fso = CreateObject("Scripting.FileSystemObject")
strDesktop = WshShell.SpecialFolders("Desktop")
strPrograms = WshShell.SpecialFolders("Programs")
strProgramGroup = strPrograms & "\Group"
strCurrFolder = fso.GetParentFolderName(WScript.ScriptFullName)
set oShellLinkDesktop = WshShell.CreateShortcut(strDesktop & "\MyApplication.lnk")
oShellLinkDesktop.TargetPath = strCurrFolder & "\MyApplication.exe"
oShellLinkDesktop.WindowStyle = 1
oShellLinkDesktop.Hotkey = ""
oShellLinkDesktop.IconLocation = strCurrFolder & "\MyApplication.exe, 0"
oShellLinkDesktop.Description = "MyApplication"
oShellLinkDesktop.WorkingDirectory = strCurrFolder
oShellLinkDesktop.Save
If (fso.FolderExists(strProgramGroup)=False) Then
fso.CreateFolder(strProgramGroup)
End If
set oShellLinkPrograms = WshShell.CreateShortcut(strProgramGroup & "\MyApplication.lnk")
oShellLinkPrograms.TargetPath = strCurrFolder & "\MyApplication.exe"
oShellLinkPrograms.WindowStyle = 1
oShellLinkPrograms.Hotkey = ""
oShellLinkPrograms.IconLocation = strCurrFolder & "\MyApplication.exe, 0"
oShellLinkPrograms.Description = "MyApplication"
oShellLinkPrograms.WorkingDirectory = strCurrFolder
oShellLinkPrograms.Save
set fso = CreateObject("Scripting.FileSystemObject")
strDesktop = WshShell.SpecialFolders("Desktop")
strPrograms = WshShell.SpecialFolders("Programs")
strProgramGroup = strPrograms & "\Group"
strCurrFolder = fso.GetParentFolderName(WScript.ScriptFullName)
set oShellLinkDesktop = WshShell.CreateShortcut(strDesktop & "\MyApplication.lnk")
oShellLinkDesktop.TargetPath = strCurrFolder & "\MyApplication.exe"
oShellLinkDesktop.WindowStyle = 1
oShellLinkDesktop.Hotkey = ""
oShellLinkDesktop.IconLocation = strCurrFolder & "\MyApplication.exe, 0"
oShellLinkDesktop.Description = "MyApplication"
oShellLinkDesktop.WorkingDirectory = strCurrFolder
oShellLinkDesktop.Save
If (fso.FolderExists(strProgramGroup)=False) Then
fso.CreateFolder(strProgramGroup)
End If
set oShellLinkPrograms = WshShell.CreateShortcut(strProgramGroup & "\MyApplication.lnk")
oShellLinkPrograms.TargetPath = strCurrFolder & "\MyApplication.exe"
oShellLinkPrograms.WindowStyle = 1
oShellLinkPrograms.Hotkey = ""
oShellLinkPrograms.IconLocation = strCurrFolder & "\MyApplication.exe, 0"
oShellLinkPrograms.Description = "MyApplication"
oShellLinkPrograms.WorkingDirectory = strCurrFolder
oShellLinkPrograms.Save