我已经在Windows中安装了olevba,因此,我可以在命令提示符下运行它,从vbaProject.bin
检索VBA宏:
现在,我想在Visual Studio中启动它,因此添加了以下代码:
public static void printMacros()
{
Process p = new Process();
p.StartInfo.FileName = "python.exe";
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.UseShellExecute = false;
p.StartInfo.Arguments = "../../oletools-0.46/oletools/olevba.py ../../oletools-0.46/oletools/vbaProject.bin";
p.Start();
StreamReader s = p.StandardOutput;
String output = s.ReadToEnd();
string[] r = output.Split(new char[] { ' ' });
Console.WriteLine(r[0]);
p.WaitForExit();
}
但是,汇编并没有很好地显示结果:
请注意,p.StartInfo.Arguments
中的路径../../oletools-0.46/oletools/olevba.py
是正确的,否则将引发No such file or directory
错误;而将第二个参数../../oletools-0.46/oletools/vbaProject.bin
更改为不相关的文件总是返回相同的结果。在
有人知道这里怎么了吗?在
目前没有回答
相关问题 更多 >
编程相关推荐