How do I create a Windows script that executes the command:
C:\ZP4\AUTOFIXD C:\FOLDER\PARCELS.DBF \HOME\LIST.LAY SKIPFIRST UPLOW
for any and all PARCELS.DBF files that might be in \FOLDER\
and all subdirectories.
I.e the script would be equivalent to:
C:\ZP4\AUTOFIXD 开发者_如何学Python\FOLDER\PARCELS.DBF \HOME\LIST.LAY SKIPFIRST UPLOW
C:\ZP4\AUTOFIXD \FOLDER\SUBFOLDER1\PARCELS.DBF \HOME\LIST.LAY SKIPFIRST UPLOW
C:\ZP4\AUTOFIXD \FOLDER\SUBFOLDER1\SUBSUBFOLDER2\PARCELS.DBF \HOME\LIST.LAY SKIPFIRST UPLOW
...etc.
but only for each PARCELS.DBF file that actually exists.
\HOME\LIST.LAY SKIPFIRST UPLOW
are unchanging parameters used by AUTOFIXD
.
If powershell is an option, I'd recommend it.
In PS:
$files = gci -r C:\ | where {$_.Name -eq 'PARCELS.DBF'}
foreach ($file in $files)
{
C:\ZP4\AUTOFIXD $file \HOME\LIST.LAY SKIPFIRST UPLOW
}
untested as I don't have ZP4 on this box, but basic premise should work
The for
command can iterate over things. So assuming that you either have no Unicode file names or use a TrueType font for your console window:
for /f "delims=" %%x in ('dir /s /b PARCELS.DBF') do C:\ZP4\AUTOFIXD "%%x" \HOME\LIST.LAY SKIPFIRST UPLOW
精彩评论