Executing .bat with .reg call

142 views
Skip to first unread message

Irish

unread,
Jul 22, 2011, 2:15:21 PM7/22/11
to Bayden
I'm having a problem with a .bat file in SlickRun. I've got a .bat
that runs a .reg in silent mode. When I run the .reg from SlickRun it
works (but needs user intervention), and when I double click the .bat
it will run the .reg properly. However, if I run the .bat from
SlickRun it will not run the .reg properly.

Is there any macro or something that I can run to get this working
correctly? I've tried to "Run as Administrator" but that doesn't
work.

Thanks,
Chris

EricLaw

unread,
Jul 22, 2011, 2:51:49 PM7/22/11
to Bayden
I'm not sure I understand what "it will not run the .reg properly"
means exactly. Can you explain further?

Are you using a 64bit Operating System?

Irish

unread,
Jul 22, 2011, 2:57:29 PM7/22/11
to Bayden
Sorry Eric,

I should have explained further. When I say it doesn't run the .reg
properly, I mean that the edits I make to the registry in the .reg
aren't made when run through SlickRun. However, the same .bat will
run the .reg properly when double-clicked.

Thanks for helping me with this ... everything must be run through
SlickRun or my OCD kicks into high gear :P

Chris

Irish

unread,
Jul 22, 2011, 2:58:30 PM7/22/11
to Bayden
Oh and yes ... I'm running 64-bit Win7 ... and I've tried both
"Disable 32bit redirection" on and off.

Chris

EricLaw

unread,
Jul 22, 2011, 3:42:16 PM7/22/11
to Bayden
What prompt are you seeing in these cases? Do you see an elevation
prompt or the prompt asking if you want to import a registry script?
Are you trying to write to HKLM registry keys which are virtualized by
process bitness?

When you run the BAT from SlickRun, do you see any error messages in
the console?

I suspect the most likely explanation is that you're running the batch
file from Slickrun by pointing directly at the BAT and the result is
that a 32bit CMD prompt is spawned which then results in a 32bit
RegEdit instance, and you only end up writing to the 32-bit
virtualized versions of the registry keys. You could use SysInternals'
Process Monitor to verify if that's the case.

Chris Nicol

unread,
Jul 22, 2011, 4:01:10 PM7/22/11
to bay...@googlegroups.com
This is what I have for the .bat:

--START--
@ECHO OFF

regedit /s FeaturesOverride.reg
"C:\Program Files\Zune\Zune.exe"

exit
--END--

The FeaturesOverride.reg looks like this:

--START--
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Zune\Features]
"Channels"="US,CA"
"MusicVideos"="US,CA"
"Picks"="US,CA"
"Podcasts"="US,CA"
"QuickMixLocal"="US,CA"
--END--

And then I'm wrapping it all in a .vbs so that it the cmd prompt runs invisible (note: I haven't brought this up, as the .bat doesn't work whether it's run from the .vbs or not):

--START--
Set WshShell = CreateObject("WScript.Shell") 
WshShell.Run chr(34) & "C:\...\SlickRun Scripts\Zune\RunZune.bat" & Chr(34), 0
Set WshShell = Nothing
--END--

I don't see any error messages (even with echo on) and as you can see I'm just writing simple string keys.  So I think you're right that I'm probably just spawning a 32bit cmd, however, I'm just trying to think about how I can get around this.  Ideas?

Thanks again for your help.
--
Chris

EricLaw

unread,
Jul 25, 2011, 8:38:04 AM7/25/11
to Bayden
Try setting the Filename to full path to the 64bit version of the
WScript command processor: C:\windows\syswow64\wscript.exe and the
parameters field to point at your script file?
> Chris- Hide quoted text -
>
> - Show quoted text -

EricLaw

unread,
Jul 25, 2011, 8:38:46 AM7/25/11
to Bayden
Also, keep in mind that you can use Task Manager to see the bitness of
the spawned processes; if it's got a "*" after the name, it's 32 bit.

On Jul 22, 1:01 pm, Chris Nicol <irish...@gmail.com> wrote:

Chris Nicol

unread,
Jul 25, 2011, 5:44:35 PM7/25/11
to bay...@googlegroups.com
Hi Eric,

So that didn't work.  I still get the same end result when I run WScript.exe with the file name in the parameters.  I think you've got me down the right path ... I'm trying to force the use of the 64bit cmd when running the .bat ... however, I can't seem to figure out the syntax for the script.

It's very hard to tell if it's calling a 32bit WScript or cmd, as everything happens quickly.

Chris
--
Chris

Claudio Andre Heckler

unread,
Jul 28, 2011, 7:42:44 AM7/28/11
to bay...@googlegroups.com
 
Chris, I know what you problem probably is ... Take a look at this suggestion here, and try to call your batch file via  "cmd64.exe /C yourbatch.bat"
 
 
 
Regards,
Claudio A. Heckler
Reply all
Reply to author
Forward
0 new messages