Page 1 of 1

How to add a CRLF

Posted: 16 Oct 2022 12:58
by Docfxit
This bat file checks to see if files exist. It lists the files that are not found all on one line. I'd like to know how to change it to list each file on a line of it's own. This is what the output looks like:
VNCInstallBat.jpg
VNCInstallBat.jpg (33.7 KiB) Viewed 1771 times
This is what the bat file looks like now:

Code: Select all

(set file=)
if not exist "VNC UltraVNC_1_2_22_X64_Setup.exe" (
set file=VNC UltraVNC_1_2_22_X64_Setup.exe)
if not exist VNCsaveinf.inf (
set file=%file% VNCsaveinf.inf)
if not exist VNCsetup.reg (
set file=%file% VNCsetup.reg)
if not exist SecureVNCPlugin64.dsm (
set file=%file% SecureVNCPlugin64.dsm)
if not exist rc4.key (
set file=%file% rc4.key)
if defined file (
Echo.
Echo.
Echo.
Echo.
Echo.
Echo.
Echo.
echo    旼컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴커
echo    ?                                
echo    ?  The files "%file%" do not exist in this directory
echo    ?  Move the above files into %CD% 
echo    ?                                
echo    ?                                
echo    ?                                
echo    ?  Press any key to close this window                              
echo    ?                                
echo    읕컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴켸
Pause > Nul
 )

Re: How to add a CRLF

Posted: 16 Oct 2022 14:52
by aGerman
Try something about like that.

Code: Select all

@echo off
(set lf=^
%= creates a line feed, do not alter =%
)

setlocal EnableDelayedExpansion
set "file="
if not exist "foo.exe" set "file=!file!!lf!   ?    foo.exe"
if not exist "bar.txt" set "file=!file!!lf!   ?    bar.txt"
if defined file  (
  echo    ?  The files ...!file!
  echo    ?  ... do not exist in this directory.
)
endlocal

pause

Re: How to add a CRLF

Posted: 16 Oct 2022 15:12
by Docfxit
That looks super great.

Thank you very much. :lol: :lol: :lol: :lol: