代码之家  ›  专栏  ›  技术社区  ›  sourcenouveau

在Windows批处理文件中嵌入vbscript

  •  5
  • sourcenouveau  · 技术社区  · 14 年前

    是否可以在批处理文件中嵌入vbscript?

    我当前有一个.cmd文件,它使用

    cscript //NoLogo MyScript.vbs
    

    但我宁愿只分发一个.cmd文件。


    编辑 :对于如何在不生成中间文件的情况下执行此操作,存在一个类似的问题,并给出了答案: Is it possible to embed and execute VBScript within a batch file without using a temporary file?

    1 回复  |  直到 8 年前
        1
  •  8
  •   drudge    14 年前

    http://www.computerhope.com/forum/index.php?topic=103686.0

    @echo off
    echo This is batch
    :wscript.echo "This VBScript"
    :wscript.echo "Today is " & day(date) & "-" & month(date) & "-" & year(date)
    findstr "^:" "%~sf0">temp.vbs & cscript //nologo temp.vbs & del temp.vbs
    echo This is batch again