Computing.Net > Forums > Disk Operating System > Batch File - Create new File Name

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Batch File - Create new File Name

Reply to Message Icon

Name: Brian
Date: October 21, 2002 at 15:28:55 Pacific
OS: Windows 2000
CPU/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




Sponsored Link
Ads by Google

Response Number 1
Name: Miskva
Date: October 22, 2002 at 05:04:30 Pacific
Reply:

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


0

Response Number 2
Name: Secret_Doom
Date: October 22, 2002 at 12:24:12 Pacific
Reply:

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


0

Response Number 3
Name: Brian
Date: October 22, 2002 at 17:44:28 Pacific
Reply:

YOU DA MAN!! It worked perfectly. Thanks!


0

Response Number 4
Name: Brian
Date: October 23, 2002 at 11:36:26 Pacific
Reply:

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?


0

Response Number 5
Name: Secret_Doom
Date: October 23, 2002 at 14:31:36 Pacific
Reply:

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


0

Related Posts

See More



Response Number 6
Name: Brian
Date: October 23, 2002 at 16:06:50 Pacific
Reply:

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.


0

Response Number 7
Name: Secret_Doom
Date: October 23, 2002 at 18:15:51 Pacific
Reply:

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


0

Response Number 8
Name: Brian
Date: October 26, 2002 at 12:20:22 Pacific
Reply:

Hey, that assembler code worked out the best for me. Thanks for the info.


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

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


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: Batch File - Create new File Name

Creating a batch file to append to a text file www.computing.net/answers/dos/creating-a-batch-file-to-append-to-a-text-file/3180.html

batch file www.computing.net/answers/dos/batch-file/9877.html

Batch File: Commands/Prompts www.computing.net/answers/dos/batch-file-commandsprompts/2886.html