Solved: change Directory

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

rodrick

Thread Starter
Joined
Feb 9, 2007
Messages
2
Hi,

I am trying to create a batch file to copy a file from one folder to another. Problem what I am facing is that folders consists "&" symbol and I am not able to use & symbol in dos.

Following is the batch program what I have written

@ echo off
S:
cd F*A_CO~1
cd BSCOE*~1
cd Access~1
cd Archive
for /F "tokens=2-4 delims=/- "%%A in ('date/T') do set var= %%C%%B%%A
md %var%
cd..
copy S:\F&A_CO__IN01\BSCOE_F&A\Access Database\abc.mdb S:\F&A_CO__IN01\BSCOE_F&A\Archive\%var%\abc.mdb
 
Joined
Aug 30, 2004
Messages
2,311
Try putting quotes (") around the directory name.
For example, I have a directory called dog&cat

When I went to DOS and tried to change directory to dog&cat (ie. command 'CD dog&cat') and DOS reported:
The system cannot find the path specified.
'cat' is not recognized as an internal or external command,
operable program or batch file.


I just tried this command: CD "dog&cat", and it worked.
 
Joined
Sep 27, 2005
Messages
166
Or, if there are no other folders with a similar name, you could substitute the ? as a single character wild card for the &.
 

rodrick

Thread Starter
Joined
Feb 9, 2007
Messages
2
Hi,

Thanks a lot for your support. It worked.

Your help is really appreciated.
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Members online

Top