Passing-variable-from-vbscript-to-batch-file with arguments

I think what you’re looking for is this.

shell.run "job.bat ""argfile.ext"" " & inp

However, as Ansgar Wiechers points out, this is a potentially severe security hole, as a treacherously crafted XML file could run arbitrary commands. To encapsulate your batch file arguments and prevent unintended consequences, consider switching to the Shell.Application object’s ShellExecute method.

For Each listElement In xmlDoc.selectNodes("document/Lists/list")

    msgbox "toto"
    inp = listElement.selectSingleNode("entry").text
    out = listElement.selectSingleNode("output").text
    jeton = listElement.selectSingleNode("token").text

    set shell=CreateObject("Shell.Application") 
    shell.ShellExecute "job.bat", """a file"" " & inp, "path\to\batfile\", "runas", 1
    set shell=nothing 

Next 

Leave a Comment