vbscript - Calling and executing vb script by opening command prompt through Batch file -
i complete amateur when comes vb scripting or command line please bear me..
i have created vb script send.vbs sending keys using wshshell.sendkeys. in script, going vshell using vsh command, 2 options after enter vsh, out of select option 2, , executing command output redirected text file. ftp file diferent server. want schedule vb script run every 10 min. now, if double click script file, opens black window moment , shuts down. commands not executed. when open command window manually , go path script , execute it, works fine , desired output.
i tried writing batch file cscript send.vbs , scheduling same run every 10 min. batch file not run vbscript. can any1 me write batch fiel open command prompt , run thi vb script in command prompt. script follows:
set wshshell = wscript.createobject("wscript.shell") wshshell.sendkeys "vsh" wshshell.sendkeys "{enter}" wshshell.sendkeys "2" wshshell.sendkeys "{enter}" wshshell.sendkeys "tls display agents > agentstat.txt" wshshell.sendkeys "{enter}" wshshell.sendkeys "quit" wshshell.sendkeys "{enter}"
any highly appreciated.. !!
here go ...
set wshshell = wscript.createobject("wscript.shell") wshshell.run "cmd" wscript.sleep 100 wshshell.appactivate "c:\windows\system32\cmd.exe" wscript.sleep 100 wshshell.sendkeys "vsh" wshshell.sendkeys "{enter}" wshshell.sendkeys "2" wshshell.sendkeys "{enter}" wshshell.sendkeys "tls display agents > agentstat.txt" wshshell.sendkeys "{enter}" wshshell.sendkeys "pause" wshshell.sendkeys "{enter}" wshshell.sendkeys "quit" wshshell.sendkeys "{enter}"
Comments
Post a Comment