Search code examples
batch-filecmdwinlogon

Run a program from logon batch file accepting yes for UAC


I am trying to set up a log on batch file that runs ccleaner.exe /AUTO at each log on to keep the internet cache and temp files clear. We use a web browser based system that fills up a lot of the user profile's IE temp files.

Here is what I am trying to use in a batch file,

cd \
runas /user:localtv /pass:start123 /savecred "c:\CCleaner.exe /AUTO"
PAUSE

The thing with this, is that every time it runs, it brings up UAC yes or no. I would like it to not do that.

Is this possible?

Or do you think I should just write a batch file that deletes all the files and folders individually?

Any advice would be great.

Thanks!


Solution

  • This will not answer the question but might solve your overall problem:

    You could use the Windows Task Scheduler to run CCleaner /AUTO at every log in.

    Simply create an entry as Administrator and get it to run when any user logs in, the UAC will not bother you this time as it will run with admin privileges.

    You can find the Task Scheduler by searching for it in the Start menu.