Solved How Batch/Scripting can Mk Dir and just look at the beginnin

February 4, 2020 at 12:32:29
Specs: Windows 10
%%aI have a question about 'wildcards' - I have a counter make directory 'Windows Command script' I made - the question - they want to rename and a 'job title' after the job number - (ie below_ - '20-0101' the counter works perfect for 20-0102, 20-0103, etc. But, if they add the job title 20-0102 -P&G Hand rail job - The script will create a 20-0102 folder again, instead of 20-0103 and so on.

Is there a way I can add a 'wildcard' in my script like:

@echo off
set counter=101
mkdir "20-0101***" 1>nul || goto :TryNext
To make it just look at the beginning part of the name for the counter (20-0101)

@echo off
set counter=101
mkdir "20-0101" 1>nul || goto :TryNext
:continue
REM rest of your code

goto :eof
:TryNext
set /a counter+=1
mkdir "20-0%counter%" 2>nul || goto :TryNext
mkdir "20-0%counter%\BOM & Shipping List"
mkdir "20-0%counter%\P.O"
mkdir "20-0%counter%\ProNest Outputs"
mkdir "20-0%counter%\Shipping"

goto :continue
Thanks in advance!


See More: How Batch/Scripting can Mk Dir and just look at the beginnin

Reply ↓  Report •

#1
February 5, 2020 at 03:24:05
✔ Best Answer
see:     

https://www.computing.net/answers/p...

i5-6600K[delid]@4.8GHz Core/4.6 Cache@1.456v | 2x8GB DDR4-3200MHzCL12-12-12-28-1@1.5v | Sapphire Nitro+ SE RX 590 8GB@1610Mhz core@1.13v/2236MHz


Reply ↓  Report •
Related Solutions


Ask Question