2012-01-31 201 views

回答

0

我不知道什麼${FILE}呢,下面運行;

gdal_translate -outsize 25% 25% "XXX.tif" "../lowres/XXX.tif" 

for each .tif in the current directory;

@echo off 
setlocal enabledelayedexpansion 
for %%f in (*.tif) do (
    set newfile=../lowres/%%f 
    gdal_translate -outsize 25%% 25%% "%%f" "%newfile%" 
) 
+0

$ {FILE}保持輸出文件名相同,輸入 – 2012-01-31 11:06:17

+0

非常感謝許多! – 2012-01-31 11:37:45

0
@echo off 

for %%A in (*.tif) do @call somecommand -outsize 25%% 25%% "%%~nxA" "../lowres/%%~nxA" 

REM or 

setlocal ENABLEDELAYEDEXPANSION 
for %%A in (*.tif) do (
    set newfile=../lowres/%%~nxA 
    call somecommand -outsize 25%% 25%% "%%~nxA" "!newfile!" 
) 

有關〜變量擴展和set /?關於延遲擴展細節更多細節運行for /? ...

+0

〜nxA?不知道這是怎麼回事......它會產生錯誤,但不幸的是 – 2012-01-31 11:38:24

+0

@RobertBuckley %% A是for命令的輸出(路徑取決於你在「in(xyz)」部分中傳遞的內容),%%〜A去掉引號並啓用其他事物的擴展,nx = name + extension。 %% A可能適用於你的情況。做「調試」你可以用echo替換呼叫,看看你會執行什麼... – Anders 2012-01-31 11:55:23

相關問題