I would like a batch script to all the text documents in a folder. This is what I have managed so far:
@ECHO off
title Test
set dir1=C:UsersFamilyDesktopExample
:Start
cls
echo 1. test loop
echo 2. Quit
set /p choice=I choose (1,2):
if %choice%==1 goto test
if %choice%==2 exit
:test
cls
echo running loop test
FOR %%n in (%dir1% *.txt) DO echo %dir1%\%%n
echo Done
pause
What I would like outputted is:
running loop test
C:UsersFamilyDesktopExampledoc 1.txt
C:UsersFamilyDesktopExampledoc 2.txt
Done
But I Get this:
running loop test
C:UsersFamilyDesktopExampleC:UsersFamilyDesktopExample
C:UsersFamilyDesktopExampledoc 1.txt
C:UsersFamilyDesktopExampledoc 2.txt
Done
See Question&Answers more detail:os