Batch File Help - Techist - Tech Forum

Go Back   Techist - Tech Forum > Computer Software > Programming
Click Here to Login
Closed Thread
 
Thread Tools Display Modes
 
Old 07-02-2007, 07:48 PM   #1 (permalink)
Newb Techie
 
Join Date: Sep 2005
Posts: 28
Send a message via AIM to EnigmaX
Default Batch File Help

Well guy's, here is my question, and forgive me as I haven't dove into the .bat file's to much.

Here is what I'm looking to do.

I have a folder with 23 files in it. I want to be able to ZIP that folder (including files) and create a batch file that will unzip the files to a certain directory.

I know the first thing your thinking is why not use WinZip or something of that nature? Well it may be possible, but the directory I need the files placed in will be C:\Document and Settings\%USERNAME%\temp\etc etc (meaning I can't hard code the directory)

I also want to be able to name the folder as it's extracted, as the name will be dependent on the User ID of the workstation (this will be pushed across the LAN).


Any idea's anyone?
__________________

__________________
EnigmaX is offline  
Old 07-02-2007, 08:01 PM   #2 (permalink)
Monster Techie
 
Join Date: May 2004
Location: /usr/root/mn/us
Posts: 1,118
Default Re: Batch File Help

Yup, you're going to need the winzip command line addon pack. WinZip® - Command Line Download Evaluation Page


Code:
set extractpath = "c:\documents and settings\" + %USERNAME% + "temp\etc\" + %hostname% + "\"
set zippath = "path to zip file"

"c:\program files\winzip\wzunzip.exe" -d zippath extractpath
__________________

__________________

Its a frigging Laptop, not a Labtop!!!!
bla!! is offline  
Old 07-02-2007, 08:11 PM   #3 (permalink)
Newb Techie
 
Join Date: Sep 2005
Posts: 28
Send a message via AIM to EnigmaX
Default Re: Batch File Help

Would the end user workstations need the Command Line addon as well, or just WinZip?


If that's not available, could IExpress (C:\Windows\system32\iexpress.exe) be used?
__________________
EnigmaX is offline  
Old 07-02-2007, 08:32 PM   #4 (permalink)
Monster Techie
 
Join Date: May 2004
Location: /usr/root/mn/us
Posts: 1,118
Default Re: Batch File Help

I apologize, you don't need the wzunzip command line utility.

Each computer will need winzip at least. Here's an updated code snippet.
Code:
set extractpath = "c:\documents and settings\" + %USERNAME% + "temp\etc\" + %hostname% + "\"
set zippath = "path to zip file"

"c:\program files\winzip\winzip32.exe" -e -o zippath extractpath
I've never played around with iexpress, but from what I just read on their page, you can make an inf out of the file. Here's the code to install an inf from a batch file. I'm not sure how to make it extract to the correct path though (it should tell you on that site though)

Code:
pathtoinf = "path to inf file"

rundll32 syssetup,SetupInfObjectInstallAction DefaultInstall 128 pathtoinf
__________________

Its a frigging Laptop, not a Labtop!!!!
bla!! is offline  
Old 07-02-2007, 09:02 PM   #5 (permalink)
Newb Techie
 
Join Date: Sep 2005
Posts: 28
Send a message via AIM to EnigmaX
Default Re: Batch File Help

Thanks for the information!

That takes care of getting the files where they need to be, I guess my next question is, is it possible to name the folder upon extraction?

The folder has to follow a certain naming convention related to the name of the software, with the LAN User ID appended to it

Example: C:\documents and settings\%USERNAME%\local settings\temp\"software name"_"username"

Let's just say for me the folder would have to be called "software_EnigmaX", but for you it would have to be "software_Bla!!"

I haven't figured out how to accommodate that, if at all possible...


P.S.

Where do I put this code?

Quote:
set extractpath = "c:\documents and settings\" + %USERNAME% + "temp\etc\" + %hostname% + "\"
set zippath = "path to zip file"

"c:\program files\winzip\winzip32.exe" -e -o zippath extractpath
__________________
EnigmaX is offline  
Old 07-02-2007, 11:38 PM   #6 (permalink)
Monster Techie
 
Join Date: May 2004
Location: /usr/root/mn/us
Posts: 1,118
Default Re: Batch File Help

Is the software name dynamic also?

If it's not here's the exact code you need to paste into a blank notepad document and name as whatever.bat

Code:
set extractpath = "c:\documents and settings\" + %USERNAME% + "local settings\temp\etc\softwarename_" + %username% + "\"
set zippath = "path to zip file"

"c:\program files\winzip\winzip32.exe" -e -o zippath extractpath
If it is, you're going to need to pass the software name as an argument to the batch file and use this code.

Code:
set extractpath = "c:\documents and settings\" + %USERNAME% + "local settings\temp\etc\%1_" + %username% + "\"
set zippath = "path to zip file"

"c:\program files\winzip\winzip32.exe" -e -o zippath extractpath
To pass the argument you'd call it from a command like like this
whatever.bat softwareName
__________________

Its a frigging Laptop, not a Labtop!!!!
bla!! is offline  
Old 07-03-2007, 06:07 AM   #7 (permalink)
Newb Techie
 
Join Date: Sep 2005
Posts: 28
Send a message via AIM to EnigmaX
Default Re: Batch File Help

The software name is static, so I should be able to go with the first code snippet. I'll do some tinkering, but it looks like that just might do it, thanks again for all your help.
__________________

__________________
EnigmaX is offline  
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
my log Max Power HijackThis Logs (finished) 10 06-07-2007 10:56 PM
Smitfraud-C Toolbar microfunk Viruses, Spyware and Malware 18 05-25-2007 10:07 AM
Objecterror HJT Log objecterror Viruses, Spyware and Malware 4 05-18-2007 11:19 AM
Batch file steak1986 Microsoft Windows and Software 6 04-11-2007 05:03 PM
Having trouble getting a downloaded file Bendersterrier Internet Software and Browsers 1 03-28-2007 11:42 AM



Copyright 2002- Social Knowledge, LLC All Rights Reserved.

All times are GMT -5. The time now is 11:43 PM.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2018, vBulletin Solutions, Inc.