Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
@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.