Batch file not running correctly
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Batch file not running correctly
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
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
-
- VIP Livecode Opensource Backer
- Posts: 10045
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Batch file not running correctly
You might try LiveCode's built-in setRegistry function.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Batch file not running correctly
I did try the setRegistry but couldn't get it to work. Do you maybe have an example?
Thanks,
Carel
Thanks,
Carel
Re: Batch file not running correctly
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
-
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
Hi Neil,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
-
Yes you are right, the key is there.
Thanks,
Carel
Re: Batch file not running correctly
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!
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
Hi SparkOutSparkOut 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!
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