I am testing a small script to compress files, I compile the script to an executable with "PowerGUI Script Editor", everything works perfect but when you go to run the. exe and compress the file, shows a progress bar, I would like to know how I can hide the progress bar indicating the compression, my code is:
$srcdir = mysourcedir
$zipFilename = \zipfilename
$zipFilepath = $env:temp
$zipFile = "$zipFilepath$zipFilename"
#Prepare zip file
if(-not (test-path($zipFile))) {
set-content $zipFile ("PK" + [char]5 + [char]6 + ("$([char]0)" * 18))
(dir $zipFile).IsReadOnly = $false
}
$shellApplication = new-object -com shell.application
$zipPackage = $shellApplication.NameSpace($zipFile)
$files = Get-ChildItem -Path $srcdir
foreach($file in $files) {
$ProgressPreference = ’SilentlyContinue’
$zipPackage.CopyHere($file.FullName)
#using this method, sometimes files can be 'skipped'
#this 'while' loop checks each file is added before moving to the next
while($zipPackage.Items().Item($file.name) -eq $null){
$ProgressPreference = ’SilentlyContinue’
Start-sleep -seconds 1
}
}
the progress bar that I want hide is this:
https://i.stack.imgur.com/LlUVQ.png
I really need help, I hope someone can help me to solve my problem, thanks