|
|
|
Batch File - Create new File Name
|
Original Message
|
Name: Brian
Date: October 21, 2002 at 15:28:55 Pacific
Subject: Batch File - Create new File NameOS: Windows 2000CPU/Ram: PII 128mb RAM |
Comment: 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
Report Offensive Message For Removal
|
|
Response Number 1
|
Name: Miskva
Date: October 22, 2002 at 05:04:30 Pacific
Subject: Batch File - Create new File Name
|
Reply: (edit)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
Report Offensive Follow Up For Removal
|
|
Response Number 2
|
Name: Secret_Doom
Date: October 22, 2002 at 12:24:12 Pacific
Subject: Batch File - Create new File Name
|
Reply: (edit)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
Report Offensive Follow Up For Removal
|
|
Response Number 4
|
Name: Brian
Date: October 23, 2002 at 11:36:26 Pacific
Subject: Batch File - Create new File Name |
Reply: (edit)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?
Report Offensive Follow Up For Removal
|
|
Response Number 5
|
Name: Secret_Doom
Date: October 23, 2002 at 14:31:36 Pacific
Subject: Batch File - Create new File Name
|
Reply: (edit)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
Report Offensive Follow Up For Removal
|
|
Response Number 6
|
Name: Brian
Date: October 23, 2002 at 16:06:50 Pacific
Subject: Batch File - Create new File Name |
Reply: (edit)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.
Report Offensive Follow Up For Removal
|
|
Response Number 7
|
Name: Secret_Doom
Date: October 23, 2002 at 18:15:51 Pacific
Subject: Batch File - Create new File Name
|
Reply: (edit)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
Report Offensive Follow Up For Removal
|
|
Response Number 8
|
Name: Brian
Date: October 26, 2002 at 12:20:22 Pacific
Subject: Batch File - Create new File Name |
Reply: (edit)Hey, that assembler code worked out the best for me. Thanks for the info.
Report Offensive Follow Up For Removal
|
Use following form to reply to current message:
|
|

|