wsh - using SET in VBscript command -


i'm trying run vbscript runs command line statement contains word set in cmd line command. vbscript recognizing reserved word , giving error:

expected ')'

the command i'm trying run in vbscript is:

objshell.run(appcmd set config /section:isapifilters /-[name='jakartaxapi']) 

how can escape reserved word?

microsoft vbscript compilation error: expected ')' syntax error.

run method requires first argument string subtype , given space-delimited word sequence can't reckoned string. need enclose in quotation marks (" ").

run method (windows script host)

runs program in new process.

syntax

object.run(strcommand, [intwindowstyle], [bwaitonreturn])  

arguments

  • object wshshell object.
  • strcommand string value indicating command line want run. must include parameters want pass executable file.
  • intwindowstyle optional. integer value indicating appearance of program's window. note not programs make use of information.
  • bwaitonreturn optional. boolean value indicating whether script should wait program finish executing before continuing next statement in script. if set true, script execution halts until program finishes, , run returns error code returned program. if set false (the default), run method returns after starting program, automatically returning 0 (not interpreted error code).

use

objshell.run "appcmd set config /section:isapifilters /-[name='jakartaxapi']" 

or

appcmd = "path\to\someapp.exe" objshell.run appcmd & " set config /section:isapifilters /-[name='jakartaxapi']" 

Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -