C# 如何自动导航到 {GUID} 目录?
我有一个程序,它利用第三方工具来创建日志文本文件。
但是该工具需要Windows XP的还原点目录。存储还原点的目录是“C:\System Volume Information_restore{GUID}”。
_restore{GUID} 文件夹将包含所有还原点。然而,{GUID} 是完全随机的数字,并且对于每台计算机来说都是不同的。 “C:\System Volume Information”目录通常只包含 1 个文件夹,即“_random{GUID}”文件夹。
那么有没有办法让C#程序使用任何代码或方法来自动填充工具的命令参数呢?
有人可以建议一下代码吗?谢谢!
代码:
Process process = new Process();
process.StartInfo.FileName = @"C:\test\ftk\ripxp\ripxp.exe";
// How to automatically navigate to the {GUID} folder?
process.StartInfo.Arguments = @"-r C:\test\ftk\ntuser.dat -d C:\System Volume Information\_restore{GUID} -p runmru";
process.StartInfo.CreateNoWindow = false;
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardInput = true;
process.StartInfo.RedirectStandardError = true;
process.Start();
第 3 方工具 (2008 H. Carvey) 参数:
C:\>ripxp -r d:\cases\ntuser.dat -d d:\cases\svi -p userassist
I have a program which utilizes a 3rd party tool to create a log text file.
However the tool requires the restore point directory of windows XP. The directory that stores the Restore points is the "C:\System Volume Information_restore{GUID}".
The _restore{GUID} folder would contain all the restore points. However the {GUID} are totally random numbers and are different for each computers. The "C:\System Volume Information" directory would only usually contain 1 folder which is the "_random{GUID}" folder.
Therefore is there a way for the C# program to use any codes or methods to automatically fill in the command arguments for the tool?
May someone please advise on the codes? Thanks!
The codes:
Process process = new Process();
process.StartInfo.FileName = @"C:\test\ftk\ripxp\ripxp.exe";
// How to automatically navigate to the {GUID} folder?
process.StartInfo.Arguments = @"-r C:\test\ftk\ntuser.dat -d C:\System Volume Information\_restore{GUID} -p runmru";
process.StartInfo.CreateNoWindow = false;
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardInput = true;
process.StartInfo.RedirectStandardError = true;
process.Start();
The 3rd party tool (2008 H. Carvey) Arguments:
C:\>ripxp -r d:\cases\ntuser.dat -d d:\cases\svi -p userassist
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
此代码显示如何获取最近创建的 _restore 目录:
This code shows how to get the most recently created _restore directory:
为什么不查询该文件夹位置并循环浏览目录列表以找到以“_restore”开头的文件夹,然后将其插入到您的参数中?
然后您应该能够将该文件夹值插入到您的参数中
Why not query that folder location and loop through the list of directories to find the folder that starts with "_restore" and then plug that into your argument?
Then you should be able to plug that folder value into your argument