ellandrd
asked on
use PHP to run .vbs file from command line
is the above possible?
ASKER
for some reason, i cannot get anything to work for work either in PHP or ASP... and im getting pi*sed off now as i need to get this the .vbs file to run somehow
Ok.
Go to the command line.
CD to the directory containing your test.vbs
type
test 1.2.3.4
What happens?
Does it work?
Do you have to type
test.vbs 1.2.3.4
Or do you have to type
cscript test.vbs 1.2.3.4
Go to the command line.
CD to the directory containing your test.vbs
type
test 1.2.3.4
What happens?
Does it work?
Do you have to type
test.vbs 1.2.3.4
Or do you have to type
cscript test.vbs 1.2.3.4
ASKER
>>Go to the command line.
>>CD to the directory containing your test.vbs
>>type
>>test 1.2.3.4
>>What happens?
I get line 4, invalid charactor.
test.vbs
=================
Option Explicit
Dim StrComputer
strComputer = Command$
>>CD to the directory containing your test.vbs
>>type
>>test 1.2.3.4
>>What happens?
I get line 4, invalid charactor.
test.vbs
=================
Option Explicit
Dim StrComputer
strComputer = Command$
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
C:\Inetpub\wwwroot>cscript test.vbs 192.168.0.79
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
C:\Inetpub\wwwroot\test.vb s(92, 3) Microsoft VBScript runtime error: The remote server machine does not exist or is unavailable: 'GetObject'
C:\Inetpub\wwwroot>
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
C:\Inetpub\wwwroot\test.vb
C:\Inetpub\wwwroot>
ASKER
OK.
i used an IP address that doe exist and it worked fine.
i have now tried:
echo (shell_exec("test.vbs 192.168.0.2" )) ? "worked" : "failed";
and PHP page just hangs...
i used an IP address that doe exist and it worked fine.
i have now tried:
echo (shell_exec("test.vbs 192.168.0.2" )) ? "worked" : "failed";
and PHP page just hangs...
Eek! Probably a permissions issue.
That's because of the msgbox. Remove that.
ASKER
ok, btw
ASKER
ive took out the msgbox code and it still hangs... ive tried on my workstation and on server and both hang...
ASKER
do i have to use the full path ?
like:
shell_exec("C:\Inetpub\www root\test. vbs 192.168.0.2" );
i have also tried:
exec("C:\Inetpub\wwwroot\t est.vbs 192.168.0.2" );
still no go...
like:
shell_exec("C:\Inetpub\www
i have also tried:
exec("C:\Inetpub\wwwroot\t
still no go...
ASKER
ive given test.vbs full permissions too
ASKER
i dont seem to be able to run anything on the command line using PHP
What is the VB script going to do with the value? Do that in PHP.
ASKER
my VBS file lists all the installed software on the users machine using an IP address. its for an intranet application.
ASKER
any other ideas/options?
ASKER
can PHP run a BAT file?
ASKER
still no working, so im just stick to ASP to see if i can get this working...
If you can run the vbs script from the cli WITHOUT having to provide a program to run it ...
c:\>test.vbs 1.2.3.4
and that works, then ...
<?php
exec('test.vbs 1.2.3.4');
?>
should work.
Regards,
Richard Quadling.