Page 1 of 1

[26 Oct 2011] Executing a Command in Windows using Execute()

Posted: Sat Jun 13, 2020 5:32 pm
by PEB
Note: This is an archived post that was originally sent to the Hollywood mailing list on Wed, 26 Oct 2011 20:40:01 -0000

I'm trying to execute a command on a Windows machine through my Hollywood program using Execute(); but Windows thinks I'm trying to find a file or directory with the name of the command. So through the Windows CLI the command "systeminfo >Test.txt" prints the system information to a file; but when I use Execute("systeminfo >Test.txt") through Hollywood, the command is not executed, and I get the following message:

"Windows cannot find 'C:\Users\systeminfo'. Make sure you typed the name correctly, and then try again."

Is there some syntax that I can use to make it clear that I'm trying to execute a command, not find a file?

[26 Oct 2011] Re: Executing a Command in Windows using Execute()

Posted: Sat Jun 13, 2020 5:32 pm
by Clyde
Note: This is an archived post that was originally sent to the Hollywood mailing list on Wed, 26 Oct 2011 23:10:23 +0200

Hi!

Two things come to my mind: 1. Is your file systeminfo located under C:\Users? If not, I guess you have to pass the complete path to the file. 2. I would suggest to give systeminfo a suitable file extension. What kind of programme is it? A binary one/exe? The call it systeminfo.exe. Or a .bat? Then go for systeminfo.bat. On Windows, much is ruled by the file extension. I assume this is your problem. Hollywood does not search for the file explictly, it just wants to execute it but then recognizes, that it cannot find it - thus the error message.

I hope, that helps!

Regards!

[26 Oct 2011] Re: Executing a Command in Windows using Execute()

Posted: Sat Jun 13, 2020 5:32 pm
by PEB
Note: This is an archived post that was originally sent to the Hollywood mailing list on Wed, 26 Oct 2011 14:22:02 -0700 (PDT)

systeminfo isn't a file; it's a command. (Try it in a Windows CLI.)

[28 Oct 2011] Re: Executing a Command in Windows using Execute()

Posted: Sat Jun 13, 2020 5:32 pm
by Yvan
Note: This is an archived post that was originally sent to the Hollywood mailing list on Fri, 28 Oct 2011 11:03:13 +0100

Hello Rev.

It is a file. On my Windows 7 machine the path is:

c:\windows\system32\systeminfo.exe

[28 Oct 2011] Re: Re: Executing a Command in Windows using Execute()

Posted: Sat Jun 13, 2020 5:32 pm
by PEB
Note: This is an archived post that was originally sent to the Hollywood mailing list on Fri, 28 Oct 2011 06:48:32 -0700 (PDT)

So I'm still wondering if there is a way to execute a Windows CLI command using Execute() in Hollywood, such as: Execute("dir >Test.txt")

[28 Oct 2011] Re: Re: Executing a Command in Windows using Execute()

Posted: Sat Jun 13, 2020 5:32 pm
by PEB
Note: This is an archived post that was originally sent to the Hollywood mailing list on Fri, 28 Oct 2011 07:17:03 -0700 (PDT)

Also, Execute("c:\windows\system32\systeminfo.exe >Test.txt") does not produce the file "Test.txt" as it should.

[28 Oct 2011] Re: Re: Executing a Command in Windows using Execute()

Posted: Sat Jun 13, 2020 5:32 pm
by airsoftsoftwair
Note: This is an archived post that was originally sent to the Hollywood mailing list on Fri, 28 Oct 2011 23:06:52 +0200
Also, Execute("c:\windows\system32\systeminfo.exe >Test.txt") does not produce the file "Test.txt" as it should.
Windows does this differently than AmigaOS. In fact, there are two types of Windows executables: Console programs and Windows programs. Redirecting output of a console program to a file is done by Windows' console handler. It's not part of the system as it's on AmigaOS. You could try to work around this limitation by creating a *.bat file which does the job and passing this *.bat file to Execute(), i.e. put the following line in a *.bat:

Code: Select all

c:\windows\system32\systeminfo.exe >Test.txt
And then run Execute("test.bat") from Hollywood. Should work because running a *.bat file will invoke the console handler.

[28 Oct 2011] Re: Re: Executing a Command in Windows using Execute()

Posted: Sat Jun 13, 2020 5:32 pm
by PEB
Note: This is an archived post that was originally sent to the Hollywood mailing list on Fri, 28 Oct 2011 16:54:59 -0700 (PDT)

Yep, that worked. Thanks! (I never would have thought to try that.)

[29 Oct 2011] Re: Re: Executing a Command in Windows using Execute()

Posted: Sat Jun 13, 2020 5:32 pm
by airsoftsoftwair
Note: This is an archived post that was originally sent to the Hollywood mailing list on Sat, 29 Oct 2011 11:26:44 +0200
Yep, that worked. Thanks! (I never would have thought to try that.)
Good. Keep in mind though that systeminfo.exe is not installed on every Windows PC. I'm running the Home Edition of XP here and I don't have that command at all. According to Google it's only included with the Professional Edition of XP... only Microsoft knows why.