Wednesday, 11 May 2011

A simple utility to launch a program or script

#include <stdlib.h>
    
int main(int argc, char **argv)
{
        char prog[1024];
        strcpy(prog, argv[0]);
        strcat(prog, ".cmd");
        system(prog);
        return(0);
}

 

Launches a .cmd file with the same name as the program.  useful for PortableApps suite that will only launch executables not scripts (as far as i can tell).

Compile using tcc for example then rename to whatever you want to appear in the PortableApps menu.  now create a cmd file with the same name.  For instance if you name the launcher x.exe then the command file should be x.exe.cmd.

Put whatever you want in the command script.  Typically you would launch another executable from a relative path.

 

Posted via email from kwhitefoot's posterous

No comments:

Post a Comment

Followers