Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Change directory for DOS window

I have a DOS program that must be run from its directory
and will not accept paths. It is launched by a DOS batch
file. The batch file and the DOS program are in the same
directory. The batch file can be run with a path to the
required directory. When I run the batch file from a
macro with the correct path, the DOS file will not run
because the default directory is the root directory. I
would like to write a macro that will change the DOS
directory to the correct directory then run the batch
file. I can't do a directory change in the batch file
because some of the files for the DOS program have been
pre-set to look for files in a directory designated by the
batch file. Currently I can run the batch file from the
macro, I can run command.com to open a DOS window, but I
can't change the DOS directory THEN run the batch file.

Any help would be appreciated.

TIA,
Garry
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 170
Default Change directory for DOS window


"Garry" wrote in message
...
I have a DOS program that must be run from its directory
and will not accept paths. It is launched by a DOS batch
file. The batch file and the DOS program are in the same
directory. The batch file can be run with a path to the
required directory. When I run the batch file from a
macro with the correct path, the DOS file will not run
because the default directory is the root directory. I
would like to write a macro that will change the DOS
directory to the correct directory then run the batch
file. I can't do a directory change in the batch file
because some of the files for the DOS program have been
pre-set to look for files in a directory designated by the
batch file. Currently I can run the batch file from the
macro, I can run command.com to open a DOS window, but I
can't change the DOS directory THEN run the batch file.

Any help would be appreciated.

TIA,
Garry


Set the path variable in the batch file, the system looks in directories
specified in path when you attempt to execute a program

example

@echo off
set origpath=%path%
path d:\pcw;%path%
ed %1 %2
set path=%origpath%
set origpath=

This saves the existing path, adds the directory of interest to the
beginning of the path,
invokes the editor, and on termination of the editor, restores the path to
what it was before
and deletes the temporary variable used to hold the original
path.directories.

Keith


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
change directory to list default edbrog Excel Discussion (Misc queries) 2 January 31st 09 06:19 PM
Change directory Jeff Excel Discussion (Misc queries) 6 September 27th 06 04:08 PM
How can I change list into a directory format? Becky Ed Excel Worksheet Functions 1 August 3rd 06 05:25 PM
Takes too long for Filedialog to change directory File selection in office2003 Excel Discussion (Misc queries) 1 May 1st 06 05:33 AM
change directory for refresh data TxRaistlin Excel Discussion (Misc queries) 0 February 7th 05 09:09 PM


All times are GMT +1. The time now is 03:57 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"