1.

Solve : multipule lines as a var?

Answer»

i could have it go only to a file and have my batch file use that file and then out put to a new file and delete the temp file with the file list in it.any help because when i have it go out to a file it goes out as only the first line.Post your code so we can help you troubleshoot the problem.@echo off
:start
::================================================
set fup=fup
set pur=purge
set alt=altpr
set sec=secure
set cod=,code 100
set ccc=,"cccc"
set Infile=temp.dak
set Outfile=purge.jim
::================================================
for /f "tokens=1 delims= " %%a in ('dir /AD ^| findstr /R /V "\.\>" ^| find /c ""') do set dirs=%%a
echo %dirs%
pause
::for /f "skip=%dirs%" %%a in ('dir /B /o:G') do echo %fup% %pur% %%a >testttt.txt& set list=%%a

for /f "skip=%dirs%" %%a in ('dir /b /o:g') do call :sub %%a
set dirs=
goto :eof
:sub %%a
set dirs=%1
for /f "skip=%dirs%" %%a in ('dir /b /o:g') do echo %%a
echo %list%

pause
::for /f "delims=" %%a in ("%list%") do echo %fup% %pur% %%a>>%Outfile%
::echo.>>%Outfile%
::for /f "delims=" %%a in ("%list%") do echo %fup% %alt% %%a %cod%>>%Outfile%
::echo.>>%Outfile%
::for /f "delims=" %%a in ("%list%") do echo %fup% %sec% %%a %ccc%>>%Outfile%
::echo.>>%Outfile%
::pausethe part at the bottom with all of the for loops is for the part wher i add things onto the file or var And what i am trying to do with this is get a list of all the files in a derectory (the one the batch file is in) and have only the files and no directories incluted and it needs to be in the bare format.I don't see anything that outputs to a file that is not commented out. What is the problem with the script? What is it doing, and what do you want it to do?Is there a reason you don't use the command:
Code: [Select]dir /b /a-d
Or to save it to a file, use:
Code: [Select]dir /b /a-d >testtt.txt
Or if you want the list in a semi-colon separated environment variable, use:
Code: [Select]@echo off
set FileList=
for /f "delims=" %%a in ('dir /b /a-d') do call :AppendList %%a
echo FileList is: %FileList%
goto :EOF

:AppendList
set FileList=%FileList%;%1
goto :EOFFor the "save to a file" method and then list them it would be like:
Code: [Select]@echo off
dir /b /a-d >testtt.txt
echo List of files is:
type testtt.txtOk i gust want to start freash. Could you make me a script that will get a list off all the files in a directory (not INCLUDE the dirs) in bear format an output them to a file please.looks like i posted late lolOMG are you serus it is that easy i could never FIGER out what the - was for (prefix meaning not???) <--STILL dont get what that means but think you.Quote

OMG are you serus it is that easy i could never figer out what the - was for (prefix meaning not???) <--still dont get what that means but think you.
i suppose you are taking about dir /a-d ? check out dir /? .. it explains...
Code: [Select]
/A Displays files with specified attributes.
attributes D Directories R Read-only files
H Hidden files A Files ready for archiving
S System files - Prefix meaning not

"-" meaning not... so /a-d means display files, not directories...think you so much i have been working on this 4ever i cant beleav that all i needed was a simple - lol ok think you very very much.


Discussion

No Comment Found