I am attempting to translate a makeshift Linux script to a Windows command line. Although my current script is not sophisticated, it manages to function.

rar a -r0 boomer.rar
#combines all the files into a rar file
mkdir 'rar - '"${PWD##*/}"
#makes a new sub-dir named the same as parent with "rar - " prepended
cp boomer.rar 'rar - '"${PWD##*/}"
#copies boomer.rar to the new folder (see below*)
rm boomer.rar
#removes rar file *becuse I couldn't just get it to move in linux
cd 'rar - '"${PWD##*/}"
# move focus to new dir
for fname in *.rar
mv $fname 'boomer - '"$(pwgen 26 1).rar"
#renames files 

However, I am struggling with the “${PWD##*/}” part, which is intended to only obtain the name of the directory, rather than the entire path. I require assistance with this aspect.

I have no background in coding, and I pieced together this script by searching for steps on forums like this. As a result, I am not well-versed in the code I employed, and I apologize for that. Sometimes, I just happened to get it right.

Individuals within my group have requested that I make this operational on Windows. Since I am catering to the lowest common denominator, I am employing batch files rather than installing WSL or opting for vanilla Windows.

If this task proves too challenging, I am content with abandoning it. I am willing to provide additional information if necessary, but I am uncertain what is needed until instructed.

Askify Moderator Edited question April 26, 2023