Click here to Skip to main content
15,892,768 members
Please Sign up or sign in to vote.
1.00/5 (1 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:
VB
Process.Satrt("anything.exe")

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 :
VB
Button1_Click
Dim O as New OpenfileDialog
o.showdialog
Process.start(Openfiledialog.Filename + "exe")'For running the program or a file in exe format
Posted
Updated 15-Dec-12 2:28am
v2
Comments
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... :)
StackQ 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

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

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900