Change directory in path string?
Posted: 01 Nov 2013 07:52
Hi! I'm working on a batch file in MS-DOS 6.21.
I'm wondering if it's possible to write a batch file that will change the first directory name in a path string.
Here's an example of what I'm trying to do:
E:\PROJECT.DIR\DRAFT1\PROJECT.TXT
A:\PROJECT.BK1\DRAFT1\PROJECT.TXT
I've figured out how to change the Drive name, e.g. changing "E:\" to "A:". That was easy, because it's just the first three characters in the string.
But is it possible to search a string for the name of that first directory in the string and then change the three letter extension between the "dot" and the second "\"?
Will in Seattle
a.k.a. "Clueless"
Can a batch file in my old version of DOS pull off that trick? Or am I going to have to dig out my old version of BASIC for DOS and try to remember how to write programs with it?
I'm wondering if it's possible to write a batch file that will change the first directory name in a path string.
Here's an example of what I'm trying to do:
E:\PROJECT.DIR\DRAFT1\PROJECT.TXT
A:\PROJECT.BK1\DRAFT1\PROJECT.TXT
I've figured out how to change the Drive name, e.g. changing "E:\" to "A:". That was easy, because it's just the first three characters in the string.
But is it possible to search a string for the name of that first directory in the string and then change the three letter extension between the "dot" and the second "\"?
Will in Seattle
a.k.a. "Clueless"
Can a batch file in my old version of DOS pull off that trick? Or am I going to have to dig out my old version of BASIC for DOS and try to remember how to write programs with it?