Skip to content

Instantly share code, notes, and snippets.

@doggy8088
Last active July 24, 2022 13:23
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doggy8088/2f5ed8d13e5978973471fd6c62b57fc1 to your computer and use it in GitHub Desktop.
Save doggy8088/2f5ed8d13e5978973471fd6c62b57fc1 to your computer and use it in GitHub Desktop.
  1. 開啟 Windows PowerShell

  2. IE 函式加入到 $PROFILE 之中

    [System.IO.Directory]::CreateDirectory([System.IO.Path]::GetDirectoryName($PROFILE))
    notepad $PROFILE
    function IE {
        $vbs = (New-TemporaryFile).FullName + '.vbs'
        @('set IE = CreateObject("InternetExplorer.Application")', 'IE.Visible = true', 'IE.Navigate "about:blank"') |
        Out-File -FilePath $vbs -Encoding ascii
        wscript.exe $vbs
    }
  3. 重新啟動 Windows PowerShell

  4. 執行 IE 命令 (不區分大小寫)

    ie

以上命令適用於 Windows 10 與 Windows 11

function IE {
$vbs = (New-TemporaryFile).FullName + '.vbs'
@"
StartURL = "about:blank"
set IE = CreateObject("InternetExplorer.Application")
IE.Visible = true
IE.Navigate StartURL
"@ | Out-File -FilePath $vbs -Encoding ascii
wscript.exe $vbs
}
function IE {
$vbs = (New-TemporaryFile).FullName + '.vbs'
@('set IE = CreateObject("InternetExplorer.Application")', 'IE.Visible = true', 'IE.Navigate "about:blank"') |
Out-File -FilePath $vbs -Encoding ascii
wscript.exe $vbs
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment