Christopher Parker (cparker) wrote in shell_scripting,
Christopher Parker

Batch Scripting

I know batch scripting doesn't have much to do with shell scripting, but I'm curious if anybody knows, anyway...

I'm looking for a way to implement the split() command in a batch script. I'm trying to take the current working directory (Set CWD=%CD%) and search for a certain parent directory within it. Any part of this directory before and up to the matching parent directory needs to be saved to a variable. I'm writing a bunch of batch scripts to be placed in subdirectories that are arbitrarily deep. These scripts are to call another script in a static location, however I do not wish to hard-code the absolute path. This suite of scripts should be able to be placed anywhere, whether it be in the root of a drive, or 5 levels down somewhere in some tools and utilities directory.

Anybody know off-hand how I'd accomplish something like this? I'm going to be working solely with Windows XP, so any batch tricks that only with with XP or newer are acceptable. I was just going to create a batch scripting-specific communituy, but... hmmm... actually, I think I will. I did: batch_scripting.
  • Post a new comment


    default userpic