-1

I am trying to running an executable without ".exe" extension, when I'm trying to run my ".bin" file (actually it's .exe but I renamed it with .bin for prevent confusion) It's shows to me program selector windows.

How can I avoid that?

    If File.Exists("client.bin") Then
        Process.Start("client.bin", param)
        delay(100)
        Terminate()
    Else
        MsgBox(Lang(6), MsgBoxStyle.Critical, TITLE)
        Terminate()
    End If
Ňɏssa Pøngjǣrdenlarp
  • 38,411
  • 12
  • 59
  • 178
Liveth
  • 31
  • 9
  • 1
    Windows cant RUN a BIN file. In many cases you'll start a helper app like a DVD Burner thinking the file is an image file. Keep it as EXE or you are confusing Windows – Ňɏssa Pøngjǣrdenlarp Mar 15 '15 at 00:56

1 Answers1

1

Your code is essentially asking the operating system's runtime to handle the file. It uses the file extension to determine what it should do. For example, a .doc extension would be opened with Word (ultimately the process handler would pass the file path as an argument to the target application: winword.exe {filepath}.doc).

Windows doesn't know how to handle a .bin file, so it turns to you for help - hence the program selector prompt.

You can only execute an executable, just change the file extension back to .exe.

What confusion are you trying to prevent? For example, if you're trying to stop users from accidentally running the application, can't you move it to a different place where it might be a little harder to find?

If you really want to call it something else (and this is really, really messy), you could rename the file just before and after you run it. However, I would highly recommend you don't do this, it's really bad design!

greg84
  • 7,541
  • 3
  • 36
  • 45