Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Universal copy command for Windows and Linux

Tags:

shell

copy

cmd

I was just curious that is there any universal command to copy files. Which should work for both Windows and Linux system.

I know Windows uses copy command and Linux uses cp command. But is there any universal command to do so.

like image 251
tushar_ecmc Avatar asked May 26 '26 10:05

tushar_ecmc


2 Answers

If powershell is installed in your Windows OS, then you can use the built-in command cp as well, just like Linux does.

like image 66
user3322481 Avatar answered May 28 '26 07:05

user3322481


There is no universal command to do this, but you have several workarounds:

  • use cygwin or msys on Windows to have the Linux equivalent commands on windows

  • use Windows Powershell (partially compatible, but works for cp)

  • provided that your environments all have python installed, write a python script that does what you want .

like image 30
Louis Caron Avatar answered May 28 '26 06:05

Louis Caron



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!