Optimizing Python scripts' running time from C#

佐手、 提交于 2020-07-10 07:34:08
问题 I apologize in advance if my question is badly formulated, for I don't know if what I need makes any sense. I'm currently working on a c# project where I need to run several time the same python script from inside the program, but with different arguments each time. For this, I'm not using IronPython, but the ProcessStartInfo class, for I understood that IronPython has some problem with certain packages I use. But this can change. My problem is that although the python script is small and

ProcessStartInfo arguments

时光总嘲笑我的痴心妄想 提交于 2020-01-25 17:27:19
问题 I have a process, which takes some arguments. I want it to start from C#. I have tried the same arguments in shortcut and it works. On the other hand, in c# it doesnt, so here are the arguments. The argument format is correct, but i get a wrong argument error at -k ProcessStartInfo prf = new ProcessStartInfo("C:\\" + "argstest.exe"); prf.UseShellExecute =true; prf.Arguments = "-l -k testing TYPE=0 USER=1 COUNT=10"; Process.Start(prf); Process

Executing a process from .NET application without UAC prompt

大兔子大兔子 提交于 2020-01-21 04:35:11
问题 I have a scenario where I need to launch an EXE from my .NET application, but I can't get around the UAC prompt that pops up. The prompt is triggered even before the other EXE is launched - probably on the very call to Process.Start . I use this code for launching the app: var info = new ProcessStartInfo(path, "params"); info.Verb = "runas"; try { Process.Start(info); } catch (System.ComponentModel.Win32Exception) { // Person denied UAC escallation return false; } Both EXEs (my app and the

How to pass WindowState from desktop shortcut into WPF app?

北战南征 提交于 2020-01-03 17:12:13
问题 How can I control the initial WindowState (Normal, Minimized, Maximized) of a WPF main window from a desktop shortcut? The "Run:" combobox of the shortcut's properties dialog let's me choose between "Normal window", "Minimized" and "Maximized". But this option seems to be completely ignored by WPF apps. With WinForms this was automatically supported with no additional code. Is there a way to access this option from the launched WPF process? I know I can specify the ProcessStartInfo

.NET - WindowStyle = hidden vs. CreateNoWindow = true?

心不动则不痛 提交于 2019-12-27 16:48:32
问题 When I start a new process, what difference does it make if I use the WindowStyle = Hidden or the CreateNoWindow = true property of the ProcessStartInfo class? 回答1: As Hans said, WindowStyle is a recommendation passed to the process, the application can choose to ignore it. CreateNoWindow controls how the console works for the child process, but it doesn't work alone. CreateNoWindow works in conjunction with UseShellExecute as follows: To run the process without any window: ProcessStartInfo

Running an installer from within C#

安稳与你 提交于 2019-12-24 11:37:37
问题 I need to write code to download and run a program, e.g. notepad++ (npp.5.9.3.Installer.exe) this can be found on the web. I run it with the ProcessStartInfo class. However when I normally execute the notepad++ installer, it will show me a few steps before actually installing, like choose language, path etc. Is there any way to programatically skip these steps, and install the software? I hope my question is clear. If it helps, I also attach the method that so far only starts the installer

Executing an .exe in a DNN Module

倖福魔咒の 提交于 2019-12-24 02:05:32
问题 I'm trying to get my DNN module (6.1.3) to start up any kind of executable when a certain condition happens in my program. At this time I'm just trying to have it run Notepad and create a text file. Here's what I'm trying at the moment: ProcessStartInfo pi = new ProcessStartInfo(@"C:\Windows\notepad.exe"); pi.Arguments = "> test.txt"; pi.Verb = "runas"; pi.CreateNoWindow = false; pi.ErrorDialog = true; pi.RedirectStandardError = true; pi.RedirectStandardInput = true; pi.RedirectStandardOutput