Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Execute Program in Batch File As Administrator (Or Other Solution)

12 Nov 2014   #1
StrongEagle

Win 7 Pro 64 bit
 
 
Execute Program in Batch File As Administrator (Or Other Solution)

We use a program called TFC.exe (Temp File Cleaner - addpcs.com) to wipe all sorts of temp files off a computer on a monthly basis.

The older version was a standalone .exe that users used to execute from a a folder on a server. The newer version is actually installed on each user's PC.

If TFC it is not run in administrator mode, it is limited to wiping the temp files as allowed by users file permissions. Most of our users do not have admin privileges, and thus, the system files and other user profiles that may be on the computer do not get cleaned.

What I want to do is allow this one program to execute in admin mode, either by having the user execute a batch file (or batch file converted to exe) using a shortcut, or maybe by automatically running it via the task scheduler.

The open ended question is: Can this be accomplished or am I going to have to log in to each computer to run as admin?

TIA.


My System SpecsSystem Spec
.
12 Nov 2014   #2
Callender

Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
 
 
Use an Eleveted Shortcut

Suggest using an Elevated Shortcut in Task Scheduler. Personally I use this:

WinAero: ElevatedShortcut for Windows 7 and Windows 8

As for the batch file to run the program use:

C:\Windows\system32\schtasks.exe /run /tn taskname

taskname is the name as displayed in Task Scheduler. Wrap it in quotes if it contains spaces.
My System SpecsSystem Spec
12 Nov 2014   #3
StrongEagle

Win 7 Pro 64 bit
 
 

Thanks for the information. I see that in the Elevated Shortcut article there is the warning:

Quote:
This shortcut and task can only be created and work while logged in as an administrator account.
This shortcut will not work in a standard user account.
I gather, then, that this will not solve my problem since I want to run TFC on computers with standard users, without me having to login as administrator. Looks like this is tough to do. Thank you.
My System SpecsSystem Spec
.

12 Nov 2014   #4
Callender

Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
 
 
Elevated Shortcut

I hadn't spotted that! In that case I'm not sure. I reckon it must be possible. I know that in my workplace clean up scripts run overnight even with no users logged on but I'm no expert on networks.

When I create an Elevated Shortcut I see the following options:

Execute Program in Batch File As Administrator (Or Other Solution)-e-levated_-local-computer-.jpg

Execute Program in Batch File As Administrator (Or Other Solution)-elevated_-local-computer-2.jpg

Maybe changing to Administrator will allow it to run without UAC using a stored password but I'm not 100% certain.

Also check if this might be suitable - there are some restrictions.

Elevated Program Shortcut - Create for Standard User


My System SpecsSystem Spec
Reply

 Execute Program in Batch File As Administrator (Or Other Solution)




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
shutdown in batch file requires Administrator
Hi all, I've been using GFI Backup 2009 for backups for a while, it does everything I want, and sends email reports after backup is complete. One of its features is to shutdown the computer after a backup, this rarley works, as it wont shutdown if a program is already running, including GFI...
General Discussion
Batch File on USB fails when Ran As Administrator
I am new to this site so please excuse any lack of etiquette I may show. I have recently built a .bat files to perform a large number of configuration changes needed for a Win7 or Win8 workstation to function properly on my network. The .bat file obviously needs to be ran with elevated...
Software
Administrator with full access still can't execute program
Hi all! I'm having a problem with a Windows 7 Professional VM. I'm trying to "lock down" the permissions of some files (cmd.exe, ftp.exe, etc) For example, I modify the permissions for C:\Windows\System32\cmd.exe so that only SYSTEM and Administrators have full access. I removed Users,...
System Security
batch file open file for program in the startup folder
I have a computer that is a drone specifically for an outside LED sign. This computer is designed to never shut off and doesn't have any other program on it besides Operating System and the sign software. I need to create a batch file that I can place in the "start-up" folder that will open the...
General Discussion
execute a .bat and .exe file as administrator once for all
hello, Once i double click on bat file, a new program .exe is launched and receive a msg asking if i allow the program to modify my computer. I click yes, and my short life continues... Any clue what can be done to remove this msg once for all for this program ? After right click on .bat...
System Security
How to always run batch file as administrator?
I've made a batch file, but i don't know how to make it to always run as administartor. In .bat's file properties the option "always run as administartor" is grayed out. I have to right click it and then choose "run as administartor" from context menu. But i don't want to do it every time because...
General Discussion


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 19:18.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App