On linux you can copy, say two files, with the help of the cp command simply by writing these files through a space and writing the path where they are copied. Example: cp file1.txt index.html C:\new_folder

And how to do it in cmd windows? The copy command copies one file, and two files that are separated by spaces cause an error.

How can I do that? What should this team look like?

  • I solved the problem by pumping cmd and adding linux commands to it (I used the article from habrahabr.ru/post/177033 ) using the clink program mridgers.imtqy.com/clink and the UnxUtils program sourceforge.net/projects/unxutils - Vlad
  • Now cp file1.txt index.html C: \ new_folder works in cmd. Can someone come in handy solution. If hard to master cmd. - Vlad
  • From the robocopy and for% I% I commands, I did not achieve a successful result. - Vlad
  • it is with the functionality that you asked about in the question that robocopy does quite well being an out-of-box tool. - 1d0
  • I checked robocopy again - it works. Thank you :) - Vlad

3 answers 3

You can use the robocopy command. More examples are here. Example of use:

robocopy source\folder dest\folder file1.txt index.html

    On Windows, there is PowerShell , a shell with a command-line interface and a companion scripting language. You can copy the file like this

     Copy-Item c:\scripts\test.txt c:\test 

    Copy folder with files and all subfolders so

     Copy-Item c:\scripts c:\test -recurse 

    Copy-Item has alias: cpi, cp, copy
    Description here .

    • Interestingly, ps made in favor of lyuniksoidam? - Matthew Haig
    • one
      @MatthewHaig "ps made to suit lyuniksoidam?" - probably just done for administrators. there is wmi, but you need to know the programming language to use it. they didn’t want to learn a whole language in order to do something. and with commands and scripts sorted out and used. - Stack
    • Apparently it is - Matthew Haig

    In 2016, it is recommended to use Cash to run UNIX commands and utilities on Windows.

    • Quick install
    • The commands are exactly the same as on UNIX-like operating systems, you do not need to re-educate,
    • The ability to combine teams of different operating systems.

    Install Node.js , if not already, → in the Windows command line, enter npm install cash-global -g → wait for it to be installed, → test commands for Linux right there in Cmd.exe . List of supported Cash commands , a small review of Cash in Russian .

    To use the alias , clear , export , false , kill , source , true and unalias on August 2016, you need to first enter cash , for example:

     E:\Киролайна>alias sl=ls "alias" не является внутренней или внешней командой, исполняемой программой или пакетным файлом. E:\Киролайна>cash SashaGoddess@DESKTOP-0G54NVG:E/Киролайна$ alias sl=ls SashaGoddess@DESKTOP-0G54NVG:E/Киролайна$ 

    All other supported teams work without cash . To copy several files after installing Cash, just enter the same into the command line interpreter: cp file1.txt index.html C:\new_folder .

    • Comment on the cons, please, who puts. It works, the conditions of the question (and how to do it in cmd Windows?) Answers. Thank. - Sasha Chernykh