There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
access audio avg avg 8 bios blue screen boot bsod computer connection cpu crash css dell desktop dma driver drivers dvd email error excel explorer firefox firefox 3 freeze gimp graphics hard drive hardware hijackthis hjt install internet internet explorer itunes keyboard laptop macro malware monitor motherboard network networking outlook outlook 2003 outlook 2007 outlook express pio problem problems router seo server slow sound sp3 spyware trojan usb video virtumonde virus vista vundo windows windows vista windows xp winxp wireless
Software Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
Need batch file that will extract day of month


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

 
Thread Tools
Alex Ethridge's Avatar
Distinguished Member with 5,254 posts.
 
Join Date: Apr 2000
Location: Birmingham, Alabama USA
Experience: Twelve years of hard knocks.
23-Aug-2005, 01:29 AM #1
Need batch file that will extract day of month
I need a batch file that will extract the day of the month from the computer's date and make an environment variable of that number.

The purpose is to have the batch file then extract that environment variable (numbers 01 or 1 through 31) and make a directory by that name. After a full month of running that batch command every day, there will be 31 folders numbered 01 or 1 through 31.

My knowledge of batch commands isn't very sophisticated so I need help with this.

I've Googled for it, but no success.
lotuseclat79's Avatar
Distinguished Member with 10,037 posts.
 
Join Date: Sep 2003
Location: -71.45091, 42.27841
28-Aug-2005, 01:46 PM #2
Quote:
Originally Posted by Alex Ethridge
I need a batch file that will extract the day of the month from the computer's date and make an environment variable of that number.
The purpose is to have the batch file then extract that environment variable (numbers 01 or 1 through 31) and make a directory by that name. After a full month of running that batch command every day, there will be 31 folders numbered 01 or 1 through 31.
My knowledge of batch commands isn't very sophisticated so I need help with this.
I've Googled for it, but no success.
Alex,

To assure yourself that this works:
Start->Run->Cmd->Ok
cd ../..
set DATE=%date% <- extracts date from system date command
echo %DATE% <- prints out value extracted
set DAY=%DATE:~7,2% <- extracts two characters starting at 8th (0-7)
echo %DAY% <- prints out value extracted

When the new month turns on Thursday, try it again for hopefully,
Thu 09/01/2005

Strip out the echo commands in a notepad file and save the file as something like dayofmonth.bat

In order to make a new directory, you will have to add the command to do that using the command to make a new directory. Run help in the Cmd window.

-- Tom
__________________
The independence created by philosophical insight is - in my opinion - the mark of distinction between a mere artisan or specialist and a real seeker after truth. - Einstein wrote in 1944.

Some say knowledge is power, I say knowledge without action is powerless. - lotuseclat79

Don't confuse action with movement. - Hemingway to Gardner

Imagination is more important than knowledge. - Einstein
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are Off
Refbacks are Off

You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 12:14 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.