473,396 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Executing an executable file using C# program

Hi,

hope you forgive my simple request.

I would like to execute a file using a C# application, say if I clicked on a button that is in a form I should be able to open the file (file_name.extension) or any other application say a game. Help me if you have done this before.

Thanks

pieronabs
Jul 12 '06 #1
3 31919
you can use the following line to execute a exe/cmd/bat/com or even VB Script files.

System.Diagnostics.Process.Start( "C:\WINDOWS\system32\CALC.EXE" )

When you are using it in ASP.NET you might get an error if the user account under which IIS is running does not have the execute permission.
Jul 13 '06 #2
I was wondering how to do this as well thank you for posting how to.
Aug 2 '10 #3
PsychoCoder
465 Expert Mod 256MB
@velulev: If they execute that from an ASP.NET application it's going to start the calculator on the web server not the client machine. ASP.NET is executed on the web server

Back on-topic: You can also pass arguments when using Process.Start as well, using the StartInfo.Arguments property of the process class

Expand|Select|Wrap|Line Numbers
  1. public void StartProcessWithArguments()
  2. {
  3.     System.Diagnostics.Process p = new System.Diagnostics.Process();
  4.     p.StartInfo.FileName = "YourFileName";
  5.     p.StartInfo.Arguments = "argument1 argument2 argument3";
  6.     p.Start();
  7. }
Aug 2 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: axawire | last post by:
hi i am trying to find out if there is a way to tell the OS to run an executable file that is already loaded into memory in a byte array any ideas is appreciated... i do NOT wish to save the...
1
by: Scott Chang | last post by:
Hi all, I loaded the following program 'HelloMCPP' to my MS VC++ .NET (2002) that is installed on my Windows XP Professional PC: ------------------------------------- AssemblyInfo.cpp...
1
by: yxq | last post by:
Hello, I want to make a utility to clean Registry, my problem is that: How to get actual executable file path? There are lots of command line modes in Registry: c:\program files\cccc\aaa.exe...
3
by: SpIcH | last post by:
Hi All, This is all about protecting my data in Executable file. I have developed a program in Visual Basic .NET 2002. I have many questions in mind... please help me to complete my project. ...
4
by: comp.lang.php | last post by:
I downloaded the tarball and while was able to compile within PHP with no problems, I am having memory timeout issues involving image manipulation with extremely large images (800K - 2mb). ...
1
by: ciccio | last post by:
Dear all, I'm using python to manage a web-site. In particular, a user insert specific parameters in a form and, then, I recover all parameters and run an executable file according to the user...
1
by: manontheedge | last post by:
i'm using microsoft visual studio 6.0, and i have a program that reads in a text file, then looks for a variety of things, sorts them into categories, and prints them out ( to the console AND a...
4
by: Perl Beginner | last post by:
i have created an automation program using Perl (Win32). i converted the perl script to an executable file. what i would like to do is have a way for the user to easily kill the executable file if...
0
by: Arnold Calvert | last post by:
Let there be an executable file say, t1.exe. If I run t1.exe then it shall copy itself to a new executable file say t2.exe. #include <stdio.h> #include <stdlib.h> #include <conio.h>
0
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
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...
0
marktang
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
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,...
0
jinu1996
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.