dazm
September 23, 2013, 6:23am
1
Hello everyone, and I’m back to you with a request.
I have a VBS script.
It returns in output a simple numeric value.
But when I integrat it with the dude, I’m getting strange symbols.
Look at the screenshot to better understand what I mean.
How to fix that?
dazm
September 23, 2013, 8:55am
2
My VBscript:
option explicit
Set oShell = CreateObject("WScript.Shell")
Set Args = WScript.Arguments
Dim strCmd, strCmd1, ret, oShell, Args, oScriptExec, oScriptExec1, OutStream
strCmd = "cmd /c echo y | c:\distr\putty\plink.exe -l sysadmin -i c:\distr\putty\priv_key.ppk " & Args(0) & " -m c:\work\ftp_check\cmd.txt"
'in "cmd.txt" : "exit"
strCmd1= "c:\distr\putty\plink.exe -l sysadmin -i c:\distr\putty\priv_key.ppk " & Args(0) & " -m c:\work\ftp_check\cmd1.txt"
'in "cmd1.txt" : "ls -lA /home/usr1cv82/1c/localstore/w2s|grep -c "^-""
oShell.Run(strCmd)
Set oScriptExec1 = oShell.Exec(strCmd1)
ret = vbNullString
ret = ret&oScriptExec1.StdOut.ReadLine()
'ret = oScriptExec1.StdOut.ReadAll - That was before, where 4 incorrect characters in StdOut
if ret = 0 then
Wscript.Echo "0"
WScript.Quit(0)
Else
Wscript.Echo ""&ret&" "
WScript.Quit(1)
End If
Set oShell = Nothing
And now it looks