Click here to Skip to main content
13,249,035 members (45,411 online)
Rate this:
Please Sign up or sign in to vote.
See more:
My question is how do you run a file as .exe.
It may sound simple but it isn't. I am not talking about this:

My question is :
Suppose I have a file called a.txt and when i click a button it runs as a.exe not a.txt
In other words it is a Temporary File Converter.
Any Code for that????

OP's additional information moved from non-solution below
See what i am telling is that in WINDOWS EXPLORER you can rename a.txt to a.exe or a.bat
or a.cmd and then execute it.I want to do the same with VB.NET 2010 EXPRESS.
I need it for my program "RUN AS ANYTHING".
Also i have tried this but i failed :
Dim O as New OpenfileDialog
Process.start(Openfiledialog.Filename + "exe")'For running the program or a file in exe format
Posted 13-Dec-12 1:27am
Updated 15-Dec-12 3:28am
Aarti Meswania 13-Dec-12 6:45am
not a clear question

we can not run txt file as exe
do you want to ask for executing batch files or any else?

please explain briefly and post here code which you have tried... :)
01010RAJ 13-Dec-12 6:53am
not right.
Ashok19r91d 17-Dec-12 2:36am
Files and Programs are different, All Programs are files, But Not all Files are Programs, so You can't Execute Files as Executable Application... But you can use Default Program to View or Open File, For Example Notepad for txt file, For that Use
Process.Start(O.FileName) ' Assuming O as OpenFileDialog...

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

There is no built in way to do that, and I can't see any (non-malicious) reason why you would want to.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.171114.1 | Last Updated 15 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100