I have a batch file which includes a line something like:
WZZIP "C:MyArchiveabackup.zip" -a -P -r -ex "C:MySrcAProject*.*"
...which runs WinZip and archives some files BUT if I try and run this from a PowerShell Script it doesn't work (although it's fine if ran from the console). I think WinZip starts but then immediately exits. I suspect it's something to do with the quotes around the parameter string?
Any help much appreciated!
How do I run WinZip from a PowerShell Script?
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
How do I run WinZip from a PowerShell Script?
I have a batch file which includes a line something like:
WZZIP "C:MyArchiveabackup.zip" -a -P -r -ex "C:MySrcAProject*.*"
...which runs WinZip and archives some files BUT if I try and run this from a PowerShell Script it doesn't work (although it's fine if ran from the console). I think WinZip starts but then immediately exits. I suspect it's something to do with the quotes around the parameter string?
Any help much appreciated!
WZZIP "C:MyArchiveabackup.zip" -a -P -r -ex "C:MySrcAProject*.*"
...which runs WinZip and archives some files BUT if I try and run this from a PowerShell Script it doesn't work (although it's fine if ran from the console). I think WinZip starts but then immediately exits. I suspect it's something to do with the quotes around the parameter string?
Any help much appreciated!
How do I run WinZip from a PowerShell Script?
If WZZIP is an executable in teh DOS path then:
WZZIP C:MyArchiveabackup.zip -a -P -r -ex C:MySrcAProject*.*
Should work.
To check path just type WZZIP and see if it give program banner. If not then just add the path to WZZIP in from of it.
C:myutilsWZZIP ....
Works like CMD mostly.
WZZIP C:MyArchiveabackup.zip -a -P -r -ex C:MySrcAProject*.*
Should work.
To check path just type WZZIP and see if it give program banner. If not then just add the path to WZZIP in from of it.
C:myutilsWZZIP ....
Works like CMD mostly.
How do I run WinZip from a PowerShell Script?
I am surprised that PowerGUI doesn't parse exactly the same way as PoSH. Might be an issue with the debugger implementation or just a program bug.
Did you report it?
In most cases if the first tokenin a command line is a known program iPS will pass teh remainder of the command line unchanged to teh executable. There are only a cuople of characters that wil disrupt this. I don't have which ones in mind but they are documented in the PS docs.
Did you report it?
In most cases if the first tokenin a command line is a known program iPS will pass teh remainder of the command line unchanged to teh executable. There are only a cuople of characters that wil disrupt this. I don't have which ones in mind but they are documented in the PS docs.
How do I run WinZip from a PowerShell Script?
Not reported it yet - wanted to fully understand what was going on first.
Have just found out that the following line works when executed from Power GUI script editor by clicking the 'Start Debugging (F5)' button:
WZZIP /?
but this doesn't:
WZZIP -a E:ScriptingTemptest.zip -P -r -ex E:ScriptingWindowsPowershellSamples*.ps1
The output is this:
WinZip(R) Command Line Support Add-On Version 2.3 (Build 8094)Copyright (c) WinZip International LLC 1991-2008 - All Rights Reserved
At line 9, position 6WZZIP -a E:ScriptingTemptest.zip -P -r -ex E:ScriptingWindowsPowershellSamples*.ps1
If I find out any more I'll post it...
Have just found out that the following line works when executed from Power GUI script editor by clicking the 'Start Debugging (F5)' button:
WZZIP /?
but this doesn't:
WZZIP -a E:ScriptingTemptest.zip -P -r -ex E:ScriptingWindowsPowershellSamples*.ps1
The output is this:
WinZip(R) Command Line Support Add-On Version 2.3 (Build 8094)Copyright (c) WinZip International LLC 1991-2008 - All Rights Reserved
At line 9, position 6WZZIP -a E:ScriptingTemptest.zip -P -r -ex E:ScriptingWindowsPowershellSamples*.ps1
If I find out any more I'll post it...
How do I run WinZip from a PowerShell Script?
Good question - sorry for the confusion about Line 9 - I just have 8 lines of comments at the start of the script that's all.
To be honest at the moment all I'm trying to do is run WinZip from a PowerShell script - in this case it happens to be adding ps1 files but any files will do. The script will run, just not in the Power GUI debugger, so I'm not completely stuck
This is what I get if I enter the line into the PowerShell console:
PS C:Documents and Settingsjack> WZZIP -a E:ScriptingTemptest.zip -P -r -ex E:ScriptingWindowsPowershellSamples*.ps1WinZip(R) Command Line Support Add-On Version 2.3 (Build 8094)Copyright (c) WinZip International LLC 1991-2008 - All Rights Reserved
Adding ScriptingWindowsPowershellSamplesDay 4Arguments.ps1 Adding ScriptingWindowsPowershellSamplesDay 4Beep.ps1 Adding ScriptingWindowsPowershellSamplesDay 4Constant.ps1 Adding ScriptingWindowsPowershellSamplesDay 4Dowhile.ps1 Adding ScriptingWindowsPowershellSamplesDay 4Foreach.ps1 Adding ScriptingWindowsPowershellSamplesDay 4Fornext.ps1 Adding ScriptingWindowsPowershellSamplesDay 4Ifthen.ps1 Adding ScriptingWindowsPowershellSamplesDay 4Readfile.ps1 Adding ScriptingWindowsPowershellSamplesDay 4Readhost.ps1 Adding ScriptingWindowsPowershellSamplesDay 4Switch.ps1 Adding ScriptingWindowsPowershellSamplesDay 4Terminate.ps1 Adding ScriptingWindowsPowershellSamplesDay 4Wav.ps1 Adding ScriptingWindowsPowershellSamplesDay 4Writehost.ps1 Adding ScriptingWindowsPowershellSamplesDay 53D_chart.ps1 Adding ScriptingWindowsPowershellSamplesDay 5Basic_chart.ps1 Adding ScriptingWindowsPowershellSamplesDay 5Basic_gauge.ps1 Adding ScriptingWindowsPowershellSamplesDay 5Blue_gauge.ps1 Adding ScriptingWindowsPowershellSamplesDay 5Digital_gauge.ps1 Adding ScriptingWindowsPowershellSamplesDay 5Dynamic_gauge.ps1 Adding ScriptingWindowsPowershellSamplesDay 5Eventlog.ps1 Adding ScriptingWindowsPowershellSamplesDay 5Floating_gauge.ps1 Adding ScriptingWindowsPowershellSamplesDay 5Horizontal_gauge.ps1 Adding ScriptingWindowsPowershellSamplesDay 5Inner_gauge.ps1 Adding ScriptingWindowsPowershellSamplesDay 5Pie_chart.ps1 Adding ScriptingWindowsPowershellSamplesDay 5Remote_eventlog.ps1 Adding ScriptingWindowsPowershellSamplesDay 5Scaled_gauge.ps1 Adding ScriptingWindowsPowershellSamplesDay 5Style_7_gauge.ps1 Adding ScriptingWindowsPowershellSamplesDay 5Text_gauge.ps1 Adding ScriptingWindowsPowershellSamplesDay 5Vertical_gauge.ps1creating Zip file E:ScriptingTemptest.zipPS C:Documents and Settingsjack>
I have posted a question on the Power GUI forum about this...
To be honest at the moment all I'm trying to do is run WinZip from a PowerShell script - in this case it happens to be adding ps1 files but any files will do. The script will run, just not in the Power GUI debugger, so I'm not completely stuck
This is what I get if I enter the line into the PowerShell console:
PS C:Documents and Settingsjack> WZZIP -a E:ScriptingTemptest.zip -P -r -ex E:ScriptingWindowsPowershellSamples*.ps1WinZip(R) Command Line Support Add-On Version 2.3 (Build 8094)Copyright (c) WinZip International LLC 1991-2008 - All Rights Reserved
Adding ScriptingWindowsPowershellSamplesDay 4Arguments.ps1 Adding ScriptingWindowsPowershellSamplesDay 4Beep.ps1 Adding ScriptingWindowsPowershellSamplesDay 4Constant.ps1 Adding ScriptingWindowsPowershellSamplesDay 4Dowhile.ps1 Adding ScriptingWindowsPowershellSamplesDay 4Foreach.ps1 Adding ScriptingWindowsPowershellSamplesDay 4Fornext.ps1 Adding ScriptingWindowsPowershellSamplesDay 4Ifthen.ps1 Adding ScriptingWindowsPowershellSamplesDay 4Readfile.ps1 Adding ScriptingWindowsPowershellSamplesDay 4Readhost.ps1 Adding ScriptingWindowsPowershellSamplesDay 4Switch.ps1 Adding ScriptingWindowsPowershellSamplesDay 4Terminate.ps1 Adding ScriptingWindowsPowershellSamplesDay 4Wav.ps1 Adding ScriptingWindowsPowershellSamplesDay 4Writehost.ps1 Adding ScriptingWindowsPowershellSamplesDay 53D_chart.ps1 Adding ScriptingWindowsPowershellSamplesDay 5Basic_chart.ps1 Adding ScriptingWindowsPowershellSamplesDay 5Basic_gauge.ps1 Adding ScriptingWindowsPowershellSamplesDay 5Blue_gauge.ps1 Adding ScriptingWindowsPowershellSamplesDay 5Digital_gauge.ps1 Adding ScriptingWindowsPowershellSamplesDay 5Dynamic_gauge.ps1 Adding ScriptingWindowsPowershellSamplesDay 5Eventlog.ps1 Adding ScriptingWindowsPowershellSamplesDay 5Floating_gauge.ps1 Adding ScriptingWindowsPowershellSamplesDay 5Horizontal_gauge.ps1 Adding ScriptingWindowsPowershellSamplesDay 5Inner_gauge.ps1 Adding ScriptingWindowsPowershellSamplesDay 5Pie_chart.ps1 Adding ScriptingWindowsPowershellSamplesDay 5Remote_eventlog.ps1 Adding ScriptingWindowsPowershellSamplesDay 5Scaled_gauge.ps1 Adding ScriptingWindowsPowershellSamplesDay 5Style_7_gauge.ps1 Adding ScriptingWindowsPowershellSamplesDay 5Text_gauge.ps1 Adding ScriptingWindowsPowershellSamplesDay 5Vertical_gauge.ps1creating Zip file E:ScriptingTemptest.zipPS C:Documents and Settingsjack>
I have posted a question on the Power GUI forum about this...
How do I run WinZip from a PowerShell Script?
bit of a weird issue but...fascinating stuff! I'm working with PoSH V1 so perhaps it's already fixed in the V2 CTP?
I'll keep digging for a bit - more to get a deeper understanding of PowerShell all works rather than just solving the initial problem of running WZZIP...
Thanks for all the input!
I'll keep digging for a bit - more to get a deeper understanding of PowerShell all works rather than just solving the initial problem of running WZZIP...
Thanks for all the input!
How do I run WinZip from a PowerShell Script?
Hi - I've found that upgrading to Power GUI 1.5.2 has fixed the problem (N.B. I'm still using PowerShell V1.0 not the CTP Version).
Many thanks for comments and advice on this one!
jack
Many thanks for comments and advice on this one!
jack