Shell function 
Author Message
 Shell function

I am trying to execute using the Shell function the
following P4 command:

p4 opened -c default > D:\P4CHGLST.TXT

using the following syntax:
CommandLine$ = "p4 opened -c default > D:\P4CHGLST.TXT"
ReturnValue = Shell(CommandLine$, vbHide)

although Returnvalue is <> 0 the command does not get
executed.

I am able to execute the command using a batch file with
the following syntax:
Open C:\TEST.BAT For Output As #99
CommandLine$ = "p4 opened -c default > D:\P4CHGLST.TXT"
Print #99, CommandLine$
Close #99
ReturnValue = Shell(C:\TEST.BAT, vbHide)

It is not clear to me why the first option does not work
and, using the second one I loose track of the real
command because ReturnValue is related to the batch file
and not to the real operation I want to execute.

Am I doing something wrong in the first option, which is
the one I need to use?

Any suggestion.

Thanks,

Gabriele Centinaro



Sun, 28 Dec 2003 23:59:17 GMT  
 Shell function
The reason is the "> D:\P4CHGLST.TXT" part which relies on the command
interpreter (CMD.EXE or COMMAND.COM). Using the batch file automatically
executes the command interpreter, but the Shell command doesn't.

You could try "CMD /c p4 opened -c default > D:\P4CHGLST.TXT" or "COMMAND /c
p4 opened -c default > D:\P4CHGLST.TXT" depending upon the COMSPEC setting.

Ade.


Quote:
> I am trying to execute using the Shell function the
> following P4 command:

> p4 opened -c default > D:\P4CHGLST.TXT

> using the following syntax:
> CommandLine$ = "p4 opened -c default > D:\P4CHGLST.TXT"
> ReturnValue = Shell(CommandLine$, vbHide)

> although Returnvalue is <> 0 the command does not get
> executed.

> I am able to execute the command using a batch file with
> the following syntax:
> Open C:\TEST.BAT For Output As #99
> CommandLine$ = "p4 opened -c default > D:\P4CHGLST.TXT"
> Print #99, CommandLine$
> Close #99
> ReturnValue = Shell(C:\TEST.BAT, vbHide)

> It is not clear to me why the first option does not work
> and, using the second one I loose track of the real
> command because ReturnValue is related to the batch file
> and not to the real operation I want to execute.

> Am I doing something wrong in the first option, which is
> the one I need to use?

> Any suggestion.

> Thanks,

> Gabriele Centinaro



Mon, 29 Dec 2003 02:12:05 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Shell Function not shelling under Windows NT.

2. The Shell Function

3. Shell function

4. Shell Function

5. Browsing for Printers using SHBrowseForFolder Shell Function

6. Problem using Shell Function with MS Wordpad

7. Shell Function and paths

8. shell function and output

9. Shell Function

10. Shell function

11. shell function problem

12. shell function probs

 

 
Powered by phpBB® Forum Software