.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Process.Start return value confusion

Posted By:      Posted Date: September 03, 2010    Points: 0   Category :.NET Framework
MSDN documentation for Process.Start return value says: A new Process component that is associated with the process resource, or null if no process resource is started (for example, if an existing process is reused). What does "existing process is reused" mean? When can it happen?

View Complete Post

More Related Resource Links

IE Process Start and Window Height

Hi, I'm working on a tool for cross-browser testing: the idea being that a WinForms app will open a range of URLs over a range of browsers, and save each out as a screenshot. I have a problem with Internet Explorer though - namely that the opened window thinks it's a lot larger than it actually is... Background: I've got some javascript/jQuery, that happily reads a parameter from a URL, and scrolls a page down - so for example http://mypage/?scroll=1 will show the top part of a web page, http://mypage/?scroll=2 shows the second part, and so forth. The scrolling mechanism uses $(window).height() and $(document).height() - both of which are standard javascript methods that work happily.   $(document).ready(function () { var windowHeight = $(window).height(); var documentHeight = $(document).height(); alert("Window Height: " + windowHeight + "px, Document Height: " + documentHeight + "px" ); });   If I open my url in IE normally, it picks up (for example) a window height of 880px - which is correct since my screen is 1050px high, minus a bit for the IE toolbars/furniture. In my WinForms application, I can open IE happily with one of the scrollable urls - namely   process.StartInfo.CreateNoWindow = false ; process.StartInfo.WindowStyle = ProcessWindowStyle.Maximized; process.StartInfo.FileName = "iexpl

process.start with UseShellExecute = False

Hi Please help here im stuck with this issue where i am trying the fire the cmd.exe to perform a task but the cmd.exe file needs to be started with with admin rights and i wnt the file to be hidden and even if i set the process properties ProcessWindowStyle.Hidden. How can i run the process with admin right and also hide the window because the minute i set UseShellExecute = True and comment out the user name and password than it hides the window. From what i can gather is that once you set UseShellExecute = false the code does not hide the window. See my code example below and it would really help if some could show me how to start the processs with admin right and keep the window hidden. Dim myProcess As New Process ' Declare new instance of the process class myProcess.StartInfo.FileName = "cmd.exe" ' myProcess.StartInfo.Arguments = "My Arguments here" myProcess.StartInfo.UseShellExecute = False myProcess.StartInfo.Verb = "runas" myProcess.StartInfo.UserName = Username myProcess.StartInfo.Password = password myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden myProcess.Start() ' Start the process myProcess.WaitForExit() ' Wait for it to exit.

Process.Start - arguments length restriction to 2080 characters

Hi, I'm wondering why is there a limit to "The sum of the length of the arguments and the length of the full path to the process " to 2080? I see that the documentation says that a Win32Exception is thrown if this exceeds 2080 characters. Can someone please explain to me this limit? I'm trying to start a process and I have a lot of arguments to pass, and of course ... I exceed the limit of 2080.   Thanks, Ionut.

Process Start

I have the following code: Private Sub StartCSVParse(ByVal CSVParse As String) Dim process As New Diagnostics.Process With process With .StartInfo .FileName = "ExcelConverter.exe" .Arguments = "" .WorkingDirectory = "C:\Program Files\Infrahealth Inc\CSVParser\" End With ' .Start() 'This Try is to catch if the application throws any kinds of errors' Try Catch Exc As Exception message2.Text = Exc.Message End Try End With End Sub and the rest of my code before this works, but this won't start the process referenced. The process will run on it's own as an executable. I've verified that the right permissions are in place to execute the program and it wont start. Can anyone offer any reason why it may not be working?Thank youDoug

Calling SlSvcUtil with Process.Start()

