Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to set up the startup directory for a shell statement

Status
Not open for further replies.

Modex

Programmer
Sep 15, 2002
155
0
0
GB
Hi All,

I wonder if someone could help me please, I am in the process of writing a little menu program in VB6 to run on windows 98 which will load up some of my classic old time games that do not run on XP any more.

The trouble I’ve got with one particular game is that it want to start running in its own directory and if I just call

Str3 = shell(“C:\wingames\incoming\incoming.exe”)

It fails, I have tried running a couple of other shell commands prior to this, such as

Str1 = shell(“C:\command.com /c C:”)
Str2 =shell(“C:\command.com /c cd c:\wingames\incoming”)

Unfortunately that does not work either.

So I suppose what I’m asking for, (in a long winded way) is a way to code in the running directory of a shell statement.

Any help or pointers would be gratefully received

Many thanks

ModeX
 
Try creating a batch file in the working directory which runs your EXE file, then shell to the batch file instead. This usually works for me (it's worth a try).
 
I believe what you're looking for is the ChDir function...


ChDir "C:\mydir"

if you need to switch drive then use ChDrive first:

ChDrive "C:
 
Specialkfx, Bjd4jc.

Thanks guys, much appreciated for the pointers.

Specialkfx, I was using batch files to do it all first of all and it it does work perfectly as per your advise, however, I was trying to get the whole thing working from just one exe, created by VB6 with no batch dependancies.

Bjd4jc, Thanks for this pointer, I'll check it out today and see if it does the job.

Thanks again guys, much appreciated.

ModeX
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top