Prev: formattting numbers
Next: MSFlexgrid Scrolling
From: NadCixelsyd on 17 Apr 2010 08:32 > > >I call my VB (5.0) application from DOS. Under certain circumstances, > >I wish to exit the VB application in a different directory. My VB > >program issues the ChDir statement, but when I end the program and go > >back to DOS, the DOS directory has not changed. Is there a way to do > >this? > > No > If that is not possible .... Is it possible to spawn a new DOS window and have the directory be pointing to the CHDIR that I selected?
From: dpb on 17 Apr 2010 10:01 NadCixelsyd wrote: >>> I call my VB (5.0) application from DOS. Under certain circumstances, >>> I wish to exit the VB application in a different directory. My VB >>> program issues the ChDir statement, but when I end the program and go >>> back to DOS, the DOS directory has not changed. Is there a way to do >>> this? >> No >> > If that is not possible .... Is it possible to spawn a new DOS window > and have the directory be pointing to the CHDIR that I selected? Only by either executing a CHDIR in the new session or creating an autostart .bat file that contains the desired CHDIR or some such subterfuge before exiting that the new session can execute. You don't seem to ken the other session is another session... :) --
From: ralph on 17 Apr 2010 10:26 On Sat, 17 Apr 2010 05:32:13 -0700 (PDT), NadCixelsyd <nadcixelsyd(a)aol.com> wrote: >> >> >I call my VB (5.0) application from DOS. �Under certain circumstances, >> >I wish to exit the VB application in a different directory. �My VB >> >program issues the ChDir statement, but when I end the program and go >> >back to DOS, the DOS directory has not changed. �Is there a way to do >> >this? >> >> No >> >If that is not possible .... Is it possible to spawn a new DOS window >and have the directory be pointing to the CHDIR that I selected? I'm sure it is. Details will depend on how you want the 'presentation' to appear to the User. For example, you could create a Console App that would run in a DOSPrompt Window. This console app (call him 'Launcher') launches your Application and catches the return - and uses the return to launch a new Console App which launches your app, etc. This would appear as a series of commands within a single DOSPrompt window - but in fact it would be an ever increasing stack of "cmds". A corollary to this would be a single Console App that writes back to the DosPrompt - ie, never goes away but does a chdir on itself. (as per Karl). If you don't mind the flash of a new DOSPrompt window (which will slightly stagger if using default location) you can have the original disappear and the Launcher create a new one. (Perhaps recording original location and placing it back.) Working with Console Applications takes on a 'Rube Goldberg' appearance in VB because VB doesn't 'directly' support creating them. However, there are several sites on the web that provide 'VB Console' examples. Especially look for those with Karl's name attached. Check out the examples, devise a strategy you can live with, then post your code if you get stuck. -ralph
From: Nobody on 17 Apr 2010 10:31
Why not use VB to do what you want to do using DOS? The Command() function gives you the command line. While VB built-in statements don't copy or move entire folders, and therefore you have to make looping code, but an "easier" way is to use SHFileOperation() which lets you do all these things. Search the web or newsgroups for samples. |