0
我正在使用ResGen.exe生成资源文件并需要收集ResGen的错误消息并将其写入文件,并控制了文件写入部分(是不存在脚本显示在这里,但我知道如何做到这一点)ResSen.exe的VBscript日志响应
'' Folder that contains the files
folderpath = "C:\Users\Administrator\Desktop\Author\author\"
'Destination folder from generated files
destfolder = "C:\Users\Administrator\Desktop\Author\author\"
'Folder contains the text file with list of files names
listfolder = "C:\Users\Administrator\Desktop\Author\"
listfile = listfolder + "list.txt"
logfile = listfolder + "log.txt"
resgen = "ResGen.exe /compile"
Set objShell = CreateObject("WScript.Shell")
Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Wscript.echo listfile
Set objFile = objFSO.OpenTextFile(listfile, ForReading)
Wscript.echo "Reading file"
Do While objFile.AtEndOfStream = False
strLine = objFile.ReadLine
cmdexec = Chr(34) + folderpath + strLine + "resx" + Chr(34) + " " + Chr(34) + destfolder + strLine + "resources" + Chr(34)
execommand = resgen + " " + cmdexec
objShell.Run execommand,1,TRUE
Loop
objFSO.Close
objShell.Run行之后,我需要把保存这个命令的响应?我已经尝试在命令后添加“>>”C:\ log.txt“”,但是由于没有生成资源文件,只能将响应保存在txt文件中。
希望我解释得很对。
在此先感谢!