Velvet Star Monitor

Standout celebrity highlights with iconic style.

general

Why is "run this program as an administrator" disabled?

Writer Emily Wong

I need to stop some services so I made a cmd file but it doesn't work because it needs to run as admin. When I right click on the file and choose Properties, I see that "run this program as an administrator" is disabled. Why? How do I turn it on?

The UAC is enabled (but set not to dim the screen) and for other programs (exe files) that box is enabled.

3 Answers

As a workaround you can try this.

Create a shortcut to the batch file
Right-click on the shortcut and select properties
(Ignore the option on the compatability tab which is still disabled)
Select the Shortcut tab
Click on Advanced
Select 'Run As administrator'
Click on Ok

4

I have found a very useful batch file here:

I quote the CMD file you will need:

@ECHO OFF
REM Changing working folder back to current directory
%~d0
CD %~dp0
REM Folder changed
REM Check first if Windows XP
for /f "tokens=3*" %%i IN ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v ProductName ^| Find "ProductName"') DO set vers=%%i %%j
echo %vers% | find "XP" > nul
if %ERRORLEVEL% == 0 goto ver_xp
REM Ask for admin access
if exist "admincheckOK.txt" goto adminOK1
del /Q admincheckOK.vbs
ECHO.
ECHO. Please wait...
echo.Set objShell = CreateObject("Shell.Application") > admincheckOK.vbs
echo.Set FSO = CreateObject("Scripting.FileSystemObject") >> admincheckOK.vbs
echo.strPath = FSO.GetParentFolderName (WScript.ScriptFullName) >> admincheckOK.vbs
echo.If FSO.FileExists(%0) Then >> admincheckOK.vbs
echo. Dim oShell >> admincheckOK.vbs
echo. Set oShell = WScript.CreateObject ("WScript.Shell") >> admincheckOK.vbs
echo. oShell.run "cmd.exe /c echo admincheckOK > admincheckOK.txt" >> admincheckOK.vbs
echo. Set oShell = Nothing >> admincheckOK.vbs
echo. objShell.ShellExecute "cmd.exe", " /c " ^& %0 ^& " ", "", "runas", 1 >> admincheckOK.vbs
echo.Else >> admincheckOK.vbs
echo. MsgBox "Script file not found" >> admincheckOK.vbs
echo.End If >> admincheckOK.vbs
cscript //B admincheckOK.vbs
goto timeend
:adminOK1
del /Q admincheckOK.txt
del /Q admincheckOK.vbs
:ver_xp
REM Admin Access allowed
REM CMD CODE TO RUN AS ADMIN HERE!!
REM Following statement required if Admin access denied
:timeend
del /Q admincheckOK.vbs

After the REM CMD CODE TO RUN AS ADMIN HERE!! you will have admin access. It uses a lot of trickery to achieve this.

It effectively creates a .vbs VBScript file. VBScript can trigger UAC. It will also create an admincheckOK.txt that tells the batch file that it is in admin mode right now when it is run the next time (which happens right after that using objShell.ShellExecute)

Unlike the variant with the link file you will only need one file in the directory most of the time. For a remote second during the execution of the batch file there will be 3 files inside, but they are deleted afterwards.

Just try to take ownership of the file to yourself by right-click on file
Select Security-and then you can use Edit or Advance settings to change the permissions for the file. I think this would help you.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy