글
Windows Vista 부터는 관리자 권한 문제로 잘 안됩니다 -_-;
아래와 같은 배치 파일을 만든다.
const char BAT_CONTENTS[] = ":Repeat\r\n"
"if not exist \"%s\" goto Run\r\n" // 새로받은파일이없으면실행
"del \"%s\"\r\n" // 예전꺼지움
"if exist \"%s\" goto Repeat\r\n" // 예전께아직있으면다시처음으로
":Repeat2\r\n"
"rename \"%s\" \"%s\"\r\n" // 새로받은거이름변경
"if exist \"%s\" goto Repeat2\r\n" // 새로받은게아직있으면처음으로
":Run\r\n"
"\"%s\""; // 실행
Native API에서 실행
ShellExecute(NULL, "open", BAT_FILE_NAME, NULL, NULL, SW_HIDE);
.NET 에서 실행
System.Diagnostics.Process.Start("실행파일경로\실행파일명.exe",파라메터)
System.Diagnostics.Process.Start("cmd.exe 명령어");
댓글