1. Windows鍵+S搜尋 “Windows PowerShell“
2.右鍵點擊 “Windows PowerShell” 並選擇 “以系統管理員身分執行“
3.複製貼上下方程式碼 後 按Enter
# Define the homepage URL
$homePage = "https://raytai.org.tw"
# Set homepage for Google Chrome (requires admin privileges if modifying HKLM)
$chromePolicyPath = "HKCU:\Software\Policies\Google\Chrome"
if (!(Test-Path $chromePolicyPath)) {
New-Item -Path $chromePolicyPath -Force | Out-Null
}
Set-ItemProperty -Path $chromePolicyPath -Name "HomepageLocation" -Value $homePage
Write-Host "Chrome homepage set to $homePage"
# Remove existing startup shortcut to avoid duplicates
$startupPath = [System.Environment]::GetFolderPath('Startup')
$chromeShortcut = Join-Path $startupPath "OpenChrome.lnk"
if (Test-Path $chromeShortcut) {
Remove-Item -Path $chromeShortcut -Force
Write-Host "Removed existing Chrome startup shortcut."
}
# Add Chrome launch on startup (Maximized)
$chromeExePaths = @(
"C:\Program Files\Google\Chrome\Application\chrome.exe",
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
)
$chromeExe = $chromeExePaths | Where-Object { Test-Path $_ } | Select-Object -First 1
if ($chromeExe) {
$WScriptShell = New-Object -ComObject WScript.Shell
$Shortcut = $WScriptShell.CreateShortcut($chromeShortcut)
$Shortcut.TargetPath = $chromeExe
$Shortcut.Arguments = "--new-window --start-maximized `"$homePage`""
$Shortcut.WindowStyle = 3
$Shortcut.Save()
Write-Host "Chrome set to open maximized on startup."
} else {
Write-Warning "Chrome executable not found. Checked paths:`n$($chromeExePaths -join "`n")"
}
Write-Host "瑞泰社福首頁自動化已完成!"
4. 完成。後續開機會自動開啟一等一登入首頁,方便得知瑞泰最新訊息!