1

次の構文で test.vbs を正常に実行できます。

Dim WshShell
Set WshShell = CreateObject("WScript.Shell")

sEXE = """\\uncpath\file.exe"""
with CreateObject("WScript.Shell")
  .Run sEXE & " ", 1, true ' Wait for finish or False to not wait
end with

ただし、出力をに保存したい\\\uncpath\%computername%.txt

これは機能しません:

sEXE = """\\uncpath\file.exe>>\\uncpath\%computername%.txt"""
with CreateObject("WScript.Shell")
  .Run sEXE & " ", 1, true ' Wait for finish or False to not wait
end with

次の行のエラー: with CreateObject("WScript.Shell")

これもうまくいきません。

sEXE = """\\uncpath\file.exe"""
with CreateObject("WScript.Shell")
  .Run sEXE & " >>\\uncpath\%computername%.txt", 1, true ' Wait for finish or False to not wait
end with

助けはありますか?

4

1 に答える 1