Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

shell question

31 views
Skip to first unread message

Pankaj

unread,
Dec 11, 2002, 1:51:54 PM12/11/02
to
Hi All

I need to execute an exe from vb application which requires that a
particular directory should be current
so before I execute this exe I need to make sure that current directory is a
particular one....

how can I do this ?
[Batch file is not an option neither modifying the called exe to change the
directory from exe itself]

Please help ?

Regards
Pankaj

Mike D.

unread,
Dec 11, 2002, 3:43:24 PM12/11/02
to

"Pankaj" <pa_i...@hotmail.com> wrote in message
news:#2TEaZUoCHA.2452@TK2MSFTNGP11...

Perhaps the ShellExecute API function, which allows you to pass a working
(or start in) directory. If that doesn't work, I think you'll have to ChDir
to the directory before executing the program.

Mike


Gale Green

unread,
Dec 11, 2002, 3:43:28 PM12/11/02
to
On Wed, 11 Dec 2002 10:51:54 -0800, "Pankaj" <pa_i...@hotmail.com>
wrote:

> Hi All
>
> I need to execute an exe from vb application which requires that a
> particular directory should be current
> so before I execute this exe I need to make sure that current directory is a
> particular one....
>
> how can I do this ?

Dim MyFolder As String
Dim CurrentFolder As String

MyFolder = "whatever"
CurrentFolder = CurDir$()

ChDrive MyFolder
ChDir MyFolder

Shell...

ChDrive CurrentFolder
ChDir CurrentFolder

If MyFolder is on the same drive as CurrentFolder (e.g., both on C:)
then you don't need the ChDrive calls.

Gale.

0 new messages