|01 Sep 2010||#1|
| || |
Need help with a batch file for energy monitoring
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:
Set DATESTAMP=%DATE:~10,4%-%DATE:~4,2%-%DATE:~7,2% Set TIMESTAMP=%TIME:~0,2%-%TIME:~3,2%-%TIME:~6,2% Set DATEANDTIME=%DATESTAMP%_%TIMESTAMP% Echo Date and time: %DATEANDTIME%
powercfg.exe -energy -output C:\Users\rmaharaj\Documents\Energy Reports\EnergyReport_%DATEANDTIME%.html
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')
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!!
|My System Specs|
|Similar help and support threads for2: Need help with a batch file for energy monitoring|
|How to run a batch file at logoff & some batch scripting help please||Backup and Restore|
|Batch File that grabs file names from folder to insert into batch file||General Discussion|
|boot performanc monitoring and shutdown performance monitoring issues||Performance & Maintenance|
|energy-report saving as an xml file.. how to change to html||General Discussion|
|batch file open file for program in the startup folder||General Discussion|
|How to create a batch file that will move files based on the file type||General Discussion|
|Energy Monitoring Software||Software|
|Our Sites ||Site Links ||About Us ||Find Us |
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd
All times are GMT -5. The time now is 01:41 PM.