2010-10-27 50 views
5

是否可以在批處理文件中嵌入VBScript?在Windows批處理文件中嵌入VBScript

我現在有一個調用使用

cscript //NoLogo MyScript.vbs 

一個.VBS文件.cmd文件,但我寧願發佈只是一個單一的.cmd文件。


編輯:有是如何做到這一點的回答過類似的問題,而不會生成中間文件都:Is it possible to embed and execute VBScript within a batch file without using a temporary file?

+0

發現一個有趣的黑客攻擊,其中一個批次腳本掃描自己的標籤(這是VBScript),並將其寫出到一個新的VBS文件,它執行http://www.computerhope.com/forum/index.php?topic=103686.0 – 2010-10-27 21:15:09

+0

謝謝你很mu ch – lrl 2013-10-18 19:21:41

+0

[可以在不使用臨時文件的情況下在批處理文件中嵌入和執行VBScript嗎?](http://stackoverflow.com/questions/9074476/is-it-possible-to-embed-and-執行-vbscript-a-batch-file-without-using-a) – aschipfl 2016-10-06 12:20:42

回答

8

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 
+0

是的,找到了。 – 2010-10-27 21:33:38

+0

谷歌工作得很好,呃? – drudge 2010-10-27 21:47:26