string substituation within for loop
Posted: 03 May 2010 00:15
Hello,
i want to decrypt every file within a folder. For this task i need the filename without the directory part. So i tried the following:
@echo off
SET SrcDir=C:\scripts\SrcDir
SET DestDir=C:\scripts\DestDir
for %%D in ("%SrcDir%"\*.*) do (
SET FILE=%%D
SET FILE=%file:C:\Scripts\SrcDir\=%
TOOL.exe --output %DestDir%\dec_%file% --decrypt
)
%%D returns the full file path e.g C:\scripts\SrcDir\test.txt
Maybe it is possible to write something like that:
SET FILE=%file:%SrcDir%=%
Thank you for help.
Viper
i want to decrypt every file within a folder. For this task i need the filename without the directory part. So i tried the following:
@echo off
SET SrcDir=C:\scripts\SrcDir
SET DestDir=C:\scripts\DestDir
for %%D in ("%SrcDir%"\*.*) do (
SET FILE=%%D
SET FILE=%file:C:\Scripts\SrcDir\=%
TOOL.exe --output %DestDir%\dec_%file% --decrypt
)
%%D returns the full file path e.g C:\scripts\SrcDir\test.txt
Maybe it is possible to write something like that:
SET FILE=%file:%SrcDir%=%
Thank you for help.
Viper