そこで、以下のVBSプログラムを参考にしたいのですが、
スタートアップに登録したURLは、InternetExplorerで開くようにしたいと思います。
http://q.hatena.ne.jp/1344972475
よい回答は300ポイント以上差し上げます。
スタートアップにURLのショートカットではなく、InternetExplorerを起動するショートカットを作成するように変更することで、ご希望の動作が可能です。
const STARTUP_FILE = "test.lnk" ' ●拡張子はlnkに変更 const STARTUP_URL = "http://www.google.com" set fso = CreateObject("Scripting.FileSystemObject") set wshell = CreateObject("WScript.Shell") startUpPath = wshell.SpecialFolders("AllUsersStartup") call RunAdmin set sc = wshell.CreateShortcut(fso.BuildPath(startUpPath,STARTUP_FILE)) sc.TargetPath = "C:\Program Files\Internet Explorer\iexplore.exe" ' ●URLを引数に指定してIEを起動するように変更 sc.Arguments = STARTUP_URL sc.Save WScript.echo "end" Sub RunAdmin() ' 管理者権限に昇格 ★AllUsersに書き込むのでWindowsVista以降では必須 ' WScript.Arguemnts.Count = 0:GUI 1:CUI do while WScript.Arguments.Count = 0 and WScript.Version >= 5.7 ' Check WScript5.7~ and Vista~ Set wmi = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\.\root\cimv2") Set os = wmi.ExecQuery("SELECT *FROM Win32_OperatingSystem") For Each value in os if left(value.Version, 3) < 6.0 then exit do 'Exit if not vista Next ' Run this script as admin. Set sha = CreateObject("Shell.Application") sha.ShellExecute "wscript.exe", """" & WScript.ScriptFullName & """ uac", "", "runas" WScript.Quit loop End Sub
ショートカットをスタートアップに登録する、そんだけですよね?
http://www.kanaya440.com/contents/tips/vbs/008.html
でショートカット作る方法があるので、ショートカットの先をURLにすればいいです。
スタートアップを取得する方法はこれ。
http://pnpk.net/cms/archives/306
スタートアップにURLのショートカットではなく、InternetExplorerを起動するショートカットを作成するように変更することで、ご希望の動作が可能です。
const STARTUP_FILE = "test.lnk" ' ●拡張子はlnkに変更 const STARTUP_URL = "http://www.google.com" set fso = CreateObject("Scripting.FileSystemObject") set wshell = CreateObject("WScript.Shell") startUpPath = wshell.SpecialFolders("AllUsersStartup") call RunAdmin set sc = wshell.CreateShortcut(fso.BuildPath(startUpPath,STARTUP_FILE)) sc.TargetPath = "C:\Program Files\Internet Explorer\iexplore.exe" ' ●URLを引数に指定してIEを起動するように変更 sc.Arguments = STARTUP_URL sc.Save WScript.echo "end" Sub RunAdmin() ' 管理者権限に昇格 ★AllUsersに書き込むのでWindowsVista以降では必須 ' WScript.Arguemnts.Count = 0:GUI 1:CUI do while WScript.Arguments.Count = 0 and WScript.Version >= 5.7 ' Check WScript5.7~ and Vista~ Set wmi = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\.\root\cimv2") Set os = wmi.ExecQuery("SELECT *FROM Win32_OperatingSystem") For Each value in os if left(value.Version, 3) < 6.0 then exit do 'Exit if not vista Next ' Run this script as admin. Set sha = CreateObject("Shell.Application") sha.ShellExecute "wscript.exe", """" & WScript.ScriptFullName & """ uac", "", "runas" WScript.Quit loop End Sub
strFileName = "open_ie.lnk" strUrl = "http://q.hatena.ne.jp/" Set objShell = CreateObject("WScript.Shell") strStartUpFolder = objShell.SpecialFolders("Startup") Set objShortCut = objShell.CreateShortcut(strStartUpFolder + "\" + strFileName) objShortCut.TargetPath = "C:\Program Files\Internet Explorer\iexplore.exe" objShortCut.Arguments = strUrl objShortCut.Save
標準のブラウザが IE 以外でも、IE で開きたい、ということかと思いましたので、
インターネットショートカットではなく、IE のショートカットにしてみました。
コメント(0件)