Tammu
asked on
if exist command in a batch flle
Hello Experts,
i have a simple batch file to check if a file exist in a particular directory, if so then copy it to some other directory and then display a message saying file copied. if the file does not exist in that directory look for the file in another directory and do same process again.
my batch file works properly, the only problem is it displays file copied message whether the file exist or not.
basically if the file in the first IF does not exist then i dont want the file copied message from the first if condition be displayed.
hope i am clear in explaining.
Thanks appreicate it
i have a simple batch file to check if a file exist in a particular directory, if so then copy it to some other directory and then display a message saying file copied. if the file does not exist in that directory look for the file in another directory and do same process again.
my batch file works properly, the only problem is it displays file copied message whether the file exist or not.
basically if the file in the first IF does not exist then i dont want the file copied message from the first if condition be displayed.
hope i am clear in explaining.
Thanks appreicate it
@echo off
IF EXIST c:\Test1\batchMsgBoxFile.bat copy c:\Test1\batchMsgBoxFile.bat c:\DisplayBatch\batchMsgBoxFile.txt
echo x=msgbox("file copied") > message1.vbs
start message1.vbs
IF NOT EXIST GOTO TEST2FILE
:TEST2FILE
copy c:\Test2\batchMsgBoxFile.bat c:\DisplayBatch\batchMsgBoxFile.bat
call c:\DisplayBatch\batchMsgBoxFile.bat
echo x=msgbox("file copied to Test2 folder") > message2.vbs
start message2.vbs
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
However, there are more simple means to display a message box, like the msg command:
msg * "File 1 copied" /time:5
will display a message box for 5 seconds, while continueing to proceed with the batch file.SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
A couple of other thoughts on message boxes from BAT files.
http://claudiosoft.online.fr/msgbox.html
http://www.robvanderwoude.com/usermessages.php
~bp
http://claudiosoft.online.fr/msgbox.html
http://www.robvanderwoude.com/usermessages.php
~bp
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks to everyone. all the suggested methods helped and hence i gave point equally to everyone. appreciate it
ASKER
Thanks