Overclock.net banner
1 - 2 of 2 Posts

2,093 Posts
Discussion Starter · #1 ·
Im running a batch program to open up speedfan from my desktop, of which it starts to, but then a window pops up for the user account control to ask me do i want this app to make changes to my PC, with a yes or no, how can i write this in my batch file, this is what i have so far

@echo off
start "title" "C:\Program Files (x86)\SpeedFan\speedfan.exe"

thanks for all help in advance.

2,093 Posts
Discussion Starter · #3 ·
Originally Posted by billbartuska View Post

This should do it.

REM --> Run Batch file as Admin
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )

echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
set params = %*:"=""
echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs"

del "%temp%\getadmin.vbs"
exit /B

pushd "%CD%"
CD /D "%~dp0"
REM Run Batch File here
Thanks for the help but it does not work.
1 - 2 of 2 Posts
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.