dimanche 1 mars 2015

batch file string comparison if condition for loop

If condition of the code below does not work. why? The aim of the code is to list names of directories included in a directory, name of which not start with underscore.


code:



@ECHO off
setlocal enabledelayedexpansion
SET "ptka="
SET "ptkb="
FOR /d %%a IN (*) DO (
SET "ptka=%%a"
SET "ptkb=!ptka:~0,1!"
IF NOT "!ptkb!"=="_" ECHO !ptka!>>list.txt :: ("!ptkb!"=="_") part is not working
)

Aucun commentaire:

Enregistrer un commentaire