Reputation: 37
I would like to run command line utility recursively for all folders in windows. I have tried with the following, but not succesfully.
FOR /R "C:\AMDB\30-Apr-2013\Input\" %%G in (.) DO (
shp2sdo.exe %%~ni %%~ni -g geometry -d -x (-180,180) -y (-90,90) -s 8307 -t 0.5 -v
Pushd %%G
Echo now in %%G
Popd )
Echo "back home"
Upvotes: 0
Views: 254
Reputation: 130819
The reason your code does not execute is because the )
characters in your SHP2SDO.EXE arguments are closing your FOR DO loop prematurely. Those parentheses need to be escaped:
FOR /R "C:\AMDB\30-Apr-2013\Input\" %%G in (.) DO (
shp2sdo.exe %%~ni %%~ni -g geometry -d -x (-180,180^) -y (-90,90^) -s 8307 -t 0.5 -v
Pushd %%G
Echo now in %%G
Popd
)
Echo "back home"
Upvotes: 0
Reputation: 37569
try this:
@echo off &setlocal
FOR /R /D "C:\AMDB\30-Apr-2013\Input" %%G in (*) DO (
Pushd "%%G"
shp2sdo.exe "%%~ni" "%%~ni" -g geometry -d -x (-180,180) -y (-90,90) -s 8307 -t 0.5 -v
Echo now in %%G
Popd
)
Echo "back home"
Upvotes: 1
Reputation: 80013
We have no idea of what you mean by "successfully." We can conclude it's not doing what you expect, otherwise you'd not be asking the question.
Now - is the problem that it's not running your utility in "all folders"?
"C:\AMDB\30-Apr-2013\Input\"
and
directories in that subtree.Are you showing us just the part you believe is at fault?
shp2sdo.exe %%~nG
rather than shp2sdo.exe %%~ni
would
work better for youOr is it not giving you what you expect when you ECHO now in %%G
?
Upvotes: 0