Bug #13138 » copy-item.ps1
1 |
function Copy-ItemUsingExplorer{ |
---|---|
2 |
param( |
3 |
[string]$source, |
4 |
[string]$destination, |
5 |
[int]$CopyFlags |
6 |
) |
7 |
|
8 |
$objShell = New-Object -ComObject 'Shell.Application' |
9 |
$objFolder = $objShell.NameSpace((gi $destination).FullName) |
10 |
Measure-Command -Expression { $objFolder.CopyHere((gi $source).FullName,$CopyFlags.ToString('{0:x}')) } |
11 |
}
|
12 |
|
13 |
function Remove-ItemUsingExplorer{ |
14 |
param( |
15 |
[string]$target, |
16 |
[int]$RemoveFlags |
17 |
) |
18 |
|
19 |
$objShell = New-Object -ComObject 'Shell.Application' |
20 |
$item = $objShell.Namespace(0).ParseName((gi $target).FullName) |
21 |
#$item.Verbs() |
22 |
#return |
23 |
Measure-Command -Expression { $item.InvokeVerb("delete") } |
24 |
}
|
25 |
|