Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2013-01-07
6
Medium Priority
?
1,811 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 56

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 56

Accepted Solution

by:
McKnife earned 2000 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
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 

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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Make the most of your online learning experience.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

719 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