1. You are viewing our forum as a guest. For full access please Register. WindowsBBS.com is completely free, paid for by advertisers and donations.

Problem running batch commands in W8

Discussion in 'Legacy Windows' started by Alex Ethridge, 2015/02/19.

  1. 2015/02/19
    Alex Ethridge

    Alex Ethridge Well-Known Member Thread Starter

    Joined:
    2002/01/07
    Messages:
    675
    Likes Received:
    4
    First-time user of Windows 8.

    I use batch files a lot. My batch files have many lines. Problem is that a new COMMAND window is opened with every line in the batch file. This interferes with other programs in that each new COMMAND window becomes the active window. This did not happen under W7.

    How can I correct this so that all lines in a batch file run in the same command window -- like it did in W7?
     
  2. 2015/02/19
    TonyT

    TonyT SuperGeek Staff

    Joined:
    2002/01/18
    Messages:
    9,068
    Likes Received:
    396
    If the bat file is xyz.bat does it behave better if renamed to xyz.cmd?
     

  3. to hide this advert.

  4. 2015/02/20
    Alex Ethridge

    Alex Ethridge Well-Known Member Thread Starter

    Joined:
    2002/01/07
    Messages:
    675
    Likes Received:
    4
    Thanks but just tried that and there is no change.
     
  5. 2015/02/20
    rsinfo

    rsinfo SuperGeek Alumni

    Joined:
    2005/12/25
    Messages:
    4,038
    Likes Received:
    174
    Never had such a problem ! Can you post a batch file you are having problem with ?
     
  6. 2015/02/20
    Alex Ethridge

    Alex Ethridge Well-Known Member Thread Starter

    Joined:
    2002/01/07
    Messages:
    675
    Likes Received:
    4
    The original of this batch has 39 lines; but, these lines are sufficient. Each line opens a new CMD window.

    @echo off
    mode con:cols=160
    Title Copying CD Library from Shop to Alex etc.
    if exist "\\Shop\D\AC\*.*" XXCopy "\\Shop\D\AC\CD Library\*.*" "\\Alex\D\AC\CD Library\" /r /i /c /h /k /yy /S /d
    if exist "\\Shop\D\AC\*.*" XXCopy "\\Shop\D\AC\CD Library\*.*" "\\Alex\E\Drive-D\AC\CD Library\" /r /i /c /h /k /yy /S /d
    ::if exist "\\Shop\D\AC\*.*" XXCopy "\\Shop\D\AC\CD Library\*.*" "\\Shop\H\Drive-D\AC\CD Library\" /r /i /c /h /k /yy /S /d
    if exist "\\Shop\D\AC\*.*" XXCopy "\\Shop\D\AC\CD Library\*.*" "\\Shop\E\Drive-D\AC\CD Library\" /r /i /c /h /k /yy /S /d
     
  7. 2015/02/20
    rsinfo

    rsinfo SuperGeek Alumni

    Joined:
    2005/12/25
    Messages:
    4,038
    Likes Received:
    174
    Are all your batch files contain only xxcopy ? Any problem with any other command ?
     
  8. 2015/02/20
    Arie

    Arie Administrator Administrator Staff

    Joined:
    2001/12/27
    Messages:
    15,174
    Likes Received:
    412
    xxcopy is not a windows command. xcopy is.

    Also, AFAIK /yy is not an option available.

    /Y = Suppresses prompting to confirm you want to overwrite an existing destination file.

    XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/V] [/W]
    [/C] [/I] [/Q] [/F] [/L] [/G] [/H] [/R] [/T] [/U]
    [/K] [/N] [/O] [/X] [/Y] [/-Y] [/Z] [/B] [/J]
    [/EXCLUDE:file1[+file2][+file3]...]

    source Specifies the file(s) to copy.
    destination Specifies the location and/or name of new files.

    • /A Copies only files with the archive attribute set, doesn't change the attribute.
    • /M Copies only files with the archive attribute set, turns off the archive attribute.
    • /D:m-d-y Copies files changed on or after the specified date. If no date is given, copies only those files whose source time is newer than the destination time.
    • /EXCLUDE:file1[+file2][+file3]... Specifies a list of files containing strings. Each string should be in a separate line in the files. When any of the strings match any part of the absolute path of the file to be copied, that file will be excluded from being copied. For example, specifying a string like \obj\ or .obj will exclude all files underneath the directory obj or all files with the.obj extension respectively.
    • /P Prompts you before creating each destination file.
    • /S Copies directories and subdirectories except empty ones.
    • /E Copies directories and subdirectories, including empty ones. Same as /S /E. May be used to modify /T.
    • /V Verifies the size of each new file.
    • /W Prompts you to press a key before copying.
    • /C Continues copying even if errors occur.
    • /I If destination does not exist and copying more than one file, assumes that destination must be a directory.
    • /Q Does not display file names while copying.
    • /F Displays full source and destination file names while copying.
    • /L Displays files that would be copied.
    • /G Allows the copying of encrypted files to destination that does not support encryption.
    • /H Copies hidden and system files also.
    • /R Overwrites read-only files.
    • /T Creates directory structure, but does not copy files. Does not include empty directories or subdirectories. /T /E includes empty directories and subdirectories.
    • /U Copies only files that already exist in destination.
    • /K Copies attributes. Normal Xcopy will reset read-only attributes.
    • /N Copies using the generated short names.
    • /O Copies file ownership and ACL information.
    • /X Copies file audit settings (implies /O).
    • /Y Suppresses prompting to confirm you want to overwrite an existing destination file.
    • /-Y Causes prompting to confirm you want to overwrite an existing destination file.
    • /Z Copies networked files in restartable mode.
    • /B Copies the Symbolic Link itself versus the target of the link.
    • /J Copies using unbuffered I/O. Recommended for very large files.
    The switch /Y may be preset in the COPYCMD environment variable.
    This may be overridden with /-Y on the command line.
     
    Arie,
    #7
  9. 2015/02/20
    rsinfo

    rsinfo SuperGeek Alumni

    Joined:
    2005/12/25
    Messages:
    4,038
    Likes Received:
    174
    Arie, xxcopy is an app for copying/backing up files through command line.

    Much more versatile & powerful then xcopy.
     
  10. 2015/02/20
    Arie

    Arie Administrator Administrator Staff

    Joined:
    2001/12/27
    Messages:
    15,174
    Likes Received:
    412
    Right... I didn't see that specified... so this isn't a Windows 8 question, it's an xxcopy one.

    Thanks for clarifying.
     
    Arie,
    #9
  11. 2015/02/20
    Arie

    Arie Administrator Administrator Staff

    Joined:
    2001/12/27
    Messages:
    15,174
    Likes Received:
    412
  12. 2015/02/20
    Alex Ethridge

    Alex Ethridge Well-Known Member Thread Starter

    Joined:
    2002/01/07
    Messages:
    675
    Likes Received:
    4
    Clarification: It doesn't matter whether it XCopy or XXCopy. The result is the same, a new window for every line on every external DOS command.

    Since this same batch is run under Windows 7, every line in the same window for years prior and still today on my Win7 machine, this IS a Windows 8 problem.
     
  13. 2015/02/20
    Arie

    Arie Administrator Administrator Staff

    Joined:
    2001/12/27
    Messages:
    15,174
    Likes Received:
    412
    I'm not seeing the problem on my machine.
     
  14. 2015/02/20
    rsinfo

    rsinfo SuperGeek Alumni

    Joined:
    2005/12/25
    Messages:
    4,038
    Likes Received:
    174
    Me neither. Seems to be some specific problem with Alex's setup.
     
  15. 2015/03/01
    Alex Ethridge

    Alex Ethridge Well-Known Member Thread Starter

    Joined:
    2002/01/07
    Messages:
    675
    Likes Received:
    4
    Solved:

    Right-click the Command shortcut.
    Click Properties.
    Click the Shortcut tab
    Click the Advanced button
    Select "Run as Administrator "
    Click the OK button
    Click the OK button again.
     
  16. 2015/03/01
    rsinfo

    rsinfo SuperGeek Alumni

    Joined:
    2005/12/25
    Messages:
    4,038
    Likes Received:
    174
    Thanks for sharing. Wonder why didn't I face any such problem !
     
  17. 2015/03/01
    Alex Ethridge

    Alex Ethridge Well-Known Member Thread Starter

    Joined:
    2002/01/07
    Messages:
    675
    Likes Received:
    4
    I don't know why I never had this problem in W7 and suddenly it appears W8.
     

Share This Page

  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.