Great article about running commandline tools using powershell: 

# checks if code is running in the ISE environment or not.
function Test-IsISE
  # try...catch accounts for:
  # Set-StrictMode -Version latest try
  return $psISE -ne $null;
  return $false;

Powershell implementation of XCOPY

 dIs there a way to replicate an xcopy functional using powershell?

I thought it was an easy question until I tried some cmdlets.

Let's imagine I've got a folder structure like:




There're files in each folder of course. I need to copy contents of Src to some folder Dst.

With xcopy it'd be like this:

xcopy src dst\ /e /y
PS analog would be something like this:

copy-item src dst\ -force -recurse -verbose
Works great... the first time. The second time it creates a subfolder dst\src and puts files there!

I can't figure out any easy workaround. Can you?

p.s. I know I can use xcopy in PS.

 copy-item c:\\src\\* c:\\dst -force -recurse -verbose 


Demo content

Click the pencil-icon to edit content. This is just a demo-text with Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed sit amet gravida magna. Proin in porttitor ante. Vestibulum varius pretium libero nec maximus. Nulla ac nulla purus.

Phasellus condimentum vehicula felis, quis porttitor enim aliquet in. Praesent consequat neque eget nisl dictum malesuada. Nam id efficitur arcu. Donec id mauris viverra nibh volutpat dapibus. Vivamus molestie sem urna, commodo laoreet nisl fermentum rutrum. Vivamus maximus, est ac gravida mattis, lacus orci gravida ipsum, non viverra leo ligula iaculis libero.