无法打开:c:users.. emppackage.cab 运行时运行 Process.Start
本文关键字:运行时 cab 运行 Start Process emppackage users | 更新日期: 2023-09-27 17:55:27
你好,我得到了这个微软的小脚本:
@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
我想解决这个问题的最佳选择是偶然Microsoft的脚本?但我不知道怎么做。或者也许 C# 中有一个解决方案?
提前致谢
我得到了一个对离线 wsus 了解很多并且知道如何编写脚本的人的帮助。我在这里问同样的问题: http://forums.wsusoffline.net/viewtopic.php?f=4&t=5001&p=15991#p15991 并得到了这个答案:特别感谢"阿克"!
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();