BATch output to file Heeeelp!  


  1. Posts : 15
    W10
       #1

    BATch output to file Heeeelp!


    Win10 - 64 bit Pro. Version 1909. fully up to date, but obviously with KB4524244 uninstalled.

    G'day folks.

    I have a Win .BAT file that I run every day to copy important data from the days doings from the C:\ VRPC to the D:\VRPC.

    Below is one command line from the BAT file... (There are a number of others).

    XCopy C:"Apps\VirtualRPC-DL620\HardDisc4\Net\Pluto\!Pluto\Articles" D:"ROStuff\VirtualRPC-DL620\HardDisc4\Net\Pluto\!Pluto\Articles" /Y


    This copies the Pluto Articles Directory/files from the C to the D drive, in the process displaying the files onscreen as they are copied.

    What I'm after is additional commands/flags that will output the processes displayed to a file?

    Thanks
    Dave

    I'm aware there are those flags, but I can't get them to work. :-(

    D.
      My Computer


  2. Posts : 15,998
    Windows 10 Home x64 Version 22H2 Build 19045.3448
       #2

    Dave,

    I assume that
    Code:
    XCopy C:"Apps\VirtualRPC-DL620\HardDisc4\Net\Pluto\!Pluto\Articles" D:"ROStuff\VirtualRPC-DL620\HardDisc4\Net\Pluto\!Pluto\Articles" /Y
    is a mis-paste for
    Code:
    XCopy "C:\Apps\VirtualRPC-DL620\HardDisc4\Net\Pluto\!Pluto\Articles" "D:\ROStuff\VirtualRPC-DL620\HardDisc4\Net\Pluto\!Pluto\Articles" /Y

    Just add something like >D:\Desktop\MyXCopy.log using whichever path & filename suits you
    Code:
    XCopy "C:\Apps\VirtualRPC-DL620\HardDisc4\Net\Pluto\!Pluto\Articles" "D:\ROStuff\VirtualRPC-DL620\HardDisc4\Net\Pluto\!Pluto\Articles" /Y >D:\Desktop\MyXCopy.log

    Denis
      My Computer


  3. Posts : 265
    Windows 10 Enterprise
       #3

    OK, add the following to the end of your cmd line: >c:\temp\output.txt

    However, you will not see it displayed in on the screen but everything will be in that file. You can name it anything you want.
      My Computer


  4. Posts : 5,129
    Windows 11 Pro 64-bit
       #4

    I have a batch script that will copy newest and modified files and folders.
    BATch  output to file Heeeelp! Attached Files
      My Computer


  5. Posts : 15,998
    Windows 10 Home x64 Version 22H2 Build 19045.3448
       #5

    arturox said:
    I'm aware there are those flags, but I can't get them to work. :-(
    I have just noticed that you added to your original post. As a comparison, I've just run
    Code:
    xcopy "D:\Desktop\XCopy test\20200208 wakeup - Copy" "D:\Desktop\XCopy test\destination" /Y >"D:\Desktop\XCopy test\xcopy.log"
    and it correctly created the file
    D:\Desktop\XCopy test\xcopy.log
    which correctly contained the results that you would otherwise have seen onscreen
    D:\Desktop\XCopy test\20200208 wakeup - Copy\20200208 110445 .txt
    D:\Desktop\XCopy test\20200208 wakeup - Copy\Screenshot (900).png
    D:\Desktop\XCopy test\20200208 wakeup - Copy\Screenshot (901).png
    D:\Desktop\XCopy test\20200208 wakeup - Copy\Screenshot (902).png
    D:\Desktop\XCopy test\20200208 wakeup - Copy\Screenshot (903).png
    D:\Desktop\XCopy test\20200208 wakeup - Copy\Screenshot (904).png
    D:\Desktop\XCopy test\20200208 wakeup - Copy\Screenshot (905).png
    7 File(s) copied


    What is happening when you try this?

    Denis
      My Computer


  6. Posts : 15,998
    Windows 10 Home x64 Version 22H2 Build 19045.3448
       #6

    D,

    You have corrected the paths?

    Not
    Code:
    C:" 
    D:"
    but
    Code:
    "C:\ 
    "D:\

    Denis
      My Computer


  7. Posts : 15
    W10
    Thread Starter
       #7

    Try3 said:
    You have corrected the paths?
    Interesting Denis.
    I've just checked my original .BAT file rather than "wot" I wrote in here yesterday...

    Yes and no... I was writing XCopy C:"Apps\etc etc" D:"etc etc" whereas the actual BAT file has...

    XCopy C\:"Apps\etc etc" D:"etc etc" so the only difference is where the quote marks start...

    I start my quotes after the drive designations, here you start the quotes to include the drives...

    Both methods seem to work... To be honest I have no idea what the correct method is... It's such a long time ago I played with such things...

    And...
    The "....\xcopy.log" appended to the end worked okay.

    Thanks, appreciated.

    Ax










    - - - Updated - - -

    I will mark the thread when I'm sure it is working okay, ATM I have a problem and will return after some thoughts and tests.
    Ax

    - - - Updated - - -

    Right, my little other problem is now resolved, so on to final notes.

    Not that it made any difference to the functioning of the XCopy commands... My quotes as previously written inside the drive designation... XCopy C:"etc\etc" in the BAT file... I've now standardised to what seems the norm.

    XCopy "C:\etc\etc"

    Tidied up the BAT file and added the required >Path to the output file where required.

    All is working okay.

    So thanks for the advice, much appreciated.

    Arturox
    Last edited by arturox; 22 Feb 2020 at 01:36. Reason: Typos
      My Computer


  8. Posts : 15,998
    Windows 10 Home x64 Version 22H2 Build 19045.3448
       #8

    Arturox,

    I could not find an authoritative document that stated that quotation marks should surround paths that contain spaces or that they were not required for paths that did not contain any spaces.

    So I thought a demonstration might be useful.
    - Open both a Command prompt window and a File explorer window and arrange them onscreen so you can see both at the same time.

    Test 1.1 In the Command prompt window, type Dir followed by a space Dir ,
    Test 1.2 In the File explorer window, find or create a folder that has no spaces in it and select that folder,
    Test 1.3 Drag the folder from File explorer into the Command prompt window,
    Test 1.4 You'll see that it fills in the command with the path {so you could, if you wanted, press Return & the command would be correctly actioned}.

    Test 2.1 On a new line in the Command prompt window, type Dir followed by a space Dir ,
    Test 2.2 In the File explorer window, find or create a folder that has spaces in it and select that folder,
    Test 2.3 Drag the folder from File explorer into the Command prompt window,
    Test 2.4 You'll see that it fills in the command with the path enclosed within quotation marks {so you could, if you wanted, press Return & the command would be correctly actioned}.

    BATch  output to file Heeeelp!-spaces-quotes-demo.png

    Denis
    Last edited by Try3; 22 Feb 2020 at 14:29.
      My Computer


  9. Posts : 15
    W10
    Thread Starter
       #9

    So I thought a demonstration might be useful.
    Denis, that was a most excellent answering of a question.
    I tried it myself.
    Thanks again, and appreciated.
    Arturox
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 08:16.
Find Us




Windows 10 Forums