processstartinfo

Trying to run same command in command prompt not working

大兔子大兔子 提交于 2019-12-23 15:38:38
问题 I am making a program that seeks out secured PDFs in a folder and converting them to PNG files using ImageMagick. Below is my code. string WorkDir = @"C:\Users\rwong\Desktop\TestFiles"; Directory.SetCurrentDirectory(WorkDir); String[] SubWorkDir = Directory.GetDirectories(WorkDir); foreach (string subdir in SubWorkDir) { string[] filelist = Directory.GetFiles(subdir); for(int f = 0; f < filelist.Length; f++) { if (filelist[f].ToLower().EndsWith(".pdf") || filelist[f].EndsWith(".PDF")) {

LPR command to print pcl-file from windows service not working(Now a tray application)

不羁的心 提交于 2019-12-23 12:19:54
问题 I've been looking around for a while for a possible solution and explanation, but I can't find anything really. The following command is being run from a windows service. The same command does function if used directly in cmd. It does not return any errors or anything else for that matter. System.Diagnostics.Process process = new System.Diagnostics.Process(); System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(); startInfo.WindowStyle = System.Diagnostics

Starting a process with a user name and password

为君一笑 提交于 2019-12-19 02:51:47
问题 I know that you can run a process with a given username/password in the following way: var processInfo = new ProcessStartInfo { WorkingDirectory = workingDirectory, FileName = "a name", UserName = loggedUserName, Password = "password", Domain = userNameDomain, UseShellExecute = false, }; Process.Start(processInfo); The problem I'm facing is that I don't want to write the actual password as a part of the code and the process won't start if I leave the Password attribute empty... How can I

ClickOnce application does not start through Process.Start(“x.abc”) with *.abc associated to the ClickOnce application

家住魔仙堡 提交于 2019-12-18 12:18:10
问题 I have successfully developed and deployed a ClickOnce application which registers an associated file extension, for instance *.abc . When I click on a file named x.abc or if I type x.abc from the command prompt, the ClickOnce application starts, and I can retrieve the file through the dedicated API. I can also launch the application programmatically with the following code: System.Diagnostics.Process.Start ("x.abc"); Everything works fine on my Windows Vista 64 bit box. However, if I try to

Interact with ffmpeg from a .NET program?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-18 04:59:18
问题 I'm trying to create a .NET wrapper for media-file conversion using ffmepg, here is what I've tried: static void Main(string[] args) { if (File.Exists("sample.mp3")) File.Delete("sample.mp3"); string result; using (Process p = new Process()) { p.StartInfo.FileName = "ffmpeg"; p.StartInfo.Arguments = "-i sample.wma sample.mp3"; p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardOutput = true; p.Start(); //result is assigned with an empty string! result = p.StandardOutput

Process.Start Permissions Problem

送分小仙女□ 提交于 2019-12-17 20:46:06
问题 I'm trying to run an external problem from C# by using Process.Start, but am running into permissions issues. When I open a command prompt normally (not as an admin) and run my commands they work fine, but when I open a command prompt via Process.Start, I get a write error on the directory. ("I can't write on file test.log") If I run it as an admin via Process.Start it works fine, but I get the permissions popup. Does anyone have any ideas that might help me figure this out? Thanks! Here is

Hanging process when run with .NET Process.Start — what's wrong?

…衆ロ難τιáo~ 提交于 2019-12-17 18:16:53
问题 I wrote a quick and dirty wrapper around svn.exe to retrieve some content and do something with it, but for certain inputs it occasionally and reproducibly hangs and won't finish. For example, one call is to svn list: svn list "http://myserver:84/svn/Documents/Instruments/" --xml --no-auth-cache --username myuser --password mypassword This command line runs fine when I just do it from a command shell, but it hangs in my app. My c# code to run this is: string cmd = "svn.exe"; string arguments

Run process as administrator from a non-admin application

一曲冷凌霜 提交于 2019-12-17 05:53:31
问题 From an application that is not being run as administrator, I have the following code: ProcessStartInfo proc = new ProcessStartInfo(); proc.WindowStyle = ProcessWindowStyle.Normal; proc.FileName = myExePath; proc.CreateNoWindow = false; proc.UseShellExecute = false; proc.Verb = "runas"; When I call Process.Start(proc), I do not get a pop up asking for permission to run as administrator, and the exe is not run as administrator. I tried adding an app.manifest to the executable found at

Executing command in command prompt with redirection on a C# .aspx page

徘徊边缘 提交于 2019-12-13 02:39:17
问题 I'm attempting to execute a command in command prompt in C# code on a .aspx page. The code doesn't throw any errors, however, the command doesn't execute because a new file isn't generated. I don't see any issues with the command itself because if I copy the command from debug view and paste it into command prompt, it executes fine. Any ideas why my code doesn't generate the ResultadoCheckMac_100939.txt? code: string cmd = ejecutable_CheckMac + " " + archivo_temporal + " > " + archivo

Getting stdout from console app asyncronously without waiting for console to exit

坚强是说给别人听的谎言 提交于 2019-12-12 23:28:17
问题 I have an issue with getting some console standard output from a small long running console app spawned by my application. My app starts the console app and the console app will stay alive listening on a port for the duration of my applications lifetime (or until explicitly killed). When the console app starts, it outputs a port number that it is listening on, I need to asyncronously grab that port number and use it elsewhere in the app. Problem is, my event handler to get the output data is