-
Eddie is staring at water damage in his living room ceiling.
RAWC: Run Applications Without a Console: RAWC.zip
This application will basically run a batch file of the same name whenever it starts up, but masking it’s console that would normally pop up.
That is, if you take the RAWC.exe, and run it as is, it will attempt to run RAWC.bat. Rename the .exe to whatever you like, say “foobar.exe” and it’ll try to run “foobar.bat”. It will also pass any command line parameters to it, should you like.
Please note: if you like this application, please don’t link to it directly, instead link to this page so people can be aware of any updates.
The history:
I wrote the original source code, and a mysterious benefactor by the name of DrV rewrote it in C to make the executable smaller.
Future plans for this is to rewrite it in assembly using masm, and see if I can make the executable smaller. Who knows.
Source code:
- /**
- * Author: DrV (http://drv.nu)
- * Modified by: Eddie Parker (http://www.kickingdragon.com/2006/07/04/run-batch-files-without-a-console-popup/)
- */
- #define WIN32_LEAN_AND_MEAN
- #include <windows.h>
- #include <stdio.h>
- static STARTUPINFO si = { sizeof(STARTUPINFO) };
- static PROCESS_INFORMATION pi;
- unsigned int strlen(char * pStr)
- {
- unsigned int count = 0;
- while(*pStr != 0)
- {
- ++count;
- ++pStr;
- }
- return count;
- }
- void strcpy( char * pDestination, char * kpSource)
- {
- for(unsigned int i = 0; i < strlen(kpSource); ++i)
- {
- pDestination[i] = kpSource[i];
- }
- }
- int main(int argc, char **argv)
- {
- char applicationName[MAX_PATH + 1];
- char *pDot;
- GetModuleFileName(NULL, applicationName, sizeof(applicationName));
- pDot = applicationName;
- // Fast forward to the NULL.
- while (*(pDot++))
- ;
- // Move back until we find the start of the extension.
- while (*(--pDot) != '.')
- ;
- // Add a '.bat' to the extension.
- pDot[1] = 'b';
- pDot[2] = 'a';
- pDot[3] = 't';
- char commandLine[MAX_PATH + 1];
- char * pEndPoint = &commandLine[0];
- strcpy(pEndPoint, applicationName);
- pEndPoint += strlen(applicationName);
- {
- int i = 0;
- for(i = 1; i < argc; ++i)
- {
- pEndPoint[0] = ' ';
- ++pEndPoint;
- strcpy( pEndPoint, argv[i] );
- pEndPoint += strlen(argv[i]);
- }
- }
- pEndPoint[0] = 0;
- si.dwFlags = STARTF_USESHOWWINDOW;
- si.wShowWindow = SW_HIDE;
- printf("Running %s.", &commandLine[0]);
- CreateProcess(applicationName, &commandLine[0], NULL, NULL, FALSE, 0, NULL, NULL, &si, π);
- return 0;
- }
Popularity: 50% [?]
3 Comments »
RSS feed for comments on this post. TrackBack URI
Leave a comment


Pingback by Piatech: Free Tools — February 5, 2008 #
Pingback by SourceForge.net: — February 18, 2008 #
Pingback by Executar batch sem a janela preta, tem como? - Forum Outer Space - O — June 11, 2008 #