Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
jagannalla
Partner - Specialist III
Partner - Specialist III

How to call command prompt script in Vb script

Hi All,

I want to call command prompt script in vb script.

For eg: We can place reload command in bat file and when we run bat file it will load the qv file.

Similar to that when I click the button I want to run command prompt code directlyI don't want to create bat file to run the command prompt code.

- I only don't want to run reload command.

- I want to run my own command prompt available, let say xcopy or copy, writing csv file. etc.

Thanks,
Jagan

6 Replies
Peter_Cammaert
Partner - Champion III
Partner - Champion III

I'm not sure if I tuly understand your requirement. Is your VBScript a stand-alone program, or is it embedded in a QVW document?

In VBScript, there is a WShell object that lets you execute DOS commands as if you opened a CMD window. Look around the internet for more information, there must be thousands of examples.

Best,

PEter

tresesco
MVP
MVP

Google it, you would find examples like:

dim filesys
set filesys=CreateObject("Scripting.FileSystemObject")
If filesys.FileExists("c:\sourcefolder\anyfile.html") Then
filesys.CopyFile "c:\sourcefolder\anyfile.html", "c:\destfolder\"
End If

jagannalla
Partner - Specialist III
Partner - Specialist III
Author

Hi,

I want to run,

the below command

curl -u username:Test@345 -F "token_id=918080a1-cabb-45fa-8aee-ee496fa896bb"  http://demo.XXXXX.com/rest-api/v1/getPredictions/?format=json

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Use something like:


Set oShell = WScript.CreateObject("WSCript.shell")
oShell
.run
"curl -u username:Test@345 -F " & chr(34) &

           "token_id=918080a1-cabb-45fa-8aee-ee496fa896bb" & chr(34) &

           " http://demo.XXXXX.com/rest-api/v1/getPredictions/?format=json"

jagannalla
Partner - Specialist III
Partner - Specialist III
Author

Hi Peter Cammaert,

It gives syntax error.

Thanks,

Jagan

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Where?