Tag: silent

通过C#代码以静默方式的不同用户运行.bat文件

我每隔几秒运行一个批处理文件,使用以下代码与服务器进行时间同步: Process process = new Process(); process.StartInfo.WorkingDirectory = Environment.GetFolderPath(Environment.SpecialFolder.System); process.StartInfo.FileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), “cmd.exe”); process.StartInfo.Arguments = @”/CC:\TimeSync.bat”; process.StartInfo.CreateNoWindow = true; process.StartInfo.UseShellExecute = false; process.StartInfo.WindowStyle = ProcessWindowStyle.Minimized; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.UserName = “username”; SecureString pwd = new SecureString(); Char[] pwdCharacters = “password”.ToCharArray(); foreach (char t in pwdCharacters) { pwd.AppendChar(t); } process.StartInfo.Password = pwd; process.Start(); string output = […]

为iexpress创建批处理文件

我正在尝试使用iexpress运行我的批处理文件,它将为我执行2 exe和1 msi文件。 当我尝试手动操作时,它的工作原理。 以下是我的批处理文件中的代码。 Start /wait %CD%\1.exe /q Start /wait %CD%\2.exe /q msiexec.exe /i “%CD%\3.msi” 但是当我从iexpress创建一个exe文件时,这似乎不起作用。 参考 上面提到的文章有一些代码(将文件复制到临时文件夹)&但我无法理解语法。 MKDIR %Tmp%\ XCOPY . %Tmp%\ /S /E /Y %Tmp%\\setup.exe