Questions tagged [processstartinfo]

269 questions
2
votes
1 answer

How to print pdf file using windows service

I tried to print a pdf file from my windows service.It didnt work.Later i wrote a console app to print a pdf file.Console app did work!.Afterwords i i called that console app from service to print pdf file it didn'work. Why is that "print" doesnt…
2
votes
1 answer

I cannot retrieve process arguments using ProcessStartInfo.Arguments

I want to detect whether a process with a certain name and also specific command line arguments is already running. I use Process.GetProcessesByName to get the list of processes and tried to check the argument field of each processes StartInfo…
2
votes
4 answers

Sending input/getting output from a console application (C#/WinForms)

I have a form with 3 controls: A textbox for the user to enter commands to send to a console application, A button to confirm the commands to be sent and A read-only textbox to display the output from the application. What I want is for the user…
Zach
  • 449
  • 3
  • 6
  • 13
2
votes
2 answers

How to create a RAM Disk with imdisk and C#?

I'm trying to create a RAM Directory via imdisk in C#. Since the cmd command is something like: imdisk -a -s 512M -m X: -p "/fs:ntfs /q /y" I looked up how to process cmd commands with C# and found several hints regarding ProcessStartInfo(). This…
Robert Schröder
  • 169
  • 2
  • 11
2
votes
3 answers

Execute tf.exe (TFS) from C# halts

I need to get the revision number from TFS, if i run tf.exe from a Process the process halts. If i run the same command from command promts it works? int revision; var repo = "path to repo" var psi = new ProcessStartInfo("cmd", @"/c ""C:\Program…
Anders
  • 17,306
  • 10
  • 76
  • 144
2
votes
2 answers

ProcessStartInfo - print output in console window AND to file (C#)

From my C# application, I am calling Process.Start(myPSI) with the following ProcessStartInfo: ProcessStartInfo startInfoSigner = new ProcessStartInfo(); startInfoSigner.CreateNoWindow = false; startInfoSigner.UseShellExecute =…
jkh
  • 3,618
  • 8
  • 38
  • 66
1
vote
2 answers

Using New Process() in C#, how can I copy the command line text to a text file?

I want to run lmutil.exe with the arguments -a, -c, and 3400@takd, then put everything that command line prompt generates into a text file. What I have below isn't working. If I step through the process, I get errors like "threw an exception of…
Brandon
  • 1,058
  • 1
  • 18
  • 42
1
vote
2 answers

System.Diagnostics.Process not accepting credentials

I am trying to execute a batch file using the Process class. This code is in the middle of a larger section of code where I am using LogonUser() and WindowsIdentity.Impersonate() to impersonate the local PC admin account. I was attempting to run a…
Conrad
  • 2,197
  • 28
  • 53
1
vote
0 answers

Get "Error: command failed: return error code 1" in C# VPN app with openVPN

I am trying to learn and make a VPN app with WPF C# using my own OpenVPN server hosted on AWS VM instance. But when I try to do it with my project I get the error 2023-07-18 14:49:27 OPTIONS IMPORT: --ifconfig/up options modified 2023-07-18…
1
vote
0 answers

Question about SetParent API, it doesn't work on Windows 11

Good evening everyone So sorry for my mediocre english I have a question about the SetParent API. When I run the window on Windows 10, it works correctly and contains any program I want But when the program is executed on Windows 11, it does…
1
vote
1 answer

PowerShell - Start another instance of PowerShell.exe without elevation and using -NoProfile

I'm trying to run a new instance of powershell.exe (from PowerShell/ISE/pwsh/VSCode) with lowered elevation using its -NoProfile switch but haven't figured out a way to pass the -NoProfile switch in a way that results in a newly non-elevated…
1
vote
2 answers

C# Start a new MailTo Process and HTML URL Encoding

I have created a new MailTo extension method for the Process class which just fills the Process with a new ProcessStartinfo which contains the required mailto arguments. I have created a method called FormatMailToArgument (Right at the end) which…
anon
1
vote
0 answers

why does some software does not create new process for new file ? they run another file in same process by killing previous file e.g VLC media player

why does VLC media player does not create new process for new file like chrome do . When we click on video why does VLC kill first video and then open new one ?
1
vote
0 answers

WindowsIdentity.RunImpersonated not working?

I have a website where I click a button and a process its supposed to start. The problem is that I have to start that new process with other user and its starting with the user currently running the site in IIS. Even when I Log inside the…
1
vote
1 answer

Launching a specific chrome profile in C#

I have 3 chrome profiles and I'm using C# WinForms 2022 to load each profile in a single panel in a WinForm. I know how to launch, for example, the private profile in a single panel, something like this var url = "https://google.com"; var process =…