# Need batch file that extracts weeknumber but on monday and tuesday exception



## olafski (Jun 22, 2007)

I have found an example batch to display the weeknumber:
http://www.robvanderwoude.com/files/weekbat.txt

I want to use this to build a batch file that automatically extracts a ZIP with a password. This password is changing every week to 'passwordxx', where xx is the weeknumber of that week. Except on mondays and tuesdays. When the ZIP file is deliverd on these days, the weeknumber is the current weeknumber minus 1. I have no idea how to build this batch file. Any help would be appreciated, since my knowledge of batches files is minimum.

Thanks in advance!

Olaf


----------



## gdi1942 (Nov 2, 2006)

where weeknumber is what, the weeknumber of the month or the year or what?


----------



## olafski (Jun 22, 2007)

The weeknumber of the year ofcourse. Didn't know people where using other weeknumbers.
Thanks in advance,

Olafski


----------



## JohnWill (Oct 19, 2002)

I'd use something like AutoIt to hand you the week number.  You can create a little utility EXE from it that will do anything you can do in a batch file and a whole lot more.


----------



## ghostdog74 (Dec 7, 2005)

why not go for something that comes with M$ installed ? vbscript. this will get the week number. the unzip command is fictitious. 

```
Dim WeekNum,passWord,WSHShell
WeekNum=DatePart("ww",Now)
WScript.Echo "Week number is",WeekNum
passWord="password" & WeekNum
WScript.Echo "Pasword: ",passWord
Set WSHShell = CreateObject("Wscript.shell")
Command = "unzip -password " & passWord
Set execObj= WshShell.Run(Command)
```


----------



## olafski (Jun 22, 2007)

Extracting a weeknumber is not that difficult I think. Please see my original posting, I have a tool for that. But like I said, on mondays and tuesdays(excluding the weekend as well) it shouldn't display the current weeknumber but the weeknumber minus one.
The data we get delivered, always comes on thursdays and fridays. The password is 'passwordWN' where WN is the current weeknumber(weeknumber of the year). But WHEN the ZIP file is uploaded on monday or tuesdays, because of holidays etc, it should be 'passwordWN-1'. Where WN-1 is the weeknumber minus 1. 
I hope this is clear? I hope you can show me something ready, if I may be a bit harsh, because I am not such a programmer.

Thanks again!


----------

