Solved

batch will not execute if included with installer, or compiled into exe, or called from an exe

Posted on 2012-03-13
6
459 Views
1 Endorsement
Last Modified: 2012-03-27
This seems odd to me and I am not sure what is causing it.  

I have a batch that adds the following registry string

reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v "%ProgramFiles%(x86)\bquest\bq.exe" /t REG_SZ /d "WINXPSP2 RUNASADMIN" /f >NUL

All it does it make the shortcut with admin privilages for the user.  

Problem:  This is one script among many in my larger batch file I will issue to my gaming community.  When compiled into exe it does not work.  If I make it a .bat it works, but if I call it from an exe file it does not work.  So I made an installer, which has the.bat as an include and launches it first before anything...and it does not work.  It only works as a bat file executed directly, nothing else can call on it.  

I have to get this working, it can be a .bat file i dont care, but it has to at least allow me to include it in the installer.  

What could cause this?  Some sort of windows permissions?
1
Comment
Question by:icecom4
  • 4
  • 2
6 Comments
 
LVL 11

Expert Comment

by:cup
ID: 37718581
Get procmon from Microsoft, run it up.  Run your installation.  See which part it is failing on.  It will tell you the call or the file it it trying to get to.  You can filter on processes to reduce the amount of output - procmon monitors all processes.
0
 

Author Comment

by:icecom4
ID: 37720884
Maybe "will not execute" was poor choice of words.  If I pause the batch, then add to winrar, then execute, it says "the operation completed successfully" for each regedit line item.  Its just not there when I open registery.  So there is no error messages.  However it is there if I exec bat outside of the installer.  Bizarr, I will still try your utility when I get a chance later
0
 
LVL 11

Expert Comment

by:cup
ID: 37722032
Is it asking for input, timing out and exiting incorrectly?
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Comment

by:icecom4
ID: 37723115
No to all.  In fact is seems to run normal.  It just does not edit the registry if compiled in winrar, or bat to exe.  Its got to have something to do with windows7.  I ran the .exe on windows xp and it works.  
I also tried not using batch at all, instead using .reg script, and the same thing happened.  

Is there something in windows 7 that would block a program from editing registry?
0
 
LVL 11

Accepted Solution

by:
cup earned 500 total points
ID: 37723556
Did you try this on XP32 or XP64?  Your regedit will only make sense on XP64.

Yes - Windows Vista and Windows 7 have added security features. It is basically to stop viruses messing up your registry.  That was the good side.  The bad side is genuine stuff is difficult to install.

Is your executable digitally signed?  You have to create a strong name key (.snk file) and embed it into your executable.  Could give that a try.  If that fails,  it is a big trawl through the internet to figure out how to get around it.

Sorry I can't help any further.
0
 
LVL 11

Expert Comment

by:cup
ID: 37723563
The other alternative is to tell the user to run the command manually with apologies that MS security won't allow you to do it automatically.  It is just another batch file and most users will be quite happy to do it.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
groupSumClump challenge 9 102
Determine Who is Runnig my Bash Shell Script 4 64
t-sql sp_addlinkedserver possible risks 3 54
What is assert.deepEqual? 4 39
Over the years I've spent many an hour playing on hardened, DMZ'd servers, with only a sub-set of the usual GNU toy's to keep me company; frequently I've needed to save and send log or data extracts from these server back to my PC, or to others, and…
Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

867 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

12 Experts available now in Live!

Get 1:1 Help Now