Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
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:
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 :
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 13-Dec-12 0:27am
sid2x963
Edited 15-Dec-12 2:28am
Nelek47.1K
v2
Comments
Aarti Meswania at 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 at 13-Dec-12 6:53am
   
not right.
Ashok19r91d at 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
good
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.
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 278
1 Maciej Los 205
2 DamithSL 193
3 Nguyen.H.H.Dang 190
4 arvind mepani 187


Advertise | Privacy | Mobile
Web01 | 2.8.140709.1 | Last Updated 15 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid