can someone help me? This vbs script create a run.bat but I need in run.bat second line Answer from InputBox on start of vbs script. It is possible?
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
Sure, you just need to remove the double quotes from this line:
outFile.WriteLine """Answer"
so that the value of the variable Answer
is written to the file instead of the string "Answer
:
outFile.WriteLine Answer
You can even make the answer appear on the same line as the text Your answer is:
if you generate the output like this:
outFile.Write "Your answer is: "
outFile.WriteLine Answer
or like this:
outFile.WriteLine "Your answer is: " & Answer