-2

For some reason my code brings up an error stating that

Script: startup.vbs

Line: 10

Char: 2

Error: Invalid procedure call or argument

Code: 800A0005

Source: Microsoft VBScript Runtime Error

My code that I used: THE CODE

1 Answers1

-1

With vague details... This is how I've used variables with Wscript Shell Run.

Sub RunCommand(command)
    cmd = "cmd /c "" & command & """"
    set shell=createobject("wscript.shell")
    shell.run cmd
    set shell=nothing
End Sub

I would definitely say the code you provided has quite a few deficiencies in how it works and misuse of Subroutines versus Functions. Functions return something and subroutines do not.

iecho is regurgitating an entire string "vbyes parent:child true" and not truely the "child" value you're desiring since it doesn't operate like that. There's other things but you asked how to use variables for functions. There ya go. :)

Steve Kline
  • 805
  • 4
  • 11
  • What code kind is it cmd = "cmd /c "" & command & """""" Do I use batch code for the cmd var or vbscript? – thatjsonkid Sep 22 '21 at 14:43
  • Why so many quotes after? Should be `""""` shouldn’t it? – user692942 Sep 22 '21 at 21:07
  • @thatjsonkid - as user692942 point out, it should be `""""` but that executes command in command prompt. It was an example of arguments / variables. CMD just also happens to be a the executable to run things in command prompt. – Steve Kline Sep 23 '21 at 02:43