Pages - Menu

2019年6月6日 星期四

[PowerShell]自動開啟網頁

有再登入電子書的網站,每天賺積分。
突然想到,我那麼累的每天登入做啥。
讓電腦自己去跑就好了。

PowerShell 執行外部程式的關鍵字為

&
所以完整語法
$Path =  "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
$parm = "http://tw.yahoo.com http://www.pchome.com.tw"
$Parms = $Parm.Split(" ")
& $Path $parms


這樣就會自動開啟網頁了
再來設定個排程,讓他定時去執行

ref.Google Chrome參數一覽表
ref.how-to-run-an-exe-file-in-powershell-with-parameters-with-spaces-and-quotes

沒有留言:

張貼留言