I just got upgraded from XP to Windows 7 at the office (on a Lenovo T500 laptop). I've been fiddling around for the past few hours with efficiency settings
to make everything smooth and fast.
During my searches, I ran across this site which could possibly help with battery life and thought it would be cool if I could semi-automate it: Make Windows 7 Be More Efficient & Have Better Battery Life | OS Attack
In the bat file, I wanted to do the following:
1. Get the current date and time.
2. Navigate to the System32 directory.
3. Execute the powercfg application with the output file having the current date and time.
I'm mediocre with bats so Google aided me in coming up with this:
Echo Date and time: %DATEANDTIME%
powercfg.exe -energy -output C:\Users\rmaharaj\Documents\Energy Reports\EnergyReport_%DATEANDTIME%.html
Unfortunately, the -energy switch needs the command prompt to be running as an Administrator.
I tried finding out how to have the batch file open a command prompt in as an Admin. This is the command I was able to come up with:
PowerShell -Command (New-Object -com 'Shell.Application').ShellExecute('CMD.EXE','C:\Windows\System32','','runas')
But I'm not able to:
1. get the rest of it to run in the newly opened command prompt
2. close both the old and new command prompt when they are completed
Can someone please help with this?
Thanks in advance!!