Extract the last sub-dir name to use in creating a new sub-dir

Hi,

I'm trying to do something in windows that I do in a linux script.

I want to add a sub-dir in a path that uses the the last sub-dir in the path as part of the name.

C:\hold\test\

Need to have  this happen

C:\hold\test\bob-test\

the path needs to be a variable because it needs to be done in whatever sub-dir I run it in.

I'm new to windows CLI.  Not sure if this needs powershell or can be done in cmd and it will be part of a script or batch file depending.

In my linux script I use 

mkdir 'bob - '"${PWD##*/}"

I've been fiddling with split-path but can't figure out how to have the current dir not be a constant.

split-path d:\hold\test  -leaf

returns test

need to get d:\hold\test to be just read in.

I know, my terminology stinks, I just don't script; even in linux I just kludge stuff together.  When it works I don't know why it just does so bear with me and forgive my ignorance; I'm trying to correct it.

Parents Reply Children
No Data