Click here to Skip to main content
16,011,947 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Create Directory Pin
Jack Puppy24-Jul-05 13:18
Jack Puppy24-Jul-05 13:18 
GeneralRe: Create Directory Pin
Archer28224-Jul-05 15:19
Archer28224-Jul-05 15:19 
GeneralRe: Create Directory Pin
Jack Puppy24-Jul-05 16:04
Jack Puppy24-Jul-05 16:04 
GeneralRe: Create Directory Pin
picasso224-Jul-05 19:11
picasso224-Jul-05 19:11 
GeneralRe: Create Directory Pin
David Crow25-Jul-05 3:50
David Crow25-Jul-05 3:50 
GeneralRe: Create Directory Pin
Archer28225-Jul-05 11:38
Archer28225-Jul-05 11:38 
GeneralRe: Create Directory Pin
David Crow25-Jul-05 16:56
David Crow25-Jul-05 16:56 
QuestionHowTo get ShellExecute to run a command file? Pin
Robert Palma Jr.24-Jul-05 10:44
Robert Palma Jr.24-Jul-05 10:44 
Visual Studio 6.0, C/C++

I would like to run a command (batch) file from within
my app that, among other things, copies some files that
are passed to it on startup.

In the 4th parameter of ShellExecute() I have 2 parameters
separated by a blank space.

=== the command file: copy.cmd
@echo off
REM the echo command is a dignostic.
echo 1 >> log.txt
copy %1 c:\dir1
copy %2 c:\dir2

=== the Shell Execute() call
ShellExecute(NULL, "open", "copy.cmd","C:\\file1.txt C:\\file2.txt", NULL, SW_SHOWNORMAL);

When this runs I get a quick flash of the screen.
I'm guessing that a command window is opening and
immediately closing.

The command file does not seem to run.

I've tried various machinations like running
cmd.exe in parameter 3, but still can't get
my command file to execute.

Any help would be very much appreciated Smile | :)

Robert




AnswerRe: HowTo get ShellExecute to run a command file? Pin
valikac24-Jul-05 13:23
valikac24-Jul-05 13:23 
GeneralRe: HowTo get ShellExecute to run a command file? Pin
Robert Palma Jr.25-Jul-05 9:17
Robert Palma Jr.25-Jul-05 9:17 
AnswerRe: HowTo get ShellExecute to run a command file? Pin
KeyL24-Jul-05 17:34
KeyL24-Jul-05 17:34 
GeneralRe: HowTo get ShellExecute to run a command file? Pin
Robert Palma Jr.25-Jul-05 9:19
Robert Palma Jr.25-Jul-05 9:19 
AnswerRe: HowTo get ShellExecute to run a command file? Pin
Ritu Kwatra24-Jul-05 18:50
Ritu Kwatra24-Jul-05 18:50 
GeneralRe: HowTo get ShellExecute to run a command file? Pin
Robert Palma Jr.25-Jul-05 9:20
Robert Palma Jr.25-Jul-05 9:20 
GeneralRe: HowTo get ShellExecute to run a command file? Pin
Parikshit97919-Dec-10 21:12
Parikshit97919-Dec-10 21:12 
Generalplacing a toolbar in a CReBar Pin
gabriel.fischer24-Jul-05 9:30
gabriel.fischer24-Jul-05 9:30 
GeneralCalling CDocument::OnOpenDocument(LPCTSTR lpszPathName) Pin
vasanth100424-Jul-05 6:38
vasanth100424-Jul-05 6:38 
GeneralSet font Info for TextOut function Pin
Abd.Eskandari24-Jul-05 5:49
Abd.Eskandari24-Jul-05 5:49 
Questionwhat means -1.#IND000? Pin
gabriel.fischer24-Jul-05 4:52
gabriel.fischer24-Jul-05 4:52 
AnswerRe: what means -1.#IND000? Pin
Chris Losinger24-Jul-05 5:01
professionalChris Losinger24-Jul-05 5:01 
AnswerRe: what means -1.#IND000? Pin
toxcct24-Jul-05 5:30
toxcct24-Jul-05 5:30 
GeneralActive Document Server HELP! Pin
Bruce Pataki24-Jul-05 0:46
Bruce Pataki24-Jul-05 0:46 
GeneralRe: Active Document Server HELP! Pin
Gary R. Wheeler24-Jul-05 3:16
Gary R. Wheeler24-Jul-05 3:16 
GeneralRe: Active Document Server HELP! Pin
Bruce Pataki25-Jul-05 4:47
Bruce Pataki25-Jul-05 4:47 
GeneralRe: Active Document Server HELP! Pin
Gary R. Wheeler25-Jul-05 15:41
Gary R. Wheeler25-Jul-05 15:41 

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.