Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi.. I am creating a batch file to create a .zip file every day. Example:
pkzip test.zip testdata
I am wondering if there is a way to manually create the zip file name on the fly. For example one day I want the .zip file to be named 100202.zip so:
pkzip 100202.zip testdata
Is there a way for it to pause or ask me to enter the 100202.zip?
I am making this for a novice and don't want them to edit the batch file each time.
Thanks in advance.
Brian

No offence, but this question has been asked soo many times .. contact me on my email adres ..
or wait, for that one guy (SecretDoom), he will give you the code you need

Who? hehe...
Look, you want to be asked for the name or you need the name to be the current date?
To ask for input, use:
echo Enter zipfile name:
set /P FILENAME=And the filename inputed is on the %FILENAME% variable. Now, if you want the filename to be the current date, what you really need is...
FAQ #02 - Get date into a variable without separators
http://www.batch.hpg.com.br/index.htm#02-- Leonardo Pignataro - Secret_Doom --
secret_doom@hotmail.com
www.batch.hpg.com.br

I was able to get your instructions to work my windows2000 server. I can't get it to work in NT 4.0. Am I pretty much screwed as far as getting this process to work in NT?

This is odd... I think I remember someone also having problems on making it work under NT4 ...
Did you try both methods (the one using 'date/T' and the one using "%date%") ??
Is there any error message?
What do you see when you type these commands:
ECHO [%DATE%]
DATE /T
I don't have direct access to NT4, I make my way to NT systems through WinXP. If you can answer the above questions, I might figure out what's going on.
-- Leonardo Pigntaro - Secret_Doom --
secret_doom@hotmail.com
www.batch.hpg.com.br

Thanks for the follow up. I should probably clarify what I need. Yes, I need the file name to be a date.zip, but not todays date. I need the file name to be what our database is current up to. So, if I'm creating the zip file today I need it to be 101602.zip because that's what our database is current up to.
I need to be able to have the batch file ask me to enter the zip file name I'd like to create.
Sometimes the zip file name wont even be a date.
To answer your question, I created your steps into a batch file and received 2 lines:
e:\data\echo []
[]e:\data>Date /t
Wed 10\23\2002.

Hello again, Brian. Let me clear things up: at the time I wrote answer #5, I supposed that you needed the current date, not the user input (I just don't know what made me think that ...).
I've done some research and found out that the /P switch on the SET cmd isn't avaliable for WinNT. You'll need another methods. A search for "input" on the usenet group alt.msdos.batch.nt using google results in many methods:
http://groups.google.com/groups?q=input&meta=group%3Dalt.msdos.batch.nt
Choose one yourself. As I could see looking on that query, getting user input in NT4 is even more difficult than in Win9x/DOS...
From the methods I've seen, I liked this one, which uses an assembler code wrote by Hebert Kleebauer (that's a reliable asm programmer, I use a one or two of his codes sometimes).
-- Leonardo Pignataro - Secret_Doom --
secret_doom@hotmail.com
www.batch.hpg.com.br

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |