Answer = LCase(InputBox("Your Answer:", ""))
If Len(Answer) Then
Dim objFSO, outFile
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set outFile = objFSO.CreateTextFile("run.bat", True)
outFile.WriteLine "Your answer is: "
outFile.WriteLine """Answer"
outFile.Close
WScript.Echo "Done."
End If
答案 0 :(得分:4)
当然,您只需要删除此行中的双引号:
outFile.WriteLine """Answer"
以便将变量Answer
的值写入文件而不是字符串"Answer
:
outFile.WriteLine Answer
如果您生成如下输出,您甚至可以使答案显示在与文本Your answer is:
相同的行中:
outFile.Write "Your answer is: "
outFile.WriteLine Answer
或者像这样:
outFile.WriteLine "Your answer is: " & Answer