none
Set the Process Priority to Low (BelowNormal) RRS feed

  • Question

  • how do i set the process priority to low by using this processCaller class.

    protected
    virtual void StartProcess()

    {

    // Start a new process for the cmd

    process = new Process();

    process.StartInfo.UseShellExecute = false;

    process.StartInfo.RedirectStandardOutput = true;

    process.StartInfo.RedirectStandardError = true;

    process.StartInfo.RedirectStandardInput = true;

    process.StartInfo.CreateNoWindow = true;

    process.StartInfo.FileName = FileName;

    process.StartInfo.Arguments = Arguments;

    process.StartInfo.WorkingDirectory = WorkingDirectory;

    bool startRet = process.Start();
    .....

    Monday, September 29, 2008 10:06 AM

Answers

  • In the Process class , you have a priorityclass Property

    http://msdn.microsoft.com/en-us/library/system.diagnostics.process.priorityclass.aspx


    If this post helps you, Please mark as answer

    Thanks & Regards, Srinivasan
    Monday, September 29, 2008 10:17 AM
  •  

    Hello,

           As we could see in the MSDN Library article Srinivasan suggested, Process.BasePriority is an integer property, also it is read-only.   To set the process priority to BelowNormal, we could use such a line of code:  myProcess.PriorityClass = ProcessPriorityClass.BelowNormal;

           Also, if we want to check whether the process’s priority is BelowNormal, we could use these codes:

    if (myProcess.PriorityClass.Equals(ProcessPriorityClass.BelowNormal))

    {    

    }

     

    Or

     

    if (myProcess.PriorityClass.ToString().Equals("BelowNormal"))

    {

    }

     

    Or

     

    if (myProcess.BasePriority == 6)

    {

    }

          

           Thanks,

    Best Regards,
    Lingzhi


    Please remember to mark the replies as answers if they help and unmark them if they provide no help. http://forums.msdn.microsoft.com/en-US/csharpide/thread/8e9ed0d7-11ff-402a-8489-9b5f05eeb706 http://forums.msdn.microsoft.com/en-US/vssetup/thread/60424309-bd78-4ca2-b618-03c4a16123b6
    Thursday, October 2, 2008 6:24 AM

All replies

  • In the Process class , you have a priorityclass Property

    http://msdn.microsoft.com/en-us/library/system.diagnostics.process.priorityclass.aspx


    If this post helps you, Please mark as answer

    Thanks & Regards, Srinivasan
    Monday, September 29, 2008 10:17 AM
  • Hence, could i just write, such as, 

    process.BasePriority.Equals("BelowNormal");

    ?

    Tuesday, September 30, 2008 1:04 AM
  •  

    Hello,

           As we could see in the MSDN Library article Srinivasan suggested, Process.BasePriority is an integer property, also it is read-only.   To set the process priority to BelowNormal, we could use such a line of code:  myProcess.PriorityClass = ProcessPriorityClass.BelowNormal;

           Also, if we want to check whether the process’s priority is BelowNormal, we could use these codes:

    if (myProcess.PriorityClass.Equals(ProcessPriorityClass.BelowNormal))

    {    

    }

     

    Or

     

    if (myProcess.PriorityClass.ToString().Equals("BelowNormal"))

    {

    }

     

    Or

     

    if (myProcess.BasePriority == 6)

    {

    }

          

           Thanks,

    Best Regards,
    Lingzhi


    Please remember to mark the replies as answers if they help and unmark them if they provide no help. http://forums.msdn.microsoft.com/en-US/csharpide/thread/8e9ed0d7-11ff-402a-8489-9b5f05eeb706 http://forums.msdn.microsoft.com/en-US/vssetup/thread/60424309-bd78-4ca2-b618-03c4a16123b6
    Thursday, October 2, 2008 6:24 AM
  • In the Process class , you have a priorityclass Property

    http://msdn.microsoft.com/en-us/library/system.diagnostics.process.priorityclass.aspx


    If this post helps you, Please mark as answer

    Thanks & Regards, Srinivasan

    This seems not so helpful to me, Anybody can help? Thank you!
    Thursday, September 23, 2010 2:44 AM