Hi,
I need to run a batch file wich I would like to run minimized.
The batchfile runs a exe file with some arguments, and deletes af file, and
remanes another.
How can I do that minimized? I know I can make a vbs file, and use the
following line to minimize:
Set WSHShell = Nothing
But can I do the same thing in C#?
Im running the bat file using:
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.EnableRaisingEvents=true;
proc.StartInfo.FileName="C:\Sharp\Batfile.bat;
proc.Start();
In fact, I could run the exe file, with arguments direct from C#?
Best regards
Mads 2 9749
Mads,
Try this.
proc.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Minimized;
Also when you specify the file name try
proc.StartInfo.FileName="C:\\Sharp\\Batfile.bat;
or
proc.StartInfo.FileName=@"C:\Sharp\Batfile.bat;
All the best,
Phil.
"Mads Westen" wrote: Hi, I need to run a batch file wich I would like to run minimized. The batchfile runs a exe file with some arguments, and deletes af file, and remanes another.
How can I do that minimized? I know I can make a vbs file, and use the following line to minimize: Set WSHShell = Nothing
But can I do the same thing in C#?
Im running the bat file using: System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.EnableRaisingEvents=true; proc.StartInfo.FileName="C:\Sharp\Batfile.bat; proc.Start();
In fact, I could run the exe file, with arguments direct from C#?
Best regards Mads
Hi Phil,
Your suggestion works perfekt. I went with the .Hidden style at the end.
But your code let me the right way - thank you very much!
Best regards
Mads
"Phil Williams" <Ph**********@discussions.microsoft.com> skrev i en
meddelelse news:63**********************************@microsof t.com... Mads, Try this. proc.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Minimized;
Also when you specify the file name try
proc.StartInfo.FileName="C:\\Sharp\\Batfile.bat;
or
proc.StartInfo.FileName=@"C:\Sharp\Batfile.bat;
All the best, Phil.
"Mads Westen" wrote:
Hi, I need to run a batch file wich I would like to run minimized. The batchfile runs a exe file with some arguments, and deletes af file, and remanes another.
How can I do that minimized? I know I can make a vbs file, and use the following line to minimize: Set WSHShell = Nothing
But can I do the same thing in C#?
Im running the bat file using: System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.EnableRaisingEvents=true; proc.StartInfo.FileName="C:\Sharp\Batfile.bat; proc.Start();
In fact, I could run the exe file, with arguments direct from C#?
Best regards Mads This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Bill |
last post by:
I need help closing a CMD window when it is executed from Access.
1) The batch file is called from Access.
2) Access closes,
3) the batch runs a copy of the access database (creating a backup)...
|
by: Charles Neitzel |
last post by:
I'm trying to write a windows application in C# (Using Microsoft Visual C#
2005 Express) that is nothing more than a simple UI with buttons on it. The
buttons do various things like running...
|
by: Charles |
last post by:
I'm trying to write a windows application in C# (Using Microsoft Visual
C#
2005 Express) that is nothing more than a simple UI with buttons on it.
The
buttons do various things like running...
|
by: emman_54 |
last post by:
Hi every one,
I am trying to run a batch file using my asp.net application.
I am using the Process class to run the batch file. When I run my web
application, In the task manager, i could see...
|
by: Crash |
last post by:
Hi,
..NET v1.x SP1
VS 2003
SQL Server 2000 SP3
Server 2000, XP, Server 2003
I would like to programmatically execute {possibly many} SQL Server
batch scripts. Aka I have many scripts that...
|
by: steve |
last post by:
Hi all,
Here's some work in progress that should allow you to run a batch file as a
custom action in a VS deployment project. Yup I know you can use js or wsh,
but the target may not have...
|
by: dheerajmarwaha |
last post by:
Hi
I am facing a problem in running a batch file.
I am using the following code:
Process proc = new Process();
proc.StartInfo.RedirectStandardOutput = false;...
|
by: ck9663 |
last post by:
hi guys this is a little challenging, at least for me...here goes...
i have to run a DOS batch file from a server. with some parameters that i need to pass. these parameters can be found on a...
|
by: =?Utf-8?B?R2lkaQ==?= |
last post by:
Hi,
In my windows applicationm, i need to excute a batch file.
this batch file throws some text and questions to the screen, i need to
catch the standard Output, check if it's a question, in...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |