Create Shortcut
ショートカットファイル作成
Powershell でショートカットファイル作成。
com のwshで作成する。
$wsh = New-Object -comObject WScript.Shell $link = $wsh.CreateShortcut("D:\desktop\notepad.lnk") $link.TargetPath = "notepad.exe" $link.Description = "メモ帳" $link.WorkingDirectory = $home $link.IconLocation = "notepad.exe" $link.Save() # 廃棄 [System.Runtime.Interopservices.Marshal]::ReleaseComObject($wsh) remove-valiable link
参考
デスクトップにメモ帳のショートカット作成
http://www.atmarkit.co.jp/ait/spv/0409/17/news086_3.html
http://mtgpowershell.blogspot.jp/2010/11/blog-post_27.html?m=1
パッケージ
パッケージ内の記述例
<package>
<job id="vbs">
<script language="VBScript">
set WshShell = WScript.CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop")
set oShellLink = WshShell.CreateShortcut(strDesktop & "\ショートカット スクリプト..lnk")
oShellLink.TargetPath = WScript.ScriptFullName
oShellLink.WindowStyle = 1
oShellLink.Hotkey = "CTRL+SHIFT+F"
oShellLink.IconLocation = "notepad.exe, 0"
oShellLink.Description = "ショートカット スクリプト."
oShellLink.WorkingDirectory = strDesktop
oShellLink.Save
set oUrlLink = WshShell.CreateShortcut(strDesktop & "\マイクロソフトの Web サイト.url")
oUrlLink.TargetPath = "http://www.microsoft.com"
oUrlLink.Save
</script>
</job>
<job id="js">
<script language="JScript">
var WshShell = WScript.CreateObject("WScript.Shell");
strDesktop = WshShell.SpecialFolders("Desktop");
var oShellLink = WshShell.CreateShortcut(strDesktop + "\\ショートカット スクリプト.lnk");
oShellLink.TargetPath = WScript.ScriptFullName;
oShellLink.WindowStyle = 1;
oShellLink.Hotkey = "CTRL+SHIFT+F";
oShellLink.IconLocation = "notepad.exe, 0";
oShellLink.Description = "ショートカット スクリプト";
oShellLink.WorkingDirectory = strDesktop;
oShellLink.Save();
var oUrlLink = WshShell.CreateShortcut(strDesktop + "\\マイクロソフト Web サイト.url");
oUrlLink.TargetPath = "http://www.microsoft.com";
oUrlLink.Save();
</script>
</job>
</package>