Code Comments
Programming Forum and web based access to our favorite programming groups.On my WinXP Pro system with PHP 5.0.4 CLI
(command line interface), if I do
$ver = shell_exec("ver");
it will return the correct value
(e.g. Microsoft Windows XP [Version 5.1.2600])
but there will be a flashy thingy on the screen, and
like the guy said in MIB, I don't like flashy thingies.
How can I get that command to run sychronously
without showing me the DOS box (CMD window) that
it uses? Oh, I should mention that I don't want
to create a (separate) file to do this.
Thanks for any tips,
Csaba Gabor from Vienna
Post Follow-up to this message"Csaba Gabor" <csaba@z6.com> wrote in message
news:e55ae.14239$0z2.9588@news.chello.at...
> On my WinXP Pro system with PHP 5.0.4 CLI
> (command line interface), if I do
>
> $ver = shell_exec("ver");
>
> it will return the correct value
> (e.g. Microsoft Windows XP [Version 5.1.2600])
> but there will be a flashy thingy on the screen, and
> like the guy said in MIB, I don't like flashy thingies.
>
> How can I get that command to run sychronously
> without showing me the DOS box (CMD window) that
> it uses? Oh, I should mention that I don't want
> to create a (separate) file to do this.
Why do you want to know what system your server is running? Can't you
hardcode it, and update if you ever change the servers OS?
--
Welcome to Usenet! Please leave tolerance, understanding
and intelligence at the door. They aren't welcome here.
eternal piste erection miuku gmail piste com
Post Follow-up to this messageKimmo Laine wrote: > "Csaba Gabor" <csaba@z6.com> wrote in message > news:e55ae.14239$0z2.9588@news.chello.at... > > > Why do you want to know what system your server is running? Can't you > hardcode it, and update if you ever change the servers OS? Hardcoding? Yikes! - always to be avoided. However, as I mentioned above, this has nothing to do with a server - I am using the command line interface (CLI) version of PHP. This is very useful for automating tasks on PCs if I don't want to use VBScript. On my systems, if I double click on a .PHP file or press enter when it is selected, it gets handed to the CLI PHP.exe. Nifty. The emphasis in this post is not on determining the operating system (one could also use php_uname() for that), but rather on hiding the annoying flashingness of the DOS box. However, the original motivation for wanting to know this was that I want to have a Dialog Box for selecting a directory (not a file) on Windows systems and the CommonDialog FileOpen/SaveAs do not allow you to return a directory (not a very good design decision, if you ask me). Fortunately, there is at least a poor substitute, the browseForFolder method of the Shell.Application COM object. The reason I say poor substitute is that this method is evidently buggy and behaves differently on different versions of windows to the extent that you have to look at different properties and subobjects to get the actual returned directory, if any. This is very nicely documented at: http://groups-beta.google.com/group... /> 737cf0ca1d I have solved the original problem (I think), but this residual question is still something I'd like to figure out. Csaba
Post Follow-up to this message"Csaba Gabor" <csaba@z6.com> kirjoitti viestissä:wk6ae.14363$0z2.9584@news.chello.at... > Kimmo Laine wrote: > > Hardcoding? Yikes! - always to be avoided. However, as I > mentioned above, this has nothing to do with a server - I am > using the command line interface (CLI) version of PHP. > This is very useful for automating tasks on PCs if I don't > want to use VBScript. On my systems, if I double click on a > .PHP file or press enter when it is selected, it gets handed > to the CLI PHP.exe. Nifty. > > The emphasis in this post is not on determining the operating > system (one could also use php_uname() for that), but rather > on hiding the annoying flashingness of the DOS box. > > However, the original motivation for wanting to know this was > that I want to have a Dialog Box for selecting a directory (not > a file) on Windows systems and the CommonDialog FileOpen/SaveAs > do not allow you to return a directory (not a very good design > decision, if you ask me). Fortunately, there is at least a poor > substitute, the browseForFolder method of the Shell.Application > COM object. The reason I say poor substitute is that this > method is evidently buggy and behaves differently on different > versions of windows to the extent that you have to look at > different properties and subobjects to get the actual returned > directory, if any. This is very nicely documented at: > http://groups-beta.google.com/group...> e6737cf0ca1d > I have solved the original problem (I think), but this residual > question is still something I'd like to figure out. > I didn't realize what you were doing. I'm used to think of php as in server only so I thought why does it matter what flashes there, nobodys watching... :) -- "I am pro death penalty. That way people learn their lesson for the next time." -- Britney Spears eternal.erectionN0@5P4Mgmail.com
Post Follow-up to this message"Csaba Gabor" <csaba@z6.com> wrote in message
news:e55ae.14239$0z2.9588@news.chello.at...
> On my WinXP Pro system with PHP 5.0.4 CLI
> (command line interface), if I do
>
> $ver = shell_exec("ver");
>
> it will return the correct value
> (e.g. Microsoft Windows XP [Version 5.1.2600])
> but there will be a flashy thingy on the screen, and
> like the guy said in MIB, I don't like flashy thingies.
>
> How can I get that command to run sychronously
> without showing me the DOS box (CMD window) that
> it uses? Oh, I should mention that I don't want
> to create a (separate) file to do this.
Why do you want to know what system your server is running? Can't you
hardcode it, and update if you ever change the servers OS?
--
Welcome to Usenet! Please leave tolerance, understanding
and intelligence at the door. They aren't welcome here.
eternal piste erection miuku gmail piste com
Post Follow-up to this messageKimmo Laine wrote: > "Csaba Gabor" <csaba@z6.com> wrote in message > news:e55ae.14239$0z2.9588@news.chello.at... > > > Why do you want to know what system your server is running? Can't you > hardcode it, and update if you ever change the servers OS? Hardcoding? Yikes! - always to be avoided. However, as I mentioned above, this has nothing to do with a server - I am using the command line interface (CLI) version of PHP. This is very useful for automating tasks on PCs if I don't want to use VBScript. On my systems, if I double click on a .PHP file or press enter when it is selected, it gets handed to the CLI PHP.exe. Nifty. The emphasis in this post is not on determining the operating system (one could also use php_uname() for that), but rather on hiding the annoying flashingness of the DOS box. However, the original motivation for wanting to know this was that I want to have a Dialog Box for selecting a directory (not a file) on Windows systems and the CommonDialog FileOpen/SaveAs do not allow you to return a directory (not a very good design decision, if you ask me). Fortunately, there is at least a poor substitute, the browseForFolder method of the Shell.Application COM object. The reason I say poor substitute is that this method is evidently buggy and behaves differently on different versions of windows to the extent that you have to look at different properties and subobjects to get the actual returned directory, if any. This is very nicely documented at: http://groups-beta.google.com/group... /> 737cf0ca1d I have solved the original problem (I think), but this residual question is still something I'd like to figure out. Csaba
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.