Computing.Net > Forums > Programming > Writing simple batch file

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.

Writing simple batch file

Reply to Message Icon

Name: Annon
Date: July 1, 2002 at 11:42:51 Pacific
Comment:

What I want it to do is when a user runs the batch file...

1. Rename the C:\Temp directory to a directory called OldTemp"date created on".
2. Then have it make another directory C:\Temp

How would I code it to add the date into the directory name?
Thanks.



Sponsored Link
Ads by Google

Response Number 1
Name: Olivier Ragain
Date: July 1, 2002 at 13:58:10 Pacific
Reply:

the
date

word can be use to get the date but it also ask u for a new one....

otherwise u can't do what u want.... not with batch commands or ms dos commands at least...
i can do it in C or Basic and use a batch to call that program....

Olivier


0

Response Number 2
Name: Olivier Ragain
Date: July 1, 2002 at 14:55:52 Pacific
Reply:

prompt $d
gives u the date
it is the only thing i was able to find on a date command... but their is a problem

i wasn't able to save the date... in a file or other...


try it and see what it do but i think u cant get it as a variable....maybe maybe not


0

Response Number 3
Name: Annon
Date: July 1, 2002 at 15:08:48 Pacific
Reply:

Hmmm... not looking to good. The reason why I wanted the date in the filename is so I would be able to save a number of directories with different names, since you cannot have duplicate names. Any good way to do that??
Thanks for the help, by the way.


0

Response Number 4
Name: MacFromOK
Date: July 2, 2002 at 15:48:44 Pacific
Reply:

Here's a utility I wrote a while back to
retrieve the date from DOS. Instructions
for batch file use are included.

http://www.trinex.net/users/mac/DOS/setdate.zip

Cheers, Mac


0

Response Number 5
Name: Yokese
Date: July 4, 2002 at 06:08:56 Pacific
Reply:

Maybe this help you:

http://www.robvanderwoude.com/datetime.html#Prompt

There's to many related examples in this web.


0

Related Posts

See More



Response Number 6
Name: peter4u
Date: July 5, 2002 at 21:16:46 Pacific
Reply:

This works for me:

C:\WINDOWS>date /T
Sat 07/06/2002

C:\WINDOWS>
C:\WINDOWS>date /T >x

C:\WINDOWS>more x
Sat 07/06/2002


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 Programming Forum Home


Sponsored links

Ads by Google


Results for: Writing simple batch file

Simple Batch file www.computing.net/answers/programming/simple-batch-file/10948.html

simple batch file help www.computing.net/answers/programming/simple-batch-file-help/11204.html

Simple Batch File www.computing.net/answers/programming/simple-batch-file/19285.html