mercredi 20 mai 2015

If statement in a for loop. Batch scripting,

I want to create a script that does the following: for every directory in a path; checks if the directory's name is "profiles" and if its not that, it runs a program.

This is what i have so far:

@ECHO OFF
setlocal enabledelayedexpansion

for /d %%i in ("\\server\c$\path\*") do (
  set filename=%%~NXi
  IF !filename!=="profiles"(
  ) ELSE (
    mycommand.exe
  )
)

This code just returns an "invalid command syntax" error.

Aucun commentaire:

Enregistrer un commentaire