Our application relies on SlSvcUtil (the equivalient of SvcUtil) to generate our WCF service client dynamically. It has always worked in the past but for some reason, when I call the command line to run this utility the application just stoped. The code is: Process process = new Process(); process.StartInfo.FileName = SvcUtilPath; process.StartInfo.Arguments = arguments; process.StartInfo.ErrorDialog = true; process.StartInfo.UseShellExecute = true; process.Start(); process.WaitForExit(); The variables: SvcUtilPath = C:\Program Files\Microsoft SDKs\Silverlight\v4.0\Tools\SlSvcUtil.exe arguments = http://localhost/XivicServicesNPDev/SecurityService.svc /out:c:\GeneratedSourceXivicNPDev\WCFReference\Silverlight\\SilverlightSecurityService.cs  /ct:System.Collections.ObjectModel.ObservableCollection`1  /ser:Auto  /n:*,Adapt.WCF.Reference  /r:"c:\GeneratedSourceXivicNPDev\FrameworkBin\Silverlight\Adapt.Model.Common - Silverlight.dll" /r:"C:\Program Files\Microsoft Silverlight\4.0.50524.0\\System.Windows.dll" /r:"c:\GeneratedSourceXivicNPDev\FrameworkBin\\Silverlight\Adapt.Model.Security - Silverlight.dll" /r:"c:\GeneratedSourceXivicNPDev\FrameworkBin\\Silverlight\Adapt.Model.CodeGeneration - Silverlight.dll" /r:"c:\GeneratedSourceXivicNPDev\FrameworkBin\\Silverlight\Adapt.Model.DataTransformation - Silverlight.d

System.Diagnostics.Process.Start not work with IIS, but on ASP.NET Development Server

System.Diagnostics.Process.Start not work with IIS, but on ASP.NET Development Server 

When a Task Expired step in a Start Custom Task Process action is not fired?!

When a Task Expired step is not fired?! I created a simple Workflow using the SharePoint Designer. Added one step to which I added the Start Custom Task Process and set the Due Date "2 minutes after now". For the When a task Expired step of the custom Task I added a Log to History List action, which doesn't seems to be fired. What good be wrong??? All the steps I did to create the workflow: Started SP Designer 2010 and created a reusalbe WF. Added Start Custom Task Process action to step 1. Changed the behavior of the When a task Expired stepof the custom task (added a Log to History List action). Changed the behavior of the Before Task is Assigned by adding a Set Field action which set the Due Date of the task to "Now + 2 minutes". Published the WF and started the WF for a simple list item. Unfortunately the Log to History List actionof the When a task Expired step is never called.


Hi, I tried to open a word document using System.Diagnostics. It works fine when the docuement name doesn't have any blank spaces in it. But word doesn't open the document when the document name has blanks in it. My code snippet: Process process = new Process(); process.StartInfo.FileName = "winword";process.StartInfo.Arguments = @"C:\\Karthick files\\Test.doc";process.Start(); It says winword cannot find the file, but the file actually exist. When I tried to remove the blank space in the folder, it opened correctly. I tried to open using Process.Start static method and it worked fine, but I need to create the instance of the process because I'm maintaining the processes which are opened this way. Please anyone of you help me out? Thanks in advance, Karthick.

is possible to pass some data to a wpf started with Process.start?

is possible to pass some data to a wpf application started with     Process.start?

When i start a process and running an external program is there any way to set the program window po


  private void View_Log_File_Click(object sender, EventArgs e)

            if (processNotePad == null || processNotePad.HasExited)
                processNotePad = System.Diagnostics.Process.Start("notepad.exe", "\"" + path_exe + "\\log\\logger.txt\"");


The problem is after the program the process started and i see the program when i click somewhere on the form1 the main application window the window of the process program is moving

Unable to start debugging on the web server. The IIS worker process for the launched URL is not curr


Unable to start debugging on the web server. The IIS worker process for the launched URL is not currently running.

I'm running Windows 7 64 bit, VS 2008 sp1.

When I first try to debug I get the error msg above.  I wait a few minutes (presumably some service is starting) and debugging will start but no breakpoints are recognized.

Some of the things I've tried:

Changing the binding of my site from a static IP to "*".

Enabled windows authentication.

made sure localhost = in the hosts file.

The website was built under windows xp and whatever version of IIS ships with xp.  My web config has no errors that I know of but might be missing something required for iis 7 (??)



Process.Start & Win32Exception


Hi together,

I'm currently facing a very strange problem. I would like to open the Sticky Notes program of Windows 7 (x64), which should be the easiest thing in the world:


