Closed graphixillusion closed 4 years ago
Awaiting for an official answer, i've made this modification to the code and with this i have no more errors:
New-Item $destination -Name $default_file -Force | Out-Null
if($compressed) {
$cmd_bytes = [System.Text.Encoding]::Unicode.GetBytes($cmd)
$cmd_encoded = '@echo off' + [environment]::NewLine `
+ "powershell.exe -NoProfile -EncodedCommand " `
+ [Convert]::ToBase64String($cmd_bytes) + [environment]::NewLine `
+ 'pause'
Add-Content -Path $destination\$default_file -Value $cmd_encoded
} else {
Add-Content -Path $destination\$default_file -Value $cmd
}
As you can see i simply added:
respectively to the New-Item and Add-Content commands. The only little issue i've found with this code is that when you choose to backup to the default path, the script always creates backupname.ext\backupname.ext (script file inside a dir with the same name) and i can't understand why. As i said, this happens only when you choose the default path. With custom paths works as it should.
Thanks for bringing this to my attention. I addressed this in a slightly different way and I added some more verbose handling of other custom directory edge cases.
Thank you for fixing. You should do this change too:
WARN "buckets" will be deprecated. Please change your code/manifest to use "Get-LocalBucket"
-> C:\Users\USER\scoop\apps\scoop-backup\current\scoop-backup.ps1:64:12
WARN "buckets" will be deprecated. Please change your code/manifest to use "Get-LocalBucket"
-> C:\Users\USER\scoop\apps\scoop-backup\current\scoop-backup.ps1:69:5
Done, see e2522e0686088c13d61042282531d5b4a4995c65 Please open a separate issue next time, it makes tracking easier.
As the Title says i got this error when i try to save the backup script to a custom folder:
of course the current user has rights to access that dir and i got the same result running everything as administrators. OS: Win 10 Pro version 1903