Page 1 of 1
Batch file not running correctly
Posted: Thu Oct 08, 2015 9:02 am
by carelvos
I have the following code:
set the hideConsoleWindows to false
get shell("C:\aa87275\regadd.bat")
if it is not empty then answer it
Inside the regadd.bat is the following:
reg add HKLM\Software\Microsoft\Windows\CurrentVersion\Run\ /t REG_SZ /v "test" /d "C:\Windows\test.exe" /f
echo xxx >> c:\test.txt
In the console window the reg add command says The operation completed successfully and the xxx gets added to c:\test.txt, so the batch file do run, but the registry does not get updated. When I run the batch file from explorer the registry does get updated. I did try to run livecode as administrator - same thing.
Any ideas?
Thanks,
Carel
Re: Batch file not running correctly
Posted: Thu Oct 08, 2015 9:40 am
by FourthWorld
You might try LiveCode's built-in setRegistry function.
Re: Batch file not running correctly
Posted: Thu Oct 08, 2015 10:17 am
by carelvos
I did try the setRegistry but couldn't get it to work. Do you maybe have an example?
Thanks,
Carel
Re: Batch file not running correctly
Posted: Thu Oct 08, 2015 10:44 am
by LCNeil
Hi Carel,
Its sounds like you are running a 64bit version of Windows?
LiveCode is a 32bit application so any registry calls will be written to the Wow6432Node registry entry. This is taken care of automatically by Windows.
More info on this can be found here-
http://www.advancedinstaller.com/user-g ... -node.html
Kind Regards,
Neil Roger
--
LiveCode Support Team ~
http://www.livecode.com
-
Re: Batch file not running correctly
Posted: Thu Oct 08, 2015 11:27 am
by carelvos
LCNeil wrote:Hi Carel,
Its sounds like you are running a 64bit version of Windows?
LiveCode is a 32bit application so any registry calls will be written to the Wow6432Node registry entry. This is taken care of automatically by Windows.
More info on this can be found here-
http://www.advancedinstaller.com/user-g ... -node.html
Kind Regards,
Neil Roger
--
LiveCode Support Team ~
http://www.livecode.com
-
Hi Neil,
Yes you are right, the key is there.
Thanks,
Carel
Re: Batch file not running correctly
Posted: Thu Oct 08, 2015 11:30 am
by SparkOut
Might it be running foul of requirement for elevated permissions to run the shell command?
I haven't played with the registry for a long time, since XP days.
I have just tried with Windows 7 32 bit edition, cannot get either the batch file way or setRegistry way to work.
If I open a command prompt by right-clicking and "run as administrator" I can put the reg add line in and it will work. Without elevated permissions it produces ERROR: Access is denied.
Is there a way to elevate permissions to run the setRegistry command within LC, in the IDE or a stack - I know there is a manifest option in the standalone settings.
[EDIT] I see you have had success with the 32 bit node. Are you running Windows XP?
[Another EDIT] Opening the IDE with "Run as Administrator" works to setRegistry too, der!
Re: Batch file not running correctly
Posted: Sat Oct 10, 2015 9:45 am
by carelvos
SparkOut wrote:Might it be running foul of requirement for elevated permissions to run the shell command?
I haven't played with the registry for a long time, since XP days.
I have just tried with Windows 7 32 bit edition, cannot get either the batch file way or setRegistry way to work.
If I open a command prompt by right-clicking and "run as administrator" I can put the reg add line in and it will work. Without elevated permissions it produces ERROR: Access is denied.
Is there a way to elevate permissions to run the setRegistry command within LC, in the IDE or a stack - I know there is a manifest option in the standalone settings.
[EDIT] I see you have had success with the 32 bit node. Are you running Windows XP?
[Another EDIT] Opening the IDE with "Run as Administrator" works to setRegistry too, der!
Hi SparkOut
I'm on 64 bit Win 7 - From the IDE (without running as Administrator) the batch file works but goes to the 32 bit node. On Windows 8 running the standalone (no livecode on that PC) as Administrator, the batch file does not run - or I should say it probably runs, but isn't running as Administrator although it is called from my app that is running as Administrator. That is just purely speculation though.
Anyone got an example for setRegistry that works?
In the dictionary is the following examples:
setRegistry("HKEY_CLASSES_ROOT\.txt\", "NotePad")
if setRegistry(myEntry & "/",myValue) then open file myFile
setRegistry(theKey,empty)
but it says setRegistry is a FUNCTION, so what should the correct way be to use it??
Regards,
Carel