?
Solved

How to generate a file name with the day in it from a batch file

Posted on 2006-04-28
3
Medium Priority
?
215 Views
Last Modified: 2010-04-17
I can make a file with the date and time in it, but I need the DAY in the name.

This is what works to generate the full date: %date:~4,2%_%date:~7,2%_%date:~10,4%
How do I get a day name in the filename?

Example: systembackup_monday.bkf, systembackup_tuesday.txt

I appreciate the help!
0
Comment
Question by:jptechnical
2 Comments
 
LVL 20

Accepted Solution

by:
hes earned 1000 total points
ID: 16563023
Try this (only tested in w2k)

set dayname=%date:~0,3%
if %dayname%==Mon set daynamefull=Monday
if %dayname%==Tue set daynamefull=Tuesday
if %dayname%==Wed set daynamefull=Wednesday
if %dayname%==Thu set daynamefull=Thursday
if %dayname%==Fri set daynamefull=Friday
if %dayname%==Sat set daynamefull=Saturday
if %dayname%==Sun set daynamefull=Sunday
echo %daynamefull%
0
 
LVL 1

Author Comment

by:jptechnical
ID: 16563059
Excellent! That is exactly what I needed. For the life of me I couldn't find the ~0,3 part. I am sure I wasn't looking in the keywords.

You get the points anyway, but can you post a like to a reference you might have used or a list of the variables?

Thanks!

As it turns out, the abbreviated form will be fine, I didnt' realize the default output was not a full name.

You da man!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn different types of Android Layout and some basics of an Android App.
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Introduction to Processes

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question