메뉴 건너뛰기

Dev tips

Windows Server [VBS] WshShell.CreateShortcut - 바로가기 생성

taknim 2013.01.29 04:05 조회 수 : 6177 추천:939

http://nazelm.egloos.com/938259http://blog.naver.com/mokomoji/130106144323
http://nazelm.egloos.com/938259

Set WshShell = WScript.CreateObject("WScript.Shell")
Desktop = WshShell.SpecialFolders("Desktop")
Set objLink = WshShell.CreateShortcut(Desktop & "\바로가기파일명.lnk")

objLink.TargetPath = WScript.ScriptFullName
objLink.RelativePath = "C:\Temp\"
objLink.WindowStyle = 1
objLink.Hotkey = "Ctrl+Alt+C"
objLink.IconLocation = "notepad.exe, 0"
objLink.Description = "Shortcut to Script Working Directory"
objLink.WorkingDirectory = Desktop
objLink.Arguments = "C:\myFile.txt"
objLink.Save

' WScript.Echo objLink.FullName  

- WindowStyle -
1   : Activates and original size-position.
3   : Activates and Maximize.
7   : Minimizes and Activates the next top-level window.

' cf, TargetPath (+WorkingDirectory)만 지정되어 있으면 충분.

----------------------------------------------------------

Desktop = WshShell.SpecialFolders("Desktop")
Set objUrl = WshShell.CreateShortcut(Desktop & "\Egloos.url")
objUrl.TargetPath = "http : //www. Egloos. com"
objUrl.Save

' WScript.Echo objUrl.FullName

' FullName (WshShortcut / WshUrlShortcut Object) -  full path of the shortcut object's target.

[출처] WshShell.CreateShortcut|작성자 모꼬모지