Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'am using Windows cmd to calculate some variables. The command works fine:

gut adapt_gf -InFile -OutFile

However, I have many sla values (,sla2, sla3, etc).

Is there a way (for loop) so that I don't have to type inn all sla values and also change the OutFile values (sla_grid1,sla_grid2,sla_grid3, etc) each time?


share|improve this question

1 Answer 1

@echo off
setlocal enabledelayedexpansion

for %%f in (*.nc) do (
    set OUT=%%f
    @echo gut adapt_gf -InFile %%f -OutFile sla_grid!OUT:~3!
    gut adapt_gf -InFile %%f -OutFile sla_grid!OUT:~3!
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.