Solved

flag file to run as admin in registry (windows 8)

Posted on 2013-01-07
6
1,684 Views
Last Modified: 2013-01-16
The below registry edit from batch does update the registry, however the file "test.bat" does not flag "run as administrator".

I used this in windows XP and Windows 7 and it works, not sure why it does not work in Windows 8.  

Is there a different path in Windows 8 to perform this task other than AppCompatFlags\Layers?

REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v "%systemdrive%\program files\TEST\program\Test.bat" /t REG_SZ /d "WINXPSP2 RUNASADMIN" /f >nul 2>nul
0
Comment
Question by:icecom4
  • 4
  • 2
6 Comments
 
LVL 53

Expert Comment

by:McKnife
ID: 38752363
Comment deleted as it requires further testing, sorry.
0
 

Author Comment

by:icecom4
ID: 38752983
I wonder if you are scratching your head like I am?
0
 
LVL 53

Accepted Solution

by:
McKnife earned 500 total points
ID: 38753112
Yeah, scratched it throughly.

First, in win8, it's "~ RUNASADMIN"
but that's not enough and I don't know why.

Set it manually (via the compatibility tab), works. Used another program and this time did a registry comparison using regshot - I did not see a difference but the aforementioned key, so that seemed to be it, but it ain't. Setting that key manually does not produce the same result.

if I were you, I would do a file and registry before and after comparison. Use wininstall LE (Freeware) to do it. wininstall LE produces an MSI file that can be further analysed to reveal all file and reg changes.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:icecom4
ID: 38755427
yes, this is weird, by adding a registry flag makes things worse for the bat file.  Without the key, it will not run as admin, but with the key, it go bonkers and starts echoing everything in the batch, and will not execute or close.
0
 

Assisted Solution

by:icecom4
icecom4 earned 0 total points
ID: 38769256
I decided to use a vbscript to edit the shortcuts, something in windows 8 is not allowing the registry to FULLY control the file.  

I found the solution on this page...
http://stackoverflow.com/questions/6652486/how-to-set-run-as-administrator-flag-on-shortcut-created-by-msi-installer

However your post about "~ RUNASADMIN" actually led me to it.  

So thanks!
0
 

Author Closing Comment

by:icecom4
ID: 38782029
Windows 8 will not fully flag a .lnk file properly in the registry, it makes links to batch scripts behave crazy.  the best way is to use a vbscript to flag runasadmin outside of the registry.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Email Mail Merge with an Attachment 1 27
topping1 challenge 7 53
Image decoding from Camera 3 48
Change path in batch file 2 12
Ever wondered why Windows 8 and 10 don't seem to accept your GPO-based software deployment while Windows 7 does? Read on.
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
The goal of this Micro Tutorial is to help navigate beginning users with the app store on Windows 8. It will explain exciting features how to maximize your PC through these apps. This will be demonstrated using Windows 8 operating system.
This Micro Tutorial will teach you how to reformat your flash drive. Sometimes your flash drive may have issues carrying files so this will completely restore it to manufacturing settings. Make sure to backup all files before reformatting. This w…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now