#include "stdafx.h" #include "windows.h" int _tmain(int argc, _TCHAR* argv[]) { // char * env ="A=1\0B=C\0"; // char * p = (char*) malloc (100); // strcpy (p, env); STARTUPINFO info; PROCESS_INFORMATION result; memset (&info, 0, sizeof (info)); info.cb = sizeof (info); BOOL ok = CreateProcess ( NULL, // lpApplicationName, "notepad abc.txt", // LPTSTR lpCommandLine, NULL, // lpProcessAttributes, NULL, // LPSECURITY_ATTRIBUTES lpThreadAttributes, FALSE, // bInheritHandles, 0, // dwCreationFlags, NULL, // LPVOID lpEnvironment, "C:\\WORK", // lpCurrentDirectory, & info, // lpStartupInfo, & result // lpProcessInformation ); if (ok) printf ("O.K. \n"); else printf ("ERROR \n"); printf ("Stiskni enter \n"); char c; scanf_s ("%c", &c); return 0; }