Running Program cmd

Got a problem you cannot solve? Try here.
Post Reply
KennethLee
Posts: 16
Joined: Wed Sep 16, 2009 4:00 pm

Running Program cmd

Post by KennethLee »

Hi again,

I may have found a bug? Not sure, but I know for sure what I'm trying to do is not working.

I'm using the Run Program statement and trying to run the command,
cmd /c xcopy /e "$TARGETDIR$\\Config" "$TARGETDIR\\Backup $VERSION\\Config\\" as such:

Code: Select all

 Run Program cmd /c xcopy /e "$TARGETDIR$\\Config" "$TARGETDIR\\Backup $VERSION\\Config\\" (WAIT)
This does not seem to work. I tried doing this:

Code: Select all

Set Variable TEST to /c xcopy /e "$TARGETDIR$\\Config" "$TARGETDIR\\Backup $VERSION\\Config\\"
Run Program cmd $TEST$ (WAIT)
it works.

Why is an intermediate variable necessary? And please fix.

Thanks,
Kenneth

P.S. Also when I add a message box to show the command, it shows the following:

---------------------------
Test
---------------------------
cmd /c xcopy "C:\\\\TestApp\\Config" "C:\\\\TestApp\\Backup 3.3\\Config\\"
---------------------------
OK
---------------------------

The code for the above message box is:
MessageBox: Test, cmd /c xcopy /e "$TARGETDIR$\\Config" "$TARGETDIR\\Backup $VERSION\\Config\\"

There seems to be a double slash for C:\\\\
Bar_BQ
Posts: 99
Joined: Fri Aug 22, 2008 5:45 am

Post by Bar_BQ »

Hi,


It's not necessary to run cmd command. You may run xcopy.exe without cmd. All copy parameters put to Command line parameters field. I used it many times and there were no problems.
KennethLee
Posts: 16
Joined: Wed Sep 16, 2009 4:00 pm

Post by KennethLee »

Good call there Bar_BQ, I didn't notice that xcopy is a program, unlike copy. I'll try using xcopy without the cmd. Thanks.

Still kind of strange that an intermediate variable is required for the Run Program to run the cmd command with arguments properly, but my problem is fixed.

=)
Post Reply