Quantcast
Channel: Excel IT Pro Discussions forum
Viewing all articles
Browse latest Browse all 11829

How to switch CMD windows and execute a program using VB script or excel VBA

$
0
0

I want to open a cmd utility placed at C:\Users\R127609\Desktop\Automation\Cucumber\ansi160\x64\ansicon.exe and execute below two DOS commands using VB script.

Commands,

1.CD C:\Users\R127609\Desktop\Automation\Cucumber\ruby-1.9.3-p551-i386-mingw32\ruby-1.9.3-p551-i386-mingw32\bin 'change the directory

2.cucumber C:\Users\R127609\Desktop\Automation\Cucumber\FeatureFiles\Lib_Max_Create_Lead.feature 'execute a script

Code i am using is -

Set owshell = CreateObject("Wscript.Shell")

cmd0 = "C:\Users\R127609\Desktop\Automation\Cucumber\ansi160\x64\ansicon.exe" 'for switching the cmd window

cmd1 = "cd C:\Users\R127609\Desktop\Automation\Cucumber\ruby-1.9.3-p551-i386-mingw32\ruby-1.9.3-p551-i386-mingw32\bin" 'for changing the directory to ruby set up

cmd2 = "cucumber  C:\Users\R127609\Desktop\Automation\Cucumber\FeatureFiles\Lib_Max_Create_Lead.feature" 'for executing a script

'Execute the command

owshell.Run "%comspec% /K pushd " & "&" & cmd0 & "&" & cmd1 & "&" & cmd2

When i execute the above statement from a VBS file,its swtiching the window using cmd0,but the second(cmd2) & third(cmd3) commands are not getting executed.Can some one help me to correct the mistake?

Thanks in Advance

Sona Shetty



Viewing all articles
Browse latest Browse all 11829

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>