我有一个msi安装程序,我需要从C#静默安装它
Process process = new Process();
process.StartInfo.FileName = "cmd.exe";
process.StartInfo.WorkingDirectory = @"C:\temp\";
process.StartInfo.Arguments = "msiexec /quiet /i Setup.msi ADDLOCAL=test";
process.StartInfo.Verb = "runas";
process.Start();
process.WaitForExit(60000);
Run Code Online (Sandbox Code Playgroud)
注意到cmd命令工作正常,如果我从cmd手动运行它作为管理员
当我运行它时,我只是在管理模式下获取cmd屏幕,但命令没有执行
我想在pdf文档上逐行编写我的代码是在页面中心写文本我怎么能逐行写?
// Create a new PDF document
PdfDocument document = new PdfDocument();
document.Info.Title = "Created with PDFsharp";
// Create an empty page
PdfPage page = document.AddPage();
// Get an XGraphics object for drawing
XGraphics gfx = XGraphics.FromPdfPage(page);
// Create a font
XFont font = new XFont("Verdana", 20, XFontStyle.BoldItalic);
// Draw the text
gfx.DrawString("Hello, World!", font, XBrushes.Black,
new XRect(0, 0, page.Width, page.Height),
XStringFormats.TopCenter);
Run Code Online (Sandbox Code Playgroud)