Link to home
Start Free TrialLog in
Avatar of Aleks
AleksFlag for United States of America

asked on

Problem with .bat program copying files

I have a .bat program which copies files from one hard drive to another, it reads:

---
@echo off

echo Starting backup process...

xCopy /E/Y C:\BDotAttachments\*.*  E:\BDotDesktopBkp\BDotAttachments

if %errorlevel% gtr 0 (
  echo ERROR [%errorlevel%]: Backup process completed but with error(s).
) else (
  echo Backup process completed successfully.
)

pause
---

But when I run it I get the error attached. Please advice.
Capture.PNG
Avatar of NVIT
NVIT
Flag of United States of America image

Add the /i switch so you don't get the prompt and it makes the directory automatically
Avatar of Aleks

ASKER

thx .. seems to work. isn't 'pause' supposed to keep the window open at the end ?  it closes :$
ASKER CERTIFIED SOLUTION
Avatar of Qlemo
Qlemo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial