CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Batch problem.

  1. #1
    Join Date
    Jun 2010
    Posts
    4

    Batch problem.

    I wrote a short batch file in windows xp, who needs to copy from one directory to the other and from the other one to this one (updating all the filles from one to another):

    xcopy %1 %2 /d /e /i /f /y /g /EXCLUDE:Exclude.txt
    xcopy %2 %1 /d /e /i /f /y /g /EXCLUDE:Exclude.txt
    pause

    (I sent parameters [%1,%2] using c#)
    All the copying process went well exept for the excluding, if the exclude file contains paths with spaces it won't exclude them, and those files will be copied.
    Another bug that happens from time to time (not always) - the first path in Exclude.txt is copied normaly.
    I read all the articals about xcopy and non of them helped me (neither using slashes or short paths ect.).

    Thanks, Dan.

  2. #2
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: Batch problem.

    Have you tried using " " for files containing spaces? I.e. like "c:\program files\whatever"
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

  3. #3
    Join Date
    Jun 2010
    Posts
    4

    Re: Batch problem.

    Quote Originally Posted by S_M_A View Post
    Have you tried using " " for files containing spaces? I.e. like "c:\program files\whatever"
    I tried it, I tried a lot of it...
    I think it's a problem with the command.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured