ResGen.exe的VBscript日志响应

ResGen.exe的VBscript日志响应,vbscript,logfile,resgen,Vbscript,Logfile,Resgen,我正在使用VBScript使用ResGen.exe生成资源文件,需要收集ResGen的错误消息并将其写入文件,已控制文件写入的部分(此处显示的脚本中未显示,但我知道如何执行) 在objShell.Run行之后,我需要放置什么来保存这个命令的响应?我尝试在命令后添加“>>”C:\log.txt“”,但使用此命令不会生成资源文件,只将响应保存在txt文件中 希望我解释正确 提前谢谢 您可以使用“Exec”方法来获取WSHScript Exec对象,并使用它的StdOut来获取命令的响应,如下所示:

我正在使用VBScript使用ResGen.exe生成资源文件,需要收集ResGen的错误消息并将其写入文件,已控制文件写入的部分(此处显示的脚本中未显示,但我知道如何执行)

在objShell.Run行之后,我需要放置什么来保存这个命令的响应?我尝试在命令后添加“>>”C:\log.txt“”,但使用此命令不会生成资源文件,只将响应保存在txt文件中

希望我解释正确

提前谢谢

您可以使用“Exec”方法来获取WSHScript Exec对象,并使用它的StdOut来获取命令的响应,如下所示:

包含这些文件的文件夹 folderpath=“C:\Users\Administrator\Desktop\Author\Author\” '从生成的文件中删除目标文件夹 destfolder=“C:\Users\Administrator\Desktop\Author\Author\” '文件夹包含包含文件名列表的文本文件 listfolder=“C:\Users\Administrator\Desktop\Author\” listfile=listfolder+“list.txt” logfile=listfolder+“log.txt” resgen=“resgen.exe/compile” 设置objShell=CreateObject(“WScript.Shell”) 常数ForReading=1 设置objFSO=CreateObject(“Scripting.FileSystemObject”) Wscript.echo列表文件 设置objFile=objFSO.OpenTextFile(listfile,ForReading) Wscript.echo“读取文件” 当objFile.AtEndOfStream=False时执行 strLine=objFile.ReadLine cmdexec=Chr(34)+文件夹路径+strLine+“resx”+Chr(34)+“+Chr(34)+destfolder+strLine+“资源”+Chr(34) execomand=resgen+“”+cmdexec '*************************************** 设置oExec=objShell.Exec(execomand) 当oExec.Status=0时执行 WScript.Sleep 1000 环 WScript.Echo oExec.StdOut.ReadLine '*************************************** 环 objFSO.关闭
'' 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