cmacrun Posted March 16, 2005 Share Posted March 16, 2005 Hey guys/gals, I hope that this is an easy question and probably just a formatting issue.... I have a vbs file that is located at a location which is stored in the variable $VBSPath. I am trying to execute the vbs file within a script using cscript.exe. I found some other posts in regards to vbs files and cscript but none of them talk about having the path to the vbs file in a variable(at least that I could find). I have tried a whole slew of different combinations of the following command but I'll just include the one I have entered at the moment. RunWait(@Comspec & " /c cscript.exe " & $VBSPath, @SW_HIDE) Thanks in advance! Link to comment Share on other sites More sharing options...
DaveF Posted March 16, 2005 Share Posted March 16, 2005 Hey guys/gals, I hope that this is an easy question and probably just a formatting issue....I have a vbs file that is located at a location which is stored in the variable $VBSPath. I am trying to execute the vbs file within a script using cscript.exe. I found some other posts in regards to vbs files and cscript but none of them talk about having the path to the vbs file in a variable(at least that I could find). I have tried a whole slew of different combinations of the following command but I'll just include the one I have entered at the moment.RunWait(@Comspec & " /c cscript.exe " & $VBSPath, @SW_HIDE)Thanks in advance!I'm going to go ahead and assume that you're having an error when you run your command. Again assuming that you're assigning a path to a VBS script to the $VBSPath variable, a fairly likely cause for error is that there's a space or other problem character in the path to the script file. You can double-quote the path by using pairs of " characters inside the string declarations, or else declare your strings using single ' quote characters which will let you use " characters inside the strings.$VBSPath = "G:\foo\problem name.vbs" RunWait(@Comspec & ' /c cscript.exe "' & $VBSPath & '"', @SW_HIDE)You also know that if there's any GUI functionality in your VBS script that you have to use WSCRIPT.EXE? Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines. Link to comment Share on other sites More sharing options...
cmacrun Posted March 17, 2005 Author Share Posted March 17, 2005 See, I knew it was just a formatting issue! Thanks Dave. I did have to mod your code due to another formatting issue, Didn't include the "" for the path info runwait requires. Final code: $VBSPath = "G:\foo\problem name.vbs" RunWait(@Comspec & ' /c cscript.exe "' & $VBSPath & '"', "",@SW_HIDE) Thanks again! Link to comment Share on other sites More sharing options...
cu0x Posted February 13, 2018 Share Posted February 13, 2018 $VBSPath = "G:\foo\problem name.vbs" You can use ShellExecuteWait("cscript.exe", $VBSPath ,"","",@SW_HIDE) as well Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 13, 2018 Moderators Share Posted February 13, 2018 cu0x, You obviously did not notice that the post above yours was made nearly 13 years ago. Please do not necro-post like this again. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts