We help IT Professionals succeed at work.

Batch file not working

abitoun
abitoun asked
on
Medium Priority
919 Views
Last Modified: 2012-08-14
hi,

I want to create a batch file that would copy two files from the desktop to a directory i just created, then once everything is copied delete the files form the desktop, I am going step by step since it has been years since the last time i created a batch file so bear with me :-)
here is my starting code:
echo off
cd %userprofile%\Desktop
md "BSR Upgrade"
cd %userprofile%\Desktop
copy bsrupins.bat %userprofile%\Desktop\bsrupg~1
copy adv_cust.pbd %userprofile%\Desktop\bsrupg~1
***** ERROR: The syntax of the command is incorrect ********************
del bsrupins.bat
del adv_cust.pbdecho Your Advance has been succesfully upgraded press any key to continue
pause
****** IS THERE A WAY TO DELETE THE FILE IS EXECUTING ONCE IS FINISHED *****************
exit
Thank you!!
Comment
Watch Question

Top Expert 2007
Commented:
You should use quotes around your directory names:

cd "%userprofile%\Desktop"

Remember the space issue that you had on the previous question.

You can delete the batch file:

del "%~f0"

I'd do it prior to the exit.
This line is bad syntax:

del adv_cust.pbdecho Your Advance has been succesfully upgraded press any key to continue

Try

del adv_cust.pbdecho
echo Your Advance has been succesfully upgraded press any key to continue

Author

Commented:
It worked!!! Thank you!

Explore More ContentExplore courses, solutions, and other research materials related to this topic.