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
sid2x964
Edited 15-Dec-12 2:28am
Nelek47.5K
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 Schatak 394
1 OriginalGriff 300
2 Abhijit Ghosh (Subho) 125
3 Andreas Gieriet 120
4 _Amy 115
0 OriginalGriff 7,137
1 Sergey Alexandrovich Kryukov 5,628
2 Maciej Los 3,529
3 Peter Leow 3,373
4 DamithSL 2,505


Advertise | Privacy | Mobile
Web04 | 2.8.140721.1 | Last Updated 15 Dec 2012
Copyright © CodeProject, 1999-2014
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