I think the wzunzip command doesn't like ~ in it's command line... I have found the problem before when using it. Not sure what you could do to get around it though... do the rename afterwards maybe?
Main Topics
Browse All Topicsit seems, that some %%i lock *.zip files but I am not sure ...
cd LandingZone\Co01\0632\ToPr
for %%i in (*.PGP) do (
copy /y %%i Backup
ren %%i %%~ni
wzunzip -o %%~ni ..\Pending
)
cd ..
wzunzip -o toprocess\*.zip ..\pending
cd ..\..\..\..
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
I'm not quite sure what exactly your question is; which "wzunzip below" fails, and which wzunzip are you putting where to "the top" to make it work? Is this one single batch script, or did you post two scripts?
In short: What exactly are you trying to accomplish with the script? Why are you trying to unzip .pgp files?
If this is all one script, you are probably having a problem with your directory structure; not knowing what you are trying to do, this all seems a bit strange:
>> cd LandingZone\Co01\0632\ToPr
You're now in the "0632\ToProcess" folder.
>> for %%i in (*.PGP) do (
You search for .pgp files in the "0632\ToProcess" folder.
>> copy /y %%i Backup
Assuming that you have a "0632\ToProcess\Backup" folder, you copy the %%i file there. If you don't have a folder with this name, the %%i file will be copied to a file with this name.
>> ren %%i %%~ni
You rename the %%i file with the .pgp extension to the file name without extension.
>> wzunzip -o %%~ni ..\Pending
This is when it starts to get messy (compare with the other wzunzip line below):
You unzip the renamed pgp(!) file into the "0632\Pending"(!) folder.
>> )
And the for loop continues.
>> cd ..
You're now in the "0632" folder.
>> wzunzip -o toprocess\*.zip ..\pending
You're unzipping all .zip(!) files in the "0632\ToProcess"(!) folder into the "Co01\pending"(!) folder.
Apart from that, this script isn't able to handle any files with spaces in the names. You should place quotation marks around the %%i in the wzunzip, copy, and ren commands.
Business Accounts
Answer for Membership
by: SteveGTRPosted on 2004-05-27 at 13:08:50ID: 11175167
Any error message?