dim updcmd
updcmd = "c:\\CPLUS\\DIAG C:\\cplus\\input\\test2.txt"
Dim WshShell, oExec
Set WshShell = CreateObject("WScript.Shell")
Set oExec = WshShell.Exec(updcmd)
Do While oExec.Status = 0
WScript.Sleep 1000
Loop
The problem is, it processes 1000 records(out of 50K) and just hangs.
The program works fine from the command line.
Any help is greatly appreciated.
Thanks in advance.
Sath
Try the Run option and enable the wait on return?
WshShell.Run updcmd, 1, 1
That eliminates your need to set a loop to sleep and wait on the
execution.
If this is VB script, you don't need to use the double backslash escape in
strings.
-Pete
Or, since you are in a loop, and you are using the .Exec method,
why not process stdOut so you can see what is going on ?
dim updcmd
updcmd = "%comspec% /c c:\CPLUS\DIAG C:\cplus\input\test2.txt 2>&1"
Dim WshShell, oExec
Set WshShell = CreateObject("WScript.Shell")
Set oExec = WshShell.Exec(updcmd)
Do While Not oExec.StdOut.AtEndOfStream
WScript.Echo oExec.StdOut.ReadLine
Loop
TDM
If I am not wrong, the help file says stdin and stdout work only in cscript. But in XP,
stdout is available in wscript too. This is great.
With win ME stdout in wscript causes an error.
Giovanni.
--
Giovanni Cenati (Aosta, Italy)
Write to user "Reventlov" and domain at katamail com
http://digilander.libero.it/Cenati (Esempi e programmi in VbScript)
--
I suppose it is possible that the CScript/WScript difference could be
OS-related, but I think it more likely that it is due to a difference in the
scripting engine.
Do you get the same value on all machines with this statement?
WScript.Echo WScript.Version
-Paul Randall
>I suppose it is possible that the CScript/WScript difference could be
>OS-related, but I think it more likely that it is due to a difference in the
>scripting engine.
>
>Do you get the same value on all machines with this statement?
>
>WScript.Echo WScript.Version
it's 5.6 in win ME. I still have to check on XP pc's.
--
Giovanni Cenati (Aosta, Italy)
Write to user "Reventlov" and domain at katamail com
http://digilander.libero.it/Cenati (Esempi e programmi in VbScript)
--
Perhaps you are correct that it is a problem in older OSs.
-Paul Randall
Hi ,
I am using javascript.
I want to execute a perl program.
can perl be direclty executed?
As of now I am using bat file containing the perl command
The code I use is on button click
var WshShell = new ActiveXObject("WScript.Shell");
WshShell.Run("%comspec% /c D:\GUP-501\rulegen1\t.bat");
WshShell.Quit;
-----------------------------
bat file is
perl D:\GUP-501\rulegen1\rulegenerator.pl -v V1 -t FS5K -f
D:\GUP-501\rulegen1\RgApplicationConfig.xml -b
This is not working, can anybody help me on it.
*** Sent via Developersdex http://www.developersdex.com ***
> "Paul Randall" <paul...@cableone.net>
>>> If I am not wrong, the help file says stdin and stdout work only in
>>> cscript. But in XP,
>>> stdout is available in wscript too. This is great.
>>I suppose it is possible that the CScript/WScript difference could be
>>OS-related, but I think it more likely that it is due to a difference in the
>>scripting engine.
>>Do you get the same value on all machines with this statement?
>>WScript.Echo WScript.Version
it's 5.6 in both XP and win ME.
The following script works in xp (Windows 5.1 service pack 2) with a double click.
In ME (on my pc is not very stable, recently) i get an error but I don't remember what it
says.
Set WshShell = CreateObject("Wscript.shell")
Set objExec= WshShell.Exec("%comspec% /c dir c:\")
output = objExec.StdOut.ReadAll
MsgBox output
but vbscript56.chm says (about readall method):
"
The StdIn, StdOut, and StdErr properties and methods work when running the script with the
CScript.exe host executable file only. An error is returned when run with WScript.exe.
There is no error. But the msg box is empty with win ME. I got an error but it was due to
the SORT command I was calling in a different example.
Well, it's not a problem. I'm happy to access stdout even if the help file says it cannot
be done. It's very useful. It's a problem that I cannot use it at home on win ME.
Giovanni.