Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $StartCopyButton.Add_Click({
- $script:CancelLoop = $false
- $CancelButton.Enabled = $true
- $StartCopyButton.Enabled = $false
- Get-ChildItem -LiteralPath $Source -Recurse -File | ForEach {
- Copy-Item -Path $.FullName -Destination $NewDestination
- [System.Windows.Forms.Application]::DoEvents()
- If($script:CancelLoop -eq $true) {
- #Exit the loop
- Break;
- }
- }
- $CancelButton.Enabled = $false
- $StartCopyButton.Enabled = $true
- })
- $CancelButton.Add_Click({
- $script:CancelLoop = $true
- })
Add Comment
Please, Sign In to add comment