Run Batch Files Without A Console Popup
pupoP elosnoC A tuohtiW seliF hctaB nuR
rss

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:

Download: rawc.c
  1. /**
  2. * Author: DrV    (http://drv.nu)
  3. * Modified by: Eddie Parker (http://www.kickingdragon.com/2006/07/04/run-batch-files-without-a-console-popup/)
  4. */
  5. #define WIN32_LEAN_AND_MEAN
  6. #include <windows.h>
  7.  
  8. #include <stdio.h>
  9.  
  10. static STARTUPINFO si = { sizeof(STARTUPINFO) };
  11. static PROCESS_INFORMATION pi;
  12.  
  13. unsigned int strlen(char * pStr)
  14. {
  15. unsigned int count = 0;
  16.  
  17. while(*pStr != 0)
  18. {
  19. ++count;
  20. ++pStr;
  21. }
  22. return count;
  23. }
  24.  
  25. void strcpy( char * pDestination, char * kpSource)
  26. {
  27. for(unsigned int i = 0; i < strlen(kpSource); ++i)
  28. {
  29. pDestination[i] = kpSource[i];
  30. }
  31. }
  32.  
  33. int main(int argc, char **argv)
  34. {
  35. char applicationName[MAX_PATH + 1];
  36. char *pDot;
  37.  
  38. GetModuleFileName(NULL, applicationName, sizeof(applicationName));
  39.  
  40. pDot = applicationName;
  41.  
  42. // Fast forward to the NULL.
  43. while (*(pDot++))
  44. ;
  45.  
  46. // Move back until we find the start of the extension.
  47. while (*(--pDot) != '.')
  48. ;
  49.  
  50. // Add a '.bat' to the extension.
  51. pDot[1] = 'b';
  52. pDot[2] = 'a';
  53. pDot[3] = 't';
  54.  
  55. char commandLine[MAX_PATH + 1];
  56. char * pEndPoint = &commandLine[0];
  57.  
  58. strcpy(pEndPoint, applicationName);
  59. pEndPoint += strlen(applicationName);
  60.  
  61. {
  62. int i = 0;
  63. for(i = 1; i < argc; ++i)
  64. {
  65. pEndPoint[0] = ' ';
  66. ++pEndPoint;
  67.  
  68. strcpy( pEndPoint, argv[i] );
  69. pEndPoint += strlen(argv[i]);
  70. }
  71. }
  72.  
  73. pEndPoint[0] = 0;
  74.  
  75. si.dwFlags = STARTF_USESHOWWINDOW;
  76. si.wShowWindow = SW_HIDE;
  77.  
  78. printf("Running %s.", &commandLine[0]);
  79. CreateProcess(applicationName, &commandLine[0], NULL, NULL, FALSE, 0, NULL, NULL, &si, π);
  80.  
  81. return 0;
  82. }

Popularity: 54% [?]

Share or Store: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us

3 Comments »

RSS feed for comments on this post. TrackBack URI

  1. Kramer auto Pingback[...] decided to put together a list of free useful tools you can find online: AnalogXRun Scripts w/o a ConsoleFirewall Leak TesterMulti DistroThe PC De-Crapifierw.Blogger (used to make this post)450+ Problems [...]

    Pingback by Piatech: Free Tools — February 5, 2008 #

  2. Kramer auto Pingback[...] program here: http://www.xtort.net/system-utilities/command-line-utilities/ or this: http://www.kickingdragon.com/2006/07/04/run-batch-files-without-a-console-popup/  maybe they are enough for you, maybe not.  Good [...]

    Pingback by SourceForge.net: — February 18, 2008 #

  3. Kramer auto Pingback[...] chamado RAWC.exe (http://www.kickingdragon.com/wp-cont…06/07/RAWC.exe) Mais informa

    Pingback by Executar batch sem a janela preta, tem como? - Forum Outer Space - O — June 11, 2008 #

Leave a comment