1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: change Directory

Discussion in 'DOS/Other' started by rodrick, Feb 9, 2007.

Thread Status:
Not open for further replies.
Advertisement
  1. rodrick

    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
     
  2. ChuckE

    ChuckE

    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.
     
  3. steigrafx

    steigrafx

    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 &.
     
  4. rodrick

    rodrick Thread Starter

    Joined:
    Feb 9, 2007
    Messages:
    2
    Hi,

    Thanks a lot for your support. It worked.

    Your help is really appreciated.
     
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 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/542641

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice