test.c- #include <Windows.h>
- #include <stdio.h>
-
- int main()
- {
- STARTUPINFO si;
- PROCESS_INFORMATION pi;
- ZeroMemory(&si, sizeof(si));
- ZeroMemory(&pi, sizeof(pi));
- CreateProcess("test.bat", NULL, NULL, NULL, FALSE, CREATE_NEW_CONSOLE, NULL, NULL, &si, &pi);
- return 0;
- }
复制代码 test.bat- @echo off
- echo %WINDIR%
- pause
复制代码 output- C:\Windows
- Press any key to continue . . .
复制代码
|