gpt4 book ai didi

c# - 运行 Process.Start 时无法打开 : c:\users\. ..\temp\package.cab

转载 作者:太空宇宙 更新时间:2023-11-03 15:39:18 25 4
gpt4 key购买 nike

你好,我有这个微软的小脚本:

@echo off
rem *** Author: T. Wittrock, Kiel ***

if not exist "%TEMP%\wsusscn2.cab" (
.\bin\wget.exe -N -i .\static\StaticDownloadLinks-wsus.txt -P "%TEMP%"
if exist "%TEMP%\wuredist.cab" del "%TEMP%\wuredist.cab"
if exist "%TEMP%\WindowsUpdateAgent30-x64.exe" del "%TEMP%\WindowsUpdateAgent30-x64.exe"
if exist "%TEMP%\WindowsUpdateAgent30-x86.exe" del "%TEMP%\WindowsUpdateAgent30-x86.exe"
)
if exist "%TEMP%\package.cab" del "%TEMP%\package.cab"
if exist "%TEMP%\package.xml" del "%TEMP%\package.xml"
%SystemRoot%\System32\expand.exe "%TEMP%\wsusscn2.cab" -F:package.cab "%TEMP%"
%SystemRoot%\System32\expand.exe "%TEMP%\package.cab" "%TEMP%\package.xml"
del "%TEMP%\package.cab"


%SystemRoot%\System32\cscript.exe //Nologo //E:vbs .\cmd\XSLT.vbs "%TEMP%\package.xml" .\xslt\ExtractDownloadLinks-w60-x64-glb.xsl "%TEMP%\DownloadLinks-all.txt"


%SystemRoot%\System32\cscript.exe //Nologo //E:vbs .\cmd\XSLT.vbs "%TEMP%\package.xml" .\xslt\ExtractDownloadLinks-w60-x86-glb.xsl "%TEMP%\DownloadLinks-all.txt"

del "%TEMP%\package.xml"
del "%TEMP%\wsusscn2.cab"

:EoF

当我双击它时,我运行完美。我尝试使用以下代码通过 C# 打开它:

System.Diagnostics.Process.Start("C:\\Users\\me\\Desktop\\trunk-r664\\trunk\\ExtractDownloadLinks-all");

但是当我运行它时,它在 cmd 中给出了一个错误,说:

Can not open input file: c:\users\me\appdata\local\temp\packacge.cab
Can not open input file: c:\users\me\appdata\local\temp\wsusscn2.cab

我想解决这个问题的最佳选择是碰碰微软的脚本?但我不知道如何。或者也许在 C# 中有一个解决方案?

提前致谢

最佳答案

我得到了一个非常了解 wsus offline 并且知道如何编写脚本的人的帮助。我在这里问同样的问题:http://forums.wsusoffline.net/viewtopic.php?f=4&t=5001&p=15991#p15991得到了这个答案:特别感谢“Aker”!

System.Diagnostics.Process wsusou = new Process();
wsusou.StartInfo.FileName = "cmd.exe";
wsusou.StartInfo.Arguments = @"/k C:\Users\me\Desktop\trunk-r664\trunk\ExtractDownloadLinks-all.cmd"; // replace "/k" with "/c", if cmd should auto-close
wsusou.StartInfo.WorkingDirectory = @"C:\Users\me\Desktop\trunk-r664\trunk";
wsusou.Start();
while (wsusou.HasExited == false)
{
System.Threading.Thread.Sleep(100);
}
wsusou.Dispose();

关于c# - 运行 Process.Start 时无法打开 : c:\users\. ..\temp\package.cab,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30779446/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com