Compdigitec Labs

« | Home | »

Launch non-exe extension files as executables

By admin | May 1, 2011

Windows does not come with a built-in way of launching executables that are without the exe extension. However, we have written a small tool called “anylaunch” which allows one to execute any file as if it were an executable. (Non-PE files will still give an error since they are not executables “XYZ is not a valid Win32 application”)

Download (anylaunch.exe) or compile from source below:

#include <iostream>
#include <windows.h>
#include <cstdlib>
//#define ZeroMemory(p,size) memset((p),0,(size))
using namespace std;

int main(int argc, char* argv[])
{
	if(argc-1 < 1) {
		cout << "No process specified" << endl;
		return 0;
	}
	
	STARTUPINFO si;
	PROCESS_INFORMATION pi;
	// must blank it
	memset(&si,0,sizeof(si));
	si.cb = sizeof(si);
	si.lpReserved = NULL;
	si.lpTitle = NULL;
	// required for GUI app
	si.dwFlags = STARTF_USESHOWWINDOW;
	si.wShowWindow = SW_MINIMIZE;
	
	bool res = CreateProcess(NULL,argv[1],NULL,NULL,FALSE,0,NULL,NULL,&si,&pi);
	if(res == false) {
		printf("CreateProcess failed (error code %d)\n", GetLastError());
		return 1;
	}

	CloseHandle(pi.hProcess);
	CloseHandle(pi.hThread);	
	return 0;
}

Download or compile the anylaunch executable and put it into the same directory as your script or into the system directory. You can use it in a command line, batch scripting or another program like so:
anylaunch “<process command line here>”

Simple examples (assuming anylaunch is in system path or current folder):

Although the biggest use of this tool is to launch non-exe PE files, like so:

file yes.123

yes.123: PE32 executable for MS Windows (GUI) Intel 80386 32-bit
Then we can use anylaunch to launch this PE file:

anylaunch yes.123
Non-exe process in Task Manager

Non-exe process in Task Manager

You may run into some problems while running this. If your command line arguments to your target application are not showing up, you should put your entire command line into one argument and escaping quotes (anylaunch “C:\\Program Files\\Mozilla Firefox\\firefox.exe” not anylaunch C:\Program Files\Mozilla Firefox\firefox.exe). Some other common problems:

Accessing a file that does not exist or is inaccessible (The system cannot find the file specified.):

cat somefile.rnd

cat: somefile.rnd: No such file or directory

anylaunch somefile.rnd

CreateProcess failed (error code 2)

Trying to run an invalid Windows application

file Untitled.png

Untitled.png: PNG image, 800 x 600, 8-bit/color RGB, non-interlaced

anylaunch.exe Untitled.png

CreateProcess failed (error code 11) (An attempt was made to load a program with an incorrect format.)
CreateProcess failed (error code 193) (%1 is not a valid Win32 application.)
etc… (invalid format error, or win32 errors, etc)

If you found this article helpful or interesting, please help Compdigitec spread the word. Don’t forget to subscribe to Compdigitec Labs for more useful and interesting articles!

Topics: Windows | 12 Comments »

12 Responses to “Launch non-exe extension files as executables”

  1. Greg Webb Says:
    March 28th, 2013 at 00:24

    Thank you for this utility. I’m using it as one component in replacing Notepad with Notepad++(http://notepad-plus-plus.org/) without making any changes to extensions or Notepad itself.

  2. เกียรติบัตรออนไลน์ Says:
    July 28th, 2025 at 19:27

    … [Trackback]

    […] Read More on that Topic: compdigitec.com/labs/2011/05/01/launch-non-exe-extension-files-as-executables/ […]

  3. kruger Says:
    August 5th, 2025 at 21:22

    … [Trackback]

    […] Here you will find 70167 more Info to that Topic: compdigitec.com/labs/2011/05/01/launch-non-exe-extension-files-as-executables/ […]

  4. hiso23 Says:
    August 6th, 2025 at 18:57

    … [Trackback]

    […] Read More here to that Topic: compdigitec.com/labs/2011/05/01/launch-non-exe-extension-files-as-executables/ […]

  5. Apple gift card Says:
    August 8th, 2025 at 23:03

    … [Trackback]

    […] Info to that Topic: compdigitec.com/labs/2011/05/01/launch-non-exe-extension-files-as-executables/ […]

  6. kibris escort fiyatlari Says:
    August 17th, 2025 at 23:16

    … [Trackback]

    […] Find More to that Topic: compdigitec.com/labs/2011/05/01/launch-non-exe-extension-files-as-executables/ […]

  7. สล็อตเว็บตรง Says:
    August 24th, 2025 at 22:21

    … [Trackback]

    […] Read More Information here to that Topic: compdigitec.com/labs/2011/05/01/launch-non-exe-extension-files-as-executables/ […]

  8. หุ้น Says:
    September 3rd, 2025 at 21:50

    … [Trackback]

    […] Find More Information here on that Topic: compdigitec.com/labs/2011/05/01/launch-non-exe-extension-files-as-executables/ […]

  9. พรมปูพื้นรถยนต์ Says:
    September 12th, 2025 at 01:51

    … [Trackback]

    […] Here you can find 15183 additional Info on that Topic: compdigitec.com/labs/2011/05/01/launch-non-exe-extension-files-as-executables/ […]

  10. Villa for sale in phuket Says:
    September 13th, 2025 at 03:10

    … [Trackback]

    […] Here you can find 18878 additional Info to that Topic: compdigitec.com/labs/2011/05/01/launch-non-exe-extension-files-as-executables/ […]

  11. Go X Says:
    September 14th, 2025 at 05:03

    … [Trackback]

    […] Find More on that Topic: compdigitec.com/labs/2011/05/01/launch-non-exe-extension-files-as-executables/ […]

  12. เครื่องให้อาหารทางสายยาง Says:
    September 14th, 2025 at 18:51

    … [Trackback]

    […] Read More Info here to that Topic: compdigitec.com/labs/2011/05/01/launch-non-exe-extension-files-as-executables/ […]

Comments