For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic > April 2005 > shell problem









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author shell problem
inquirer

2005-04-28, 8:55 am

I am having a problem with the shell command in vb6:

Shell "f:\filecode\filecode.exe /p " & pword & " /f ""temp1.doc"" /s " & sp
& " /d"

When I run this, the application calls for a value for the /p parameter.
pword is defined in the program as "password" so it should be ok.
Note that the /s parameter is passed across ok (sp is defined as "f:\temp
folder")
If I have
Shell "f:\filecode\filecode.exe /p ""password"" /f ""temp1.doc"" /s " & sp &
" /d"
the application runs ok.
Can anyone help please?
Is there a more foolproof way of calling an outside application and passing
parameters as variables?
Thanks
Chris


J French

2005-04-28, 8:55 am

On Thu, 28 Apr 2005 17:52:14 +1000, "inquirer" <noreply@noreply.com>
wrote:

>I am having a problem with the shell command in vb6:
>
>Shell "f:\filecode\filecode.exe /p " & pword & " /f ""temp1.doc"" /s " & sp
>& " /d"


S$ = Chr$(34) + pword + Chr$(34)
Shell "f:\filecode\filecode.exe /p " & S$ & " /f ""temp1.doc"" /s " &
sp & " /d"

You seem to be missing the quotes ( they are Chr$(34) )

Your best bet is to build the 'command' as a string
- then MsgBox it
- it makes debugging a lot easier
inquirer

2005-04-28, 8:55 pm

Thanks, that fixed it

"J French" <erewhon@nowhere.uk> wrote in message
news:427098a8.262686213@news.btclick.com...
> On Thu, 28 Apr 2005 17:52:14 +1000, "inquirer" <noreply@noreply.com>
> wrote:
>
sp[color=darkred]
>
> S$ = Chr$(34) + pword + Chr$(34)
> Shell "f:\filecode\filecode.exe /p " & S$ & " /f ""temp1.doc"" /s " &
> sp & " /d"
>
> You seem to be missing the quotes ( they are Chr$(34) )
>
> Your best bet is to build the 'command' as a string
> - then MsgBox it
> - it makes debugging a lot easier



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com