Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

Run any extention file like an exe

Hello,

It is possible (on Visual studio) to say "Run this app (test.klo) like an .exe"

test.klo is an exe but he has just a different extension and I wanna say to Visual if it's possible to run "test.klo" like an executable and keeping the same extension.
(Sep 21, 2017 04:07 AM)knowers Wrote:  Hello,

It is possible (on Visual studio) to say "Run this app (test.klo) like an .exe"

test.klo is an exe but he has just a different extention and I wanna say to Visual if it's possible to run "test.klo" like an executable and keeping the same extention.

I'm sure only the wide-known extension such as .scr, .msi, and .exe are the only ones you can use to launch/run programmes under windows environment.
but well, that's just my understanding. good luck getting replies from experts.
[Image: UylCjc.png]
No, I give you an example:

String executable = "C:\users\test\desktop\test.txt" // the test.txt actually a .exe, I just modify the extension to ".txt"

Process.start(executable + ".exe") Something like that, For run the test.txt like an exe keeping the same extension (.txt)
Basically only executable file types can be, well executed.
.scr
.msi
.exe
.bat
.com
.bin

There are a few others but these are the most common.
(Sep 21, 2017 04:21 AM)Gt403cyl Wrote:  Basically only executable file types can be, well executed.
.scr
.msi
.exe
.bat
.com
.bin

There are a few others but these are the most common.

I know, the "test.txt" is already an .exe, but i just modify extension, I just wanna say at my source code to run "test.exe" keeping the same extension "test.txt"
(Sep 21, 2017 04:37 AM)knowers Wrote:  I know, the "test.txt" is already an .exe, but i just modify extension, I just wanna say at my source code to run "test.exe" keeping the same extension "test.txt"

You really can't, best I can say is you can spoof it but it would look like "texe.txt".
(Sep 21, 2017 05:08 AM)Gt403cyl Wrote:  You really can't, best I can say is you can spoof it but it would look like "texe.txt".

That's exactly I was implying. :)
[Image: UylCjc.png]
- Might be worth it to look into the Windows shell setting for "Hide extensions for known file types":
[Image: h6YQKlRrQFGQk2yDybchdQ.png]
- Programmatically turn this setting on, then a file named Test.txt.exe would appear in the explorer shell as Test.txt, and just utilize a txt file icon as the icon for your app
[Image: japSdz7bQDusfxaaUkjqUA.png]

This is a horrendous and hideous method to accomplish your ends, and I'm sure there's a better method, but that's just what I came up with on the spot with zero Googling.
(Sep 21, 2017 04:07 AM)knowers Wrote:  Hello,

It is possible (on Visual studio) to say "Run this app (test.klo) like an .exe"

test.klo is an exe but he has just a different extension and I wanna say to Visual if it's possible to run "test.klo" like an executable and keeping the same extension.

[-HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.your extension]

More info here: https://www.youtube.com/watch?v=V3gbpCFCs04
Read the comments.
[Image: logo.gif]
If you don't mind a cmd dependency then this should work too.

Code
using (Process p = new Process())
{
     p.StartInfo.FileName = "cmd.exe";
     p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
     p.StartInfo.Arguments = string.Format("/c {0}{1}{0}", '"', @"path\test.klo");
     p.Start();
}
Anyone who says it isn't possible is clueless. File extensions are just registered to have default programs associated with them in the registry, aside from that, binary data doesn't change... You can load the PE in memory if you had to also.
Getting Started: C/C++
[C/C++/.NET/x86 ASM - Automation Programmer]
I believe you can do it, in theory the inside is still an exe not a txt or something...

But you can spoof the extension too ;)


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C#] by madeha elsayedxxxxMay 19, 2020 11:53 PM 4 385 May 19, 2020 11:53 PM
Last Post: Shadow_Cloud
[.NET] by Formula 1Jun 5, 2017 02:03 AM 11 460 Jun 5, 2017 02:03 AM
Last Post: Washi
[Java] by explodeviews97Sep 16, 2016 04:29 AM 6 185 Sep 16, 2016 04:29 AM
Last Post: Sakuto