chcp 65001
@echo off
echo .

del List.txt
del List2.txt
del InitialDownloadList.ini

dir /b /a-d /s > List.txt

echo .

set BEFORE_STRING=%~dp0
set AFTER_STRING=

set INPUT_FILE=List.txt
set OUTPUT_FILE=List2.txt

setlocal ENABLEDELAYEDEXPANSION
for /f "delims=" %%a in (%INPUT_FILE%) do (
set line=%%a
echo !line:%BEFORE_STRING%=%AFTER_STRING%!>>%OUTPUT_FILE%
)

del List.txt

type List2.txt | find /v "List.bat" > List.txt
del List2.txt
type List.txt | find /v "List.txt" > List2.txt

echo .

set BEFORE_STRING=\
set AFTER_STRING=/

set INPUT_FILE=List2.txt
set OUTPUT_FILE=InitialDownloadList.ini

setlocal ENABLEDELAYEDEXPANSION
for /f "delims=" %%a in (%INPUT_FILE%) do (
set line=%%a
echo !line:%BEFORE_STRING%=%AFTER_STRING%!>>%OUTPUT_FILE%
)
echo ok
del List.txt
del List2.txt

@PAUSE
