概念:
http://blog.laptopmag.com/improving-tests
Battery Life
The Laptop Mag battery test replicates continuous web surfing over Wi-Fi until the battery is completely drained. Starting with a full battery, a notebook/tablet/smartphone runs a script that visits 50 popular web sites in a loop, pausing for 30 seconds on each, then closing and reopening the native browser with the next page. The settings are tweaked to prevent the device from entering standby mode or going into hibernation.
脚本
$times = Read-Host "输入循环次数"
[String]$website1 = Read-Host "输入一个网页"
[String]$website2 = Read-Host "输入一个网页"
[String]$website3 = Read-Host "输入一个网页"
[String]$website4 = Read-Host "输入一个网页"
[String]$website5 = Read-Host "输入一个网页"
For ($i=0;$i –lt $times;$i++) {
#do something
& 'C:\Program Files (x86)\Internet Explorer\iexplore.exe' -k $website1
sleep 10
[void] [System.Reflection.Assembly]::LoadWithPartialName("'System.Windows.Forms")
[System.Windows.Forms.SendKeys]::SendWait("{PGDN}")
stop-process -processname iexplore
& 'C:\Program Files (x86)\Internet Explorer\iexplore.exe' -k $website2
sleep 10
[void] [System.Reflection.Assembly]::LoadWithPartialName("'System.Windows.Forms")
[System.Windows.Forms.SendKeys]::SendWait("{PGDN}")
stop-process -processname iexplore
& 'C:\Program Files (x86)\Internet Explorer\iexplore.exe' -k $website3
sleep 10
[void] [System.Reflection.Assembly]::LoadWithPartialName("'System.Windows.Forms")
[System.Windows.Forms.SendKeys]::SendWait("{PGDN}")
stop-process -processname iexplore
& 'C:\Program Files (x86)\Internet Explorer\iexplore.exe' -k $website4
sleep 10
[void] [System.Reflection.Assembly]::LoadWithPartialName("'System.Windows.Forms")
[System.Windows.Forms.SendKeys]::SendWait("{PGDN}")
stop-process -processname iexplore
& 'C:\Program Files (x86)\Internet Explorer\iexplore.exe' -k $website5
sleep 10
[void] [System.Reflection.Assembly]::LoadWithPartialName("'System.Windows.Forms")
[System.Windows.Forms.SendKeys]::SendWait("{PGDN}")
stop-process -processname iexplore
}