•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Windows Vista section within the Tech Talk category of DaniWeb, a massive community of 427,095 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,333 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Windows Vista advertiser: Programming Forums
Views: 735 | Replies: 1
![]() |
•
•
Join Date: Nov 2007
Posts: 102
Reputation:
Rep Power: 1
Solved Threads: 9
I'm not too keen on this new over the top 'run as administrator' thing in vista. I know it's for my own protection, to prevent malicious code from altering my system, but it makes batch programming a pain. I'm trying to write a couple scripts, one that will kill windows aero, and one that will start windows aero. The one that starts it works fine, here it is:
@echo off
REM ************** KILL AERO ***********
taskkill /IM Dwm.exe
echo DWM Closing main memory
timeout /T 2 /nobreak
taskkill /IM Dwm.exe
echo DWM Closed
pause
(i'm not too sure why DWM needs to be closed twice, but it does...lol)
this works no problem, kills the 33 MB memory hog like a charm
its the script that closes it that is required to be run as an administrator. most executables (.exe's and .com's) have an option in their properties to always be run as an admin, but for batch files this is grayed out for some reason. is there any way, using perhaps batch commands, to set the status to administrator while in the program? I'm not looking for a better way to get rid of aero, I know there's a few other ways. I guess it just boils down to me being too lazy to right click the batch file and choose run as admin. but i'm thinking there could be much more important uses for this knowledge, such as running scripts on startup that you don't get a chance to run as admin.
here's the code to start aero, if anyone wants to steal it go hard.
@echo off
echo Starting Aero
c:\windows\system32\dwm.exe
timeout /T 2 /nobreak
net stop "uxsms"
net start "uxsms"
echo Aero Running
pause
i know there's a runas command - but i'm not sure of its use or practicality to this situation, it seems like more of a public comp or network command than a admin status command. but i could be wrong, please help!
@echo off
REM ************** KILL AERO ***********
taskkill /IM Dwm.exe
echo DWM Closing main memory
timeout /T 2 /nobreak
taskkill /IM Dwm.exe
echo DWM Closed
pause
(i'm not too sure why DWM needs to be closed twice, but it does...lol)
this works no problem, kills the 33 MB memory hog like a charm
its the script that closes it that is required to be run as an administrator. most executables (.exe's and .com's) have an option in their properties to always be run as an admin, but for batch files this is grayed out for some reason. is there any way, using perhaps batch commands, to set the status to administrator while in the program? I'm not looking for a better way to get rid of aero, I know there's a few other ways. I guess it just boils down to me being too lazy to right click the batch file and choose run as admin. but i'm thinking there could be much more important uses for this knowledge, such as running scripts on startup that you don't get a chance to run as admin.
here's the code to start aero, if anyone wants to steal it go hard.
@echo off
echo Starting Aero
c:\windows\system32\dwm.exe
timeout /T 2 /nobreak
net stop "uxsms"
net start "uxsms"
echo Aero Running
pause
i know there's a runas command - but i'm not sure of its use or practicality to this situation, it seems like more of a public comp or network command than a admin status command. but i could be wrong, please help!
•
•
Join Date: Nov 2007
Posts: 102
Reputation:
Rep Power: 1
Solved Threads: 9
UPDATE.
My co-worker (another comp tech) showed me how to use runas to try and run the specific commands as an admin. The problem with this is not only that you have to enter the password each time you use the command, but it doesn't even properly execute the command! maybe im just using it wrong...but here's the code:
@echo off
echo Starting Aero
runas /laptop-pc\kyle c:\windows\system32\dwm.exe
timeout /T 2 /nobreak
runas /laptop-pc\kyle "net stop \"uxsms\""
runas /laptop-pc\kyle "net start \"uxsms\""
echo Aero Running
pause
there's no errors or anything...it seems like its really trying hard to make it work...but nothing. (the reason for the \'s is because of the quotations inside of quotations, which will give you an error without them)
My co-worker (another comp tech) showed me how to use runas to try and run the specific commands as an admin. The problem with this is not only that you have to enter the password each time you use the command, but it doesn't even properly execute the command! maybe im just using it wrong...but here's the code:
@echo off
echo Starting Aero
runas /laptop-pc\kyle c:\windows\system32\dwm.exe
timeout /T 2 /nobreak
runas /laptop-pc\kyle "net stop \"uxsms\""
runas /laptop-pc\kyle "net start \"uxsms\""
echo Aero Running
pause
there's no errors or anything...it seems like its really trying hard to make it work...but nothing. (the reason for the \'s is because of the quotations inside of quotations, which will give you an error without them)
Last edited by skatamatic : Jul 21st, 2008 at 6:41 pm. Reason: typo
![]() |
•
•
•
•
•
•
•
•
DaniWeb Windows Vista Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- How to get around UAC when run Delphi in Windows Vista (urgent!) (Pascal and Delphi)
- Remove User Accounts & run as Administrator only (Windows NT / 2000 / XP / 2003)
- create shortcut to run as a different user (Windows NT / 2000 / XP / 2003)
- mozilla (Web Browsers)
Other Threads in the Windows Vista Forum
- Previous Thread: VISTA : SHARE Files and FOLDERS through ROUTER
- Next Thread: Office 2007 trial


Linear Mode