Click here to Skip to main content
15,911,039 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Problem in FTP Downloading Pin
Code-o-mat23-Feb-09 23:43
Code-o-mat23-Feb-09 23:43 
GeneralRe: Problem in FTP Downloading Pin
raj157623-Feb-09 23:53
raj157623-Feb-09 23:53 
GeneralRe: Problem in FTP Downloading Pin
Code-o-mat24-Feb-09 0:14
Code-o-mat24-Feb-09 0:14 
QuestionODBC timeout Pin
chuengchuenghq23-Feb-09 21:26
chuengchuenghq23-Feb-09 21:26 
AnswerRe: ODBC timeout Pin
chuengchuenghq23-Feb-09 21:36
chuengchuenghq23-Feb-09 21:36 
AnswerRe: ODBC timeout Pin
CPallini23-Feb-09 21:46
mveCPallini23-Feb-09 21:46 
AnswerRe: ODBC timeout Pin
Eytukan23-Feb-09 21:47
Eytukan23-Feb-09 21:47 
QuestionHow do I redirect output of my console using PsExec? Pin
SherTeks23-Feb-09 21:20
SherTeks23-Feb-09 21:20 
I'm using a remote execution tool called 'PsExec' from sysinternals.

I use it this way in my command prompt :

D:\Tools\Testing>psexec netsh firewall show opmode>D:\Log.txt

This generates the output for 'netsh firewall show opmode' and redirects to D:\Log.txt

Now, I implement the same logic/code in my application like this :

CString	csCmdLineParams = "netsh firewall show opmode>D:\\TestdwLog.txt";

STARTUPINFO		StartUpInfo;
PROCESS_INFORMATION	ProcInfo;

DWORD	ExitCode = -1;

memset(&StartUpInfo, 0, sizeof(StartUpInfo));

memset(&ProcInfo, 0, sizeof(ProcInfo));

StartUpInfo.dwFlags = STARTF_USESHOWWINDOW;

StartUpInfo.wShowWindow = SW_SHOW;

CreateProcess( "C:\\windows\\system32\\cmd.exe", csCmdLineParams.GetBuffer(csCmdLineParams.GetLength() + ONE), NULL, NULL, NULL, CREATE_DEFAULT_ERROR_MODE, NULL, NULL, &StartUpInfo, &ProcInfo);

WaitForSingleObject(ProcInfo.hProcess, INFINITE);

GetExitCodeProcess(ProcInfo.hProcess, &ExitCode );

if (ExitCode) {
	csCmdLineParams.ReleaseBuffer();
	CloseHandle(ProcInfo.hProcess);
}

csCmdLineParams.ReleaseBuffer();

CloseHandle(ProcInfo.hProcess);


But, I'm not able to redirect the output to D:\TestdwLog.txt. In fact the file is not created itself.

Note : I do have administrator rights for my system. [required for PsExec]

What am I doing wrongly ?

I also tried

StartUpInfo_IDI.dwFlags = STARTF_USESTDHANDLES; instead of StartUpInfo.dwFlags = STARTF_USESHOWWINDOW;

Replies would be appreciated

Thanks in advance.
AnswerRe: How do I redirect output of my console using PsExec? Pin
Garth J Lancaster23-Feb-09 21:52
professionalGarth J Lancaster23-Feb-09 21:52 
AnswerRe: How do I redirect output of my console using PsExec? Pin
David Crow24-Feb-09 3:24
David Crow24-Feb-09 3:24 
GeneralRe: How do I redirect output of my console using PsExec? Pin
SherTeks24-Feb-09 17:31
SherTeks24-Feb-09 17:31 
QuestionUsing MSXML Parser in the VC++ 2005 Express Edition Pin
Ajit Jadhav23-Feb-09 21:18
Ajit Jadhav23-Feb-09 21:18 
AnswerRe: Using MSXML Parser in the VC++ 2005 Express Edition Pin
Eytukan23-Feb-09 21:29
Eytukan23-Feb-09 21:29 
AnswerRe: Using MSXML Parser in the VC++ 2005 Express Edition Pin
Stuart Dootson23-Feb-09 22:55
professionalStuart Dootson23-Feb-09 22:55 
GeneralRe: Using MSXML Parser in the VC++ 2005 Express Edition Pin
Ajit Jadhav24-Feb-09 6:19
Ajit Jadhav24-Feb-09 6:19 
GeneralRe: Using MSXML Parser in the VC++ 2005 Express Edition Pin
Stuart Dootson24-Feb-09 6:28
professionalStuart Dootson24-Feb-09 6:28 
Questionhow can i see the fucntions available in the dll file. Pin
hariakuthota23-Feb-09 21:14
hariakuthota23-Feb-09 21:14 
AnswerRe: how can i see the fucntions available in the dll file. Pin
KarstenK23-Feb-09 21:28
mveKarstenK23-Feb-09 21:28 
AnswerRe: how can i see the fucntions available in the dll file. Pin
Archy_Yu23-Feb-09 21:42
Archy_Yu23-Feb-09 21:42 
GeneralRe: how can i see the fucntions available in the dll file. Pin
Chandrasekharan P23-Feb-09 21:52
Chandrasekharan P23-Feb-09 21:52 
Questionmultithreading and read only STL container Pin
manustone23-Feb-09 20:57
manustone23-Feb-09 20:57 
AnswerRe: multithreading and read only STL container Pin
KarstenK23-Feb-09 21:30
mveKarstenK23-Feb-09 21:30 
GeneralRe: multithreading and read only STL container Pin
manustone23-Feb-09 22:21
manustone23-Feb-09 22:21 
AnswerRe: multithreading and read only STL container Pin
Eytukan23-Feb-09 21:33
Eytukan23-Feb-09 21:33 
GeneralRe: multithreading and read only STL container Pin
manustone23-Feb-09 22:21
manustone23-Feb-09 22:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.