Windows 10: Batch file code to copy C:\folder\ to F:\

Discus and support Batch file code to copy C:\folder\ to F:\ in Windows 10 Network and Sharing to solve the problem; I asked a microsoft CHATperson for batch file code to copy C:\folder\ to F:\and s/he gave me the following which I can make neither head nor tail of... Discussion in 'Windows 10 Network and Sharing' started by JosephPHILIPPA, Sep 9, 2021.

  1. Batch file code to copy C:\folder\ to F:\


    I asked a microsoft CHATperson for batch file code to copy C:\folder\ to F:\and s/he gave me the following which I can make neither head nor tail of :xcopy /s "%userprofile%\Desktop\test.txt" for /F "usebackq tokens=1,2,3,4 " %%i in `wmic logicaldisk get caption^,description^,drivetype 2^>NUL`do if %%l equ 2 xcopy /s "%userprofile%\Desktop\test.txt" %%i\k Can anyone convert that for me to MINIMAL code that will allow a batch file to copy C:\folder\ to F:\ ?

    :)
     
    JosephPHILIPPA, Sep 9, 2021
    #1
  2. oily_17 Win User

    Batch Files Knowledge Base

    Don't use batch files very much but one I find useful is for creating a list of files in a directory.
    Just copy the text below into Notepad and save as Filelist.bat

    dir /a /-p /o:gen >filelist.txt

    When you run it from a folder it will create a Filelist.txt file,in the same folder, that lists all the files in that folder.Useful when you are too lazy to type all the files out yourself.
     
    oily_17, Sep 9, 2021
    #2
  3. Batch file not working

    I'm afraid your batch file suffers from numerous problems. Here is a list of them:

    • I do not understand what the set YYY... is supposed to do.
    • There is no need to create variables for date, time and random. You can use them directly in your code.
    • In some countries, the %time% variable includes colons Batch file code to copy C:\folder\ to F:\ :)). They cannot be used in file names. Same for the %date% variable if it includes forward slashes (/).
    • In batch files you MUST fully qualify all file names.
    • "Goto" statements should be avoided as much as possible. Use loops instead (see below).
    • In your copy command you MUST put double quotes around file/folder names that have embedded spaces.

    Here is a cleaned up version of your batch file:

    Code:
    @echo offset YYYYMMDD=%4%%DATE:~4,2%%DATE:~7,2%if exist C:\Output\output.txt (   copy /y C:\Output\output.txt "F:\Locker\SIC by Plawro\outputs\output%date%_%time%_%random%.txt" >nul   timeout 1 >nul)call C:\Tools\outputreinstall.bat
     
    Frederik Long, Sep 9, 2021
    #3
  4. Batch file code to copy C:\folder\ to F:\

    Batch Files Knowledge Base

    Very nice and usefull thanks for contributing.
     
    AphexDreamer, Sep 9, 2021
    #4
Thema:

Batch file code to copy C:\folder\ to F:\

Loading...
  1. Batch file code to copy C:\folder\ to F:\ - Similar Threads - Batch file code

  2. Can Robocopy copy in batches of files?

    in Windows 10 Gaming
    Can Robocopy copy in batches of files?: Evening, I'm just after a bit of help, I have a folder on my PC which has a load of files from my Nikon Camera - for my current example 1700 at around 42GB, I usually copy these to an external SDD but I'm guessing due to the SSD the speed tends to drop off so I start around...
  3. Can Robocopy copy in batches of files?

    in Windows 10 Software and Apps
    Can Robocopy copy in batches of files?: Evening, I'm just after a bit of help, I have a folder on my PC which has a load of files from my Nikon Camera - for my current example 1700 at around 42GB, I usually copy these to an external SDD but I'm guessing due to the SSD the speed tends to drop off so I start around...
  4. Can Robocopy copy in batches of files?

    in Windows 10 Network and Sharing
    Can Robocopy copy in batches of files?: Evening, I'm just after a bit of help, I have a folder on my PC which has a load of files from my Nikon Camera - for my current example 1700 at around 42GB, I usually copy these to an external SDD but I'm guessing due to the SSD the speed tends to drop off so I start around...
  5. File Copies in Folders

    in Windows 10 Network and Sharing
    File Copies in Folders: Using WIN not using One Drive -I made a new folder to copy certain documents into it to have a folder dedicated for a specific topic. I copied the files from one folder to the next. I made some changes to the names of the files. I closed the folder. When I reopened it later...
  6. File Copies in Folders

    in Windows 10 Gaming
    File Copies in Folders: Using WIN not using One Drive -I made a new folder to copy certain documents into it to have a folder dedicated for a specific topic. I copied the files from one folder to the next. I made some changes to the names of the files. I closed the folder. When I reopened it later...
  7. File Copies in Folders

    in Windows 10 Software and Apps
    File Copies in Folders: Using WIN not using One Drive -I made a new folder to copy certain documents into it to have a folder dedicated for a specific topic. I copied the files from one folder to the next. I made some changes to the names of the files. I closed the folder. When I reopened it later...
  8. How to batch copy files between several folders?

    in Windows 10 Ask Insider
    How to batch copy files between several folders?: Hi, I have to do a bunch of file copy between different folders and I wanted to know if there's a way to do it in a faster way rather than the "manual way". Basically, I have hundreds of files with certain names (37, 39, 40, 43...) to be copied to some specific dropbox...
  9. Batch/Command file to copy file to c:\windows\sysWOW64

    in Windows 10 Support
    Batch/Command file to copy file to c:\windows\sysWOW64: Hi there, I tried creating a batch file on a usb stick, but it could not copy files to a windows system folder. I require administration run to execute this copy, but when i ran using administration, it doesn't know where to find the files on the usb stick. The usb stick...
  10. Batch Folder and Batch File/Move Software

    in Windows 10 Software and Apps
    Batch Folder and Batch File/Move Software: Looking for recommendations for software that handles automatic batch folder creation according to defined rules. Also looking for software that handles automatic file and folder moving into more than one directory according to selection criteria (size, date, extension,...