Jump to content

VB.NET Execute a file that is not .exe as if it were .exe

KingKeith55

I was working on a project, and I was wondering if it is possible to have a non-exe file run as if it were an exe.

 

For example, you want something called program.dat to run as if it were program.exe

 

(Im trying to do this to avoid people who are using my mod for a game to touch the actual file that doesnt need to be touched and just use the launcher thing I made)

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

What do you mean?

 

I don't think it is possible to execute something that has nothing to execute

Intel Core i7 9700k - EVGA FTW GTX 970

Link to comment
Share on other sites

Link to post
Share on other sites

Not sure. As an alternative, you could have your file require a specific start command that the launcher hands it. If it's not received then it either doesn't start, shows an error message, or however else you want to handle it.

 

 

edit: I read this as you trying to take an executable (that you programmed) and hide the fact that it is an executable so they run the launcher. Now that I've re-read it, I think I'm wrong lol

Link to comment
Share on other sites

Link to post
Share on other sites

Hm, my idea is to force it to run using a certain program. I know you can use notepad for this. I was thinking it might be possible with windows shell.
 
eg. 

    Private Sub opentxt(ByVal g As String)        Dim startInfo As New ProcessStartInfo        startInfo.FileName = "notepad.exe"        startInfo.Arguments = g        Process.Start(startInfo)    End Sub

 
 
Then I can use this opentxt("C:\file.cpp") and it would open the C++ file in notepad. I think if I knew the startinfo filename for Windows Shell I could probably figure something out.

Edited by colonel_mortis
Code tags
Link to comment
Share on other sites

Link to post
Share on other sites

What do you mean?

 

I don't think it is possible to execute something that has nothing to execute

Also, the file is an executeable that I just renamed the file extension to something else to avoid people running it because some people will get confused and run the wrong .exe file.

Link to comment
Share on other sites

Link to post
Share on other sites

change the extension of the file to exe then back again after or simply more it to a folder called /data/ then just have the file you want them to run in the root.

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

Just store encrypted code in a file and have the main EXE take each line, decrypt it and then run it, it would slow the program down a lot, but it would make it a lot harder to mod.

"My game vs my brains, who gets more fatal errors?" ~ Camper125Lv, GMC Jam #15

Link to comment
Share on other sites

Link to post
Share on other sites

change the extension of the file to exe then back again after or simply more it to a folder called /data/ then just have the file you want them to run in the root.

This.

 

It would be so much easier for you to just include like.. a binaries folder or something and call the executables and stuff you need like that, and keep the "launcher.exe" or whatever in the parent folder. 

 

So.. your folder structure would be:

\Game\-\Game\my_mod_launcher.exe-\Game\Other_game_files.ext--\Game\data\--\Game\data\my_mod_files.ext
Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×