Running 7-Zip from within a Powershell script
Simply prefix the command with an ampersand
& "C:\Program Files\7-Zip\7z.exe" -mx=9 a "c:\BackupFolder\backup.zip" "c:\BackupFrom\backMeUp.txt"
Maybe a simpler solution is to run 7-zip on your Powershell via cmd
:
cmd /c 7za ...
Found this script and adapted it to your needs. Can you please try:
$7zipPath = "$env:ProgramFiles\7-Zip\7z.exe"
if (-not (Test-Path -Path $7zipPath -PathType Leaf)) {
throw "7 zip file '$7zipPath' not found"
}
Set-Alias 7zip $7zipPath
$Source = "c:\BackupFrom\backMeUp.txt"
$Target = "c:\BackupFolder\backup.zip"
7zip a -mx=9 $Target $Source
put "&" special character before 7z command. Example: &7z ...