Run a command and capture the output in vbscript

后端 未结 1 501
慢半拍i
慢半拍i 2021-01-29 05:08

I am trying to run the following command and return the output of it using VBscript:

dir /A-d \"C:\\Windows\\Minidump\" | find /c \"/\"

And I h

1条回答
  •  庸人自扰
    2021-01-29 05:26

    1. dir is intrinsic; you need %comspec%.
    2. Double quotes need to be escaped by double double quotes in VBScript:

      Wscript.Echo runCMD("%comspec% /c dir /A-d ""C:\Windows\Minidump"" | find /c ""/""")
      

    0 讨论(0)
提交回复
热议问题