This throws a Win32Exception (The system cannot find the file specified, Native Error 2). I tried the fully qualified path (C:\Windows\System32\StikyNot.exe), which didn't work either. Well ... if I copy the path string out of the watch of my debugger, I'm able to run the application via the run dialog.

So I added a batch file which should call the application for me:

start C:\System32\StikyNot.exe

If I run this batch via the explorer, the application pops up correctly. If I start this batch file from my application (which is in the same folder), I'll get an error (Windows cannot find ...).

I can call the calc.exe, which is in the same folder, without any problems. The application is not started from a network share nor has it the same name like the target app (StikyNot or StickyNotes).

What the ____ is going on here?

Thanks in advance,
Andreas Nägeli

Database mail process does not start, no error generated, for only one maintenance plan

I have three maintenance plans:

1. Application DBs - 2am (checks integrity, full backup, log backup)
2. System DBs - 3am (checks integrity, updates statistics, full backup)
3. Backup and log file cleanup - 3:30am (removes backup history, .bak and .trn files)

For items 1 and 3 above, I see the database mail process start up and receive emails that the jobs completed.  For item 2, no email....the database mail process does not start and there are no errors in the event log.  The job history shows that the job completed successfully.

I'm having the same problem on a different server, except that items 2 and 3 email me their results, but item 1 does not.  Same exact job steps and times of execution.  None of the jobs are set to notify the operator, the notification is coming from the maintenance plan.

Obviously I've gone through the basics:

Configured an operator
Created a default, public profile
Enabled mail profile in SQL Server agent
Tested mail delivery

How do I diagnose the database mail process just not starting?  Has anyone seen this before?

SQL Server 2005 SP3, with KB 970892 applied.

Error when trying to open a file with Process.Start()



Well, I have a folder called GUI. Inside GUI thers another folder called PDF and inside this folder, there are some PDF files. This folder (GUI) is uploaded to the server too.

Then I have a WebForm with some ImageButtons. When I click one of these ImageButtons, I want the file to open in a new tab. I tried with the following code:

private void LnkRelease_Click(object sender, EventArgs e)
 try { if ((((System.Web.UI.WebControls.WebControl)(sender))).ToolTip != "") { string virtualFolder = @"~\GUI\"; string physicalFolder = Server.MapPath(virtualFolder); string virtualPath = physicalFolder + "PDF" + @"\" + ((System.Web.UI.WebControls.WebControl)(sender)).ToolTip;  System.Diagnostics.Process.Start(virtualPath);
  } else { Console.WriteLine("The URL is broken"); } } catch (Exception ex) { throw ex; } }

As you can see, I build the path using the tooltips of the different ImageButtons. The ToolTip = File Name I want to open.

When I try this in debug mode, it works. It opens the pdf file in a new tab. However when I

Unable to start T-SQL Debugging. Could not attach to SQL Server process on


Please help!  I cannot debug CLR procs remotely.  Whenever I try to start debugging in VS2005 I get the error:  Unable to start T-SQL Debugging. Could not attach to SQL Server process on ....  I have clr enabled set to 1 and I have Allow SQL\CLR Debugging set on.  But I continue to get this error.  Any help would be greatly appreciated.



Confusion about web service return types (classes, generic list)?


I have confusion about web service return types? Can a webservice return a genelist? ex: List(Of Employees)

I have searched threads in this forums but got confused, some say 'yes' some say 'no'.

If I mark the class as Serizable will that be enough to return a generic list?


System.Management WMI Remote Process start



Couple questions here, some of which depends on the answer of other questions.....fun stuff   


1) So I have a program that starts a remote process on a PC. When trying to run this program, it's a VBscript it's attempting to run, I get a response code of "8" which is an unknown error. Can you run VBscripts using the System.Management class and WMI?


2) This Vbscript is launching iexploer.exe and browsing to a designated webpage. Instead of using the VBscript can I start iexploer.exe [I know I can do this] but pass it arguments so it starts at a certain webpage?


3) Even if I can do option 2, which is preferable, I'm having a problem with even launching iexploer.exe. On the remote PC it starts the process, but it never is shown. It appears as if it's running in the background but have no visuals of the application whatsoever. This occurs no matter what I run: notepad.exe, calc.exe, cmd.exe....you name it. Again, I see the process start [task manager] but no visual representation of that program.

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend