batch file - unlogic FOR loop in cmd -


Actually I want to use a variable instead of just the permutation value.

I have a loop, and it works.

  set OS_ROOT =% systemdrive% for / f "delims =" %% A IN ('DIR E: \ backup / A: D / o: -d / TW / b') ( Execopy / EE: \ Backup %% A% OS_ROOT% \ TempFestplatte)  

But as soon as I implement the variable:

  SET STICK_ROOT =% CD: ~ 0,3%  

which celebrates being "e: \", and uses it in my loop:

  / F "Delay =" %% A in (for 'DIR% STICK_ROOT% \ BACKUP / A: D / O: -D / TW / B') (ABC / E% STICK_ROOT% \ BACKUP \ %% A% OS_ROOT% \ TempFestplatte)  

This does not work any moore After "DIR (...) is

Why?

Avoid double backslashes in the context of the root folder of the drive.

  :: Set the variable in the context of the current directory drive set "STICK_ROOT =% cd: ~ 0,2%" :: Set the current set of batch file drives "STICK_ROOT =% ~ D0 " 

Not sure which of the two would be better in your case.


Comments