Windows ã®èµ·åæã«ãBATãã¡ã¤ã«ã§ãµã¼ãã¼ã®ãã§ãã¯ãå¿
ãèµ·åããããã°ã©ã ã®èµ·åãè¡ã£ã¦ãã¾ããã¨ãããããããæéå·®ã§è¡ããã¨ãèªä½ãã sleep çãªããã°ã©ã ï¼ãã³ãã³ãããã³ããã« sleep ããªãã®ã§ãåç
§ï¼ã¨çµã¿åããã¦ããã¢ããªã±ã¼ã·ã§ã³ã®èµ·åã§ããããæ¢ã¾ã£ã¦ãã¾ãã¾ãã
UNIX ã®ã·ã§ã«ã®ããã«ãæå¾ã«ã¢ã³ããµã³ãï¼&ï¼ãæã¤ã¨ããã¯ã°ã©ã¦ã³ãã§å®è¡ãã¦ãããããã§ããªãã®ã§ãä¾ã«ãã£ã¦ãç°¡å㪠VBS ã§ãªãCè¨èªã§æ¸ãã¦ã¿ã¾ããã
ä»åã® "startbg" ã³ãã³ãã¨ãå
æ¥ã® "sleepsec" ã³ãã³ãã使ãã°ãè²ã
å®åå¦çã«å½¹ç«ã¤ã¨ä¿¡ãããã
â»"start" ã³ãã³ãã使ãã¨ãã¢ããªã±ã¼ã·ã§ã³ãèµ·åã¯ããããã©ãæ°ããã³ãã³ãããã³ããã®ã¦ã£ã³ãã¦ãéãã¡ãããã§ãããã
次ã®ã¨ãããããã¦ã³ãã¼ãã§ãã¾ãã
http://cid-fcad8dc6ea8fbddf.office.live.com/browse.aspx/.Public/startbg
é¢é£ã¨ã³ããªã¼
ã³ãã³ãããã³ããã« sleep ããªãã®ã§
ç¶ã»ã³ãã³ãããã³ããã« sleep ããªãã®ã§
CheckFeeds.exe å
Ž
READMEãã¡ã¤ã«
startbg Reference Manual
NAME
startbg - å¾ã«ç¶ãã³ãã³ããããã¯ã°ã©ã¦ã³ãã§å®è¡ããã
SYNOPSIS startbg [command] [options]
DESCRIPTION
startbg ã¯ãå¾ã«ç¶ãã³ãã³ããããã¯ã°ã©ã¦ã³ãã§å®è¡ãããThis program runs another following Windows execute file in the background
like an ampersand (&) is at the end of the command line on UNIX shells.The called process runs in the current directory.
So that directory is ROCKED while the sub process is running.EXAMPLES
startbg "C:\Program Files\Mozilla Firefox\firefox.exe" http://www.google.co.jp/
startbg "C:\Program Files\Mozilla Firefox\firefox.exe" -new-window http://www.google.co.jp/
AUTHOR
HigeDice ã²ããã¤ã¹
[email protected]
http://d.hatena.ne.jp/higedice/
ã½ã¼ã¹ããã°ã©ã
/* 2011/02/10 new http://d.hatena.ne.jp/higedice/ http://msdn.microsoft.com/ja-jp/library/cc422072.aspx */ #include <stdio.h> #include <string.h> #include <windows.h> void printUsage(void); void printError(const char *s); HINSTANCE doBackGround(const char *command, const char *opt); #define PROGRAM_NAME "startbg.exe" #define MAX_OPTION_LENGTH 1024 #define MAX_MSG_LENGTH 1024 long main(int argc, char* argv[]) { char opt[MAX_MSG_LENGTH] = ""; char errMsg[MAX_MSG_LENGTH] = ""; int len; int i; HINSTANCE h; if ( argc < 2 ) { printUsage(); return -1; } for ( i = 2, len = 1; i < argc; i++ ) { if ( strlen(argv[i]) + len + 1 > MAX_OPTION_LENGTH ) { printError("Too Long Command."); return -1; } strcat( opt, " " ); strcat( opt, argv[i] ); len += strlen(argv[i]); } h = doBackGround( argv[1], opt ); if ( (int)h > 32 ) { /* æ£å¸¸çµäº */ return 0; } switch ( (int)h ) { case 0: printError("ã¡ã¢ãªã¾ãã¯ãªã½ã¼ã¹ãä¸è¶³ãã¦ãã¾ãã"); break; case ERROR_FILE_NOT_FOUND: printError("æå®ããããã¡ã¤ã«ãè¦ã¤ããã¾ããã§ããã"); break; case ERROR_PATH_NOT_FOUND: printError("æå®ããããã¹ãè¦ã¤ããã¾ããã§ããã"); break; case ERROR_BAD_FORMAT: printError(".exe ãã¡ã¤ã«ãç¡å¹ã§ããWin32 ã® .exe ã§ã¯ãªããã.exe ã¤ã¡ã¼ã¸å ã«ã¨ã©ã¼ãããã¾ãã"); break; case SE_ERR_ACCESSDENIED: printError("ãªãã¬ã¼ãã£ã³ã°ã·ã¹ãã ããæå®ããããã¡ã¤ã«ã¸ã®ã¢ã¯ã»ã¹ãæå¦ãã¾ããã"); break; case SE_ERR_ASSOCINCOMPLETE: printError("ãã¡ã¤ã«åã®é¢é£ä»ããä¸å®å ¨ã¾ãã¯ç¡å¹ã§ãã"); break; case SE_ERR_DDEBUSY: printError("ã»ãã® DDE ãã©ã³ã¶ã¯ã·ã§ã³ãç¾å¨å¦çä¸ãªã®ã§ãDDE ãã©ã³ã¶ã¯ã·ã§ã³ãå®äºã§ãã¾ããã§ããã"); break; case SE_ERR_DDEFAIL: printError("DDE ãã©ã³ã¶ã¯ã·ã§ã³ã失æãã¾ããã"); break; case SE_ERR_DDETIMEOUT: printError("è¦æ±ãã¿ã¤ã ã¢ã¦ãããã®ã§ãDDE ãã©ã³ã¶ã¯ã·ã§ã³ãå®äºã§ãã¾ããã§ããã"); break; case SE_ERR_DLLNOTFOUND: printError("æå®ããããã¤ãããã¯ãªã³ã¯ã©ã¤ãã©ãªï¼DLLï¼ãè¦ã¤ããã¾ããã§ããã"); break; /* case SE_ERR_FNF: // ERROR_FILE_NOT_FOUND ã¨åãããã ã printError("æå®ããããã¡ã¤ã«ãè¦ã¤ããã¾ããã§ããã"); break; */ case SE_ERR_NOASSOC: printError("æå®ããããã¡ã¤ã«æ¡å¼µåã«é¢é£ä»ããããã¢ããªã±ã¼ã·ã§ã³ãããã¾ããã" "å°å·å¯è½ã§ã¯ãªããã¡ã¤ã«ãå°å·ãããã¨ããå ´åãããã®ã¨ã©ã¼ãè¿ãã¾ãã"); break; case SE_ERR_OOM: printError("æä½ãå®äºããã®ã«ååãªã¡ã¢ãªãããã¾ããã"); break; /* case SE_ERR_PNF: // ERROR_PATH_NOT_FOUND ã¨åãããã printError("æå®ããããã¹ããè¦ã¤ããã¾ããã§ããã"); break; */ case SE_ERR_SHARE: printError("å ±æéåãçºçãã¾ããã"); break; default: sprintf(errMsg, "æ³å®ããªãã¨ã©ã¼ãçºçãã¾ãããã¨ã©ã¼çªå·ï¼%d", (int)h); printError(errMsg); } return -1; } void printError(const char *s) { fprintf(stderr, "%s: %s\n", PROGRAM_NAME, s); } void printUsage(void) { fprintf(stderr, "\n"); fprintf(stderr, "Usage: startbg [command] [options]\n"); fprintf(stderr, "\n"); fprintf(stderr, "This program runs another following Windows execute file in the background\n"); fprintf(stderr, "like an ampersand (&) is at the end of the command line on UNIX shells.\n"); fprintf(stderr, "\n"); fprintf(stderr, "The called process runs in the current directory.\n"); fprintf(stderr, "So that directory is ROCKED while the sub process is running.\n"); fprintf(stderr, "\n"); fprintf(stderr, "http://d.hatena.ne.jp/higedice/\n"); } HINSTANCE doBackGround(const char *command, const char *opt) { HINSTANCE h; h = ShellExecute(NULL, "open", command, opt, NULL, SW_SHOW); return h; }