Why can I no longer run a program as administrator!?

Marty McFly

New member
Member
VIP
Local time
2:57 PM
Messages
120
Location
UK
Many years ago I downloaded a handy .bat file which automatically creates firewall entries. I've always had it set up to run as administrator, as this is required.

But today I tried to run the file and it won't run as administrator!? In the Properties > Compatibility, the option to "Run as administrator" is greyed out. This is not the case with other programs, just this /bat file.

Could this have something to do with the fact that I recently installed a critical Windows update (kb4012212)?
 

My Computer My Computer

At a glance

Windows 7 Home Premium 64bit
OS
Windows 7 Home Premium 64bit
Try renaming it to . CMD
 

My Computer My Computer

At a glance

win 8 32 bit
Computer type
PC/Desktop
OS
win 8 32 bit
Add the below code beginning of batch script to run it with administrative privileges.



Code:
net sess>nul 2>&1||(powershell start cmd -ArgumentList """/c %~0""" -verb Runas & exit)
 

My Computer My Computer

At a glance

Windows 10 Pro x64Intel Core i5 6600Corsair Vengeance LPX 16GB 2666MHz DDR4AMD Radeon R9 380 Series
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Custom Build
OS
Windows 10 Pro x64
CPU
Intel Core i5 6600
Motherboard
Gigabyte Technology Z170M-D3H-CF (U3E1)
Memory
Corsair Vengeance LPX 16GB 2666MHz DDR4
Graphics Card(s)
AMD Radeon R9 380 Series
Hard Drives
SSD
HDD
Antivirus
Eset Smart Security
Browser
Mozila Firefox
Add the below code beginning of batch script to run it with administrative privileges.
Thanks but that didn't work, the DOS prompt just opens then disappears when I add that to the start of it.
 

My Computer My Computer

At a glance

Windows 7 Home Premium 64bit
OS
Windows 7 Home Premium 64bit
Hi Marty McFly,

Thanks but that didn't work, the DOS prompt just opens then disappears when I add that to the start of it.

That needs to be ADDED to the beginning of the Batch File. Then save the Batch File with the .bat extension and then run it!
 

My Computer My Computer

At a glance

Win 7 HP SP1 64-bit Vista HB SP2 32-bit Linux...Intel(R) Pentium(R) CPU P6200 @ 2.13GHz4.00 GBIntel(R) Graphics Media Accelerator HD
Computer type
Laptop
Computer Manufacturer/Model Number
Fujitsu LIFEBOOK
OS
Win 7 HP SP1 64-bit Vista HB SP2 32-bit Linux Mint 18.3
CPU
Intel(R) Pentium(R) CPU P6200 @ 2.13GHz
Motherboard
FUJITSU FJNBB06
Memory
4.00 GB
Graphics Card(s)
Intel(R) Graphics Media Accelerator HD
Sound Card
[1] Realtek High Definition Audio [2] Intel(R) Display Audio
Screen Resolution
1366 x 768 x 32 bits (4294967296 colors) @ 59 Hz
Hard Drives
TOSHIBA MK5076GSX
Antivirus
AVG FREE
Below is a example batch script.


Code:
:: Disable Downloaded Files from being Blocked in Windows
 [USER=353699]echo[/USER] Off


net sess>nul 2>&1||(powershell start cmd -ArgumentList """/c %~0""" -verb Runas & exit)

call :IsAdmin


:_Start
Cls & Mode CON  LINES=11 COLS=100 & Color 0E 
Echo.
Echo.       
Echo         Type (D) letter to  Disable Downloaded Files from being Blocked for All Users  
Echo.       
Echo.
Echo.
Echo.         
Echo         Type (E) letter to Enable Downloaded Files from being Blocked for All Users   
Echo.         



Set /p input= RESPONSE: 
If /i  Not %input%==D (Goto :_Ex) Else (Goto :_Disable)

:_Ex
If /i  Not %input%==E  (Goto :_Start) Else (Goto :_Enable)





:_Disable

Reg.exe add "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Attachments" /v "SaveZoneInformation" /t REG_DWORD /d "1" /f
Reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Attachments" /v "SaveZoneInformation" /t REG_DWORD /d "1" /f

Exit



:_Enable

Reg.exe delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Attachments" /v "SaveZoneInformation" /f
Reg.exe delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Attachments" /v "SaveZoneInformation" /f




:IsAdmin
Reg.exe query "HKU\S-1-5-19\Environment"
If Not %ERRORLEVEL% EQU 0 (
 Cls & Echo You must have administrator rights to continue ... 
 Pause & Exit
)
Cls
goto:eof
 

My Computer My Computer

At a glance

Windows 10 Pro x64Intel Core i5 6600Corsair Vengeance LPX 16GB 2666MHz DDR4AMD Radeon R9 380 Series
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Custom Build
OS
Windows 10 Pro x64
CPU
Intel Core i5 6600
Motherboard
Gigabyte Technology Z170M-D3H-CF (U3E1)
Memory
Corsair Vengeance LPX 16GB 2666MHz DDR4
Graphics Card(s)
AMD Radeon R9 380 Series
Hard Drives
SSD
HDD
Antivirus
Eset Smart Security
Browser
Mozila Firefox
Back
Top