#1 14 Dec 2005 15:20

raja
Member
Registered: 14 Dec 2005
Posts: 1

batch script with IF EXIST

Hello All,
  in the below code how should i include the
return code for failure and success. i want the condition to be success if the file does not exist and exit. if the file exists it should be a failure and execute the MOVE command.

--------------
if     exist "c:\test\file.ext"       


move/y "C:\test\file.ext" "C:\quality\"


if not exist "c:\test\file.ext"

Offline

#2 14 Dec 2005 20:09

Simon Sheppard
Super Administrator
Registered: 27 Aug 2005
Posts: 1,011
Website

Re: batch script with IF EXIST

from the examples on
http://ss64.com/nt/if.html

IF EXIST C:\install.log (echo Installation complete) ELSE (echo The Installation failed)

so that becomes
IF EXIST "c:\test\file.ext"  (move /y "C:\test\file.ext" "C:\quality\" ) ELSE (goto :eof)

Offline

Board footer

Powered by FluxBB