powershell - Boolean test if an archive is corrupt -
after creating zip file, i'd add confirmation if successful.
start-process -filepath "$env:zroot\7z.exe" -argumentlist "t d:\mybackup\log5.zip *.* -r" -wait -passthru i output:
handles npm(k) pm(k) ws(k) vm(m) cpu(s) id processname ------- ------ ----- ----- ----- ------ -- ----------- 4 2 248 1088 6 0.02 10236 7z how capture boolean test command line, if zip file corrupt?
you don't need start-process. run command , check $lastexitcode variable (i.e., exit code of executable). per 7-zip documentation, non-zero exit code indicates error. example (not tested):
& $(join-path $env:zroot "7z.exe") t "d:\path name\whatever.zip" if ( $lastexitcode -ne 0 ) { "there error" }
Comments
Post a Comment