lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


After wasting god knows how many hours on this, I've found the solution. This is not Lua related exactly. You need an 64 bit application to read registry entries of 64 bit applications. I compiled
a simple 64 bit program to launch the bat file. Problem solved. FU Microsoft.

 


From: Carl Yogehnburg <carlyogehnburg@yahoo.com>
To: "lua-l@lists.lua.org" <lua-l@lists.lua.org>
Sent: Friday, July 12, 2013 4:52 AM
Subject: bizarre os.execute problem

Hello All,

I've spent the last two hours trying to figure this out but I just couldn't.

I'm using os.execute to run a batch file. When I double click the batch file it runs fine. I can also run it fine from the command prompt. There is nothing wrong with the command.

Now the problem is, the file gives an error when I try to run it through the os.execute. Batch file is just a single line:

reg.exe QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Perl > perl_location.txt

When I run os.execute(perl.bat) I get the following error:

ERROR: The system was unable to find the specified registry key or value.


Now the bizarre thing is, if I try another registry key such as :

reg.exe QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Notepad > perl_location.txt

It works!!!

I just couldn't figure out what is wrong here. Any thoughts?