Yogesh Vedpathak

Yogesh Vedpathak

  • 677
  • 1.3k
  • 154.3k

print echo (msg) using conditional if else using batch scrip

Jun 14 2018 6:17 AM
 when we put filename which is avaliable into (X:\) dir  into filename.text file then file is copied to 
 E:\XbdArchive\ this location 
requirement is : when  if file is copied to to that location i want print message file sending sucessful and if fail then print message fail ... 
Thanks in advance 
 
ECHO OFF
FOR /F "tokens=1,2* delims=," %%G IN (\\Path\Missed_R\filenames.txt) DO (
ECHO ON
ECHO %%G
ECHO OFF
IF %%G==NUL goto:eof
copy X:\%%G.old E:\XbdArchive\
CD D:\SAP_X3\NDATA
REN *.old *.txt
ECHO ON
ECHO %%G
)
@echo off
// quote the path or else it won't work if there are spaces in the path
SET LOCATION_PATH="E:\XbdArchive\";
if exist %LOCATION_PATH% (
echo File Sending sucessful;
)
else if
SET LOCATION_PATH="E:\XbdArchive\";
if not exist % LOCATION_PATH% (
echo File Sending not sucessful;
)
pause
copy NUL \\Path\Missed_R\filenames.txt

Answers (2)