Home / Microsoft / Microsoft DOS / how to get next saturday 'Date' in DOS batch file
0 Members and 2 Guests are viewing this topic. « previous next »
Pages: 1 2 3 4 [All] - (Bottom) Print
Author Topic: how to get next saturday 'Date' in DOS batch file  (Read 4368 times)
Zensar
Topic Starter
Greenhorn



Posts: 7


« on: July 29, 2010, 06:48:54 AM »

I have a dos batch file which processes a text file and generates a .csv output file. I want to append the next Saturday date to the output file name.
Right now I am able to append the current date by using the below mentioned logic


Code:

set Pdate=%date:~10,4%%date:~4,2%%date:~7,2% {setting current date to variable}
-outputFile %OUTDIR%\AglItemMaster_"%PDATE%".csv



now I want to pass next saturday date in place of current date.
Kindly help.
A quick response will be really helpful.
IP logged
southpaw63119
Beginner



Thanked: 3
Posts: 57

Experience: Experienced
OS: Linux variant



1 1
« Reply #1 on: July 29, 2010, 10:49:19 AM »

This may help you get started:
http://www.computerhope.com/forum/index.php?topic=76081.0
IP logged

This is why we can't have nice things.
Salmon Trout
Sage



Thanked: 546
Posts: 7,948

Computer: Specs
Experience: Beginner
OS: Unknown

1
« Reply #2 on: July 29, 2010, 11:39:41 AM »

I am (or was) Dias de verano.

Output should be next Saturday's date in your local date format. Mine is European dd/mm/yyyy.

Code: [Select]
@echo off
>NextSat.vbs echo wscript.echo FormatDateTime(Date + (7 - Weekday(Date)))
For /f "delims=" %%D in ('cscript //nologo NextSat.vbs') do set nextsaturday=%%D
del NextSat.vbs
echo Next Saturday Is %Nextsaturday%

Code: [Select]
Next Saturday Is 31/07/2010


IP logged


Proud to be European
Zensar
Topic Starter
Greenhorn



Posts: 7


« Reply #3 on: July 29, 2010, 02:28:45 PM »

Thanks a ton Salmon for resolving my issue.
Just a quick one 'how do I convert the output date format from dd/mm/yyyy to yyyymmdd'

Thanks in advance
IP logged
Salmon Trout
Sage



Thanked: 546
Posts: 7,948

Computer: Specs
Experience: Beginner
OS: Unknown

1
« Reply #4 on: July 29, 2010, 02:51:45 PM »

convert the output date format from dd/mm/yyyy to yyyymmdd'

assuming %NextSaturday% is dd/mm/yyyy

Code: [Select]
set yyyy=%NextSaturday:~6,4%
set mm=%NextSaturday:~3,2%
set dd=%NextSaturday:~0,2%
set yourformat=%yyyy%%mm%%dd%
echo %yourformat%
IP logged


Proud to be European
Zensar
Topic Starter
Greenhorn



Posts: 7


« Reply #5 on: July 30, 2010, 12:02:48 AM »

Hi Salmon,
Code: [Select]
set yyyy=%NextSaturday:~6,4%
set mm=%NextSaturday:~3,2%
set dd=%NextSaturday:~0,2%
set yourformat=%yyyy%%mm%%dd%
echo yourformat %yourformat%

this is not working.
IP logged
Salmon Trout
Sage



Thanked: 546
Posts: 7,948

Computer: Specs
Experience: Beginner
OS: Unknown

1
« Reply #6 on: July 30, 2010, 12:09:30 AM »

Did you read this?

Quote from: Me
assuming %NextSaturday% is dd/mm/yyyy

I tested it before posting. It works fine here.



« Last Edit: July 30, 2010, 12:21:43 AM by Salmon Trout » IP logged


Proud to be European
Zensar
Topic Starter
Greenhorn



Posts: 7


« Reply #7 on: July 30, 2010, 02:15:24 AM »

Hi Salmon,
I am using your code in the below mentioned manner
Code: [Select]
@echo off
>NextSat.vbs echo wscript.echo FormatDateTime(Date + (7 - Weekday(Date)))
For /f "delims=" %%D in ('cscript //nologo NextSat.vbs') do set nextsaturday=%%D
del NextSat.vbs

set yyyy=%NextSaturday:~10,4%
set mm=%NextSaturday:~4,2%
set dd=%NextSaturday:~7,2%
set yourformat=%yyyy%%mm%%dd%

echo Next Saturday Is %Nextsaturday%
echo yourformat %yourformat%


And getting the output as

Code: [Select]
Next Saturday Is 7/31/2010
yourformat /210

Please help.
Thanks in advance
IP logged
Salmon Trout
Sage



Thanked: 546
Posts: 7,948

Computer: Specs
Experience: Beginner
OS: Unknown

1
« Reply #8 on: July 30, 2010, 03:11:01 AM »

you wrongly gave your date format as dd/mm/yyyy when it appears to actually be m/d/yyyy, which is why the code I supplied does not give the result you require.
IP logged


Proud to be European
Zensar
Topic Starter
Greenhorn



Posts: 7


« Reply #9 on: July 30, 2010, 03:28:08 AM »

ohhhhhhh yes I overlooked the date format.
do you know a workaround for converting 'm/d/yyyy' to 'yyyymmdd'

Thanks in advance.
IP logged
Salmon Trout
Sage



Thanked: 546
Posts: 7,948

Computer: Specs
Experience: Beginner
OS: Unknown

1
« Reply #10 on: July 30, 2010, 10:58:39 AM »

This will place into a batch variable the following Saturday's date in yyyymmdd format. That is, 4 figures for the year and 2 figures each for month and day, (example 20100731) whatever the local date format.

Code: [Select]
@echo off
>NextSat.vbs echo NextSaturday=FormatDateTime(Date+(7-Weekday(Date)))
>>NextSat.vbs echo SY=Year(NextSaturday)
>>NextSat.vbs echo SM=Month(NextSaturday)
>>NextSat.vbs echo SD=Day(NextSaturday)
>>NextSat.vbs echo wscript.echo SY ^& "," ^& SM ^& "," ^& SD
For /f "tokens=1-3 delims=," %%A in ('cscript //nologo NextSat.vbs') do (
Set yyyy=%%A
Set mm=%%B
Set dd=%%C
)
del Nextsat.vbs
If %mm% lss 10 Set mm=0%mm%
If %dd% lss 10 Set dd=0%dd%
Set Result=%yyyy%%mm%%dd%
echo Next Saturday is %Result%
pause

Code: [Select]
Next Saturday is 20100731



« Last Edit: July 30, 2010, 11:23:22 AM by Salmon Trout » IP logged


Proud to be European
Salmon Trout
Sage



Thanked: 546
Posts: 7,948

Computer: Specs
Experience: Beginner
OS: Unknown

1
« Reply #11 on: July 31, 2010, 02:02:43 AM »

The previous code had a possible problem, namely that if today is Saturday, it gives today's date. If you do not want that to happen, the following avoids that, and can be adjusted for any day of the week.

Code: [Select]
@echo off
setlocal enabledelayedexpansion
>evaluate.vbs echo Wscript.echo eval(WScript.Arguments(0))
set VBcmd=cscript //nologo evaluate.vbs
set NDW=Saturday
For /L %%A in (1,1,7) do for /f "delims=" %%N in ('%VBcmd% "weekdayname(weekday(date+%%A))"') do if "%%N"=="%NDW%" set Offset=%%A
for /f "delims=" %%Y in (' %VBcmd% "year(date+%Offset%)" ') do set yyyy=%%Y
for /f "delims=" %%M in (' %VBcmd% "month(date+%Offset%)" ') do set mm=%%M
for /f "delims=" %%D in (' %VBcmd% "day(date+%Offset%)" ') do set dd=%%D
if %mm% LSS 10 set mm=0%mm%
if %dd% LSS 10 set dd=0%dd%
del evaluate.vbs
echo Next %NDW% is %yyyy%%mm%%dd%
pause


IP logged


Proud to be European
Zensar
Topic Starter
Greenhorn



Posts: 7


« Reply #12 on: August 13, 2010, 01:50:55 AM »

Thanks a lot  Salmon!!!
You ROCK!!!!!! (|
Issue resolved.
IP logged
vishuvishal
Beginner



Thanked: 3
Posts: 77




« Reply #13 on: August 13, 2010, 05:25:31 PM »

Code: [Select]
@echo off
>NextSat.vbs echo wscript.echo FormatDateTime(Date + (7 - Weekday(Date)))
For /f "delims=" %%D in ('cscript //nologo NextSat.vbs') do set nextsaturday=%%D
echo Next Saturday Is %Nextsaturday%

set yyyy=%NextSaturday:~5,4%
set mm=%NextSaturday:~2,2%
set dd=%NextSaturday:~0,1%
set yourformat=%yyyy%/%mm%/%dd%
echo %yourformat%


Hey I got correction.

Thanks and regards
vishu
IP logged
vishuvishal
Beginner



Thanked: 3
Posts: 77




« Reply #14 on: August 13, 2010, 05:32:03 PM »

Hey Salmon.
You are getting help from VBscript or windows script.

Is it fair?

IP logged
BC_Programmer
Mastermind


Thanked: 697
Posts: 15,874

Computer: Specs
Experience: Beginner
OS: Windows 7


Pinkie Pie is best pony

BC-Programming.com 1 1
« Reply #15 on: August 13, 2010, 10:58:02 PM »

Hey Salmon.
You are getting help from VBscript or windows script.

Is it fair?




Curious. This post and it's thinly veiled passive sentence form reinforce my suspicions.
IP logged

My Blog

BASeBlock 2.3.0 (NOW WITH MACGUFFINS!)
Salmon Trout
Sage



Thanked: 546
Posts: 7,948

Computer: Specs
Experience: Beginner
OS: Unknown

1
« Reply #16 on: August 14, 2010, 12:52:06 AM »

Hey Salmon.
You are getting help from VBscript or windows script.

Is it fair?



Please restrict yourself to on-topic, useful posts.
IP logged


Proud to be European
Salmon Trout
Sage



Thanked: 546
Posts: 7,948

Computer: Specs
Experience: Beginner
OS: Unknown

1
« Reply #17 on: August 14, 2010, 01:09:28 AM »


Curious. This post and it's thinly veiled passive sentence form reinforce my suspicions.

I have had the same suspicions myself. When the axe falls it should remove at least two heads.
IP logged


Proud to be European
ghostdog74
Mentor



Thanked: 26
Posts: 1,511


« Reply #18 on: August 14, 2010, 07:30:23 PM »

Hey Salmon.
You are getting help from VBscript or windows script.

Is it fair?

i don't know the details, but why is it not fair ? vbscript or other decent languages that knows how to calculate dates like that does the job. There is no prize for using only batch. Nobody is going to give you money using only batch. Are you greg/bill?
IP logged

victoria
Beginner



Thanked: 1
Posts: 69


« Reply #19 on: August 14, 2010, 08:25:41 PM »

Are youl?

The people using more than one current login would  have the same
IP address.  The Computerhope staff has access  to the IP addresses.

Why the undue concern? 

I have seen no damage by Vishuvishal.

There appears to be an Inhouse Computerhope Bully Squad.

Victoria and Vishuvishal  are not the same person.

Only Victoria and Vishuvishal have been logged on at the same time.

Their IP address for Victoria and Vishuvishal  indicates they are not the same person.




IP logged

Have a Nice Day
BC_Programmer
Mastermind


Thanked: 697
Posts: 15,874

Computer: Specs
Experience: Beginner
OS: Windows 7


Pinkie Pie is best pony

BC-Programming.com 1 1
« Reply #20 on: August 14, 2010, 08:26:34 PM »

LOL, well, if we needed a post to confirm our suspicions, that would be it.
IP logged

My Blog

BASeBlock 2.3.0 (NOW WITH MACGUFFINS!)
victoria
Beginner



Thanked: 1
Posts: 69


« Reply #21 on: August 14, 2010, 08:32:49 PM »

Well, if we needed a post to confirm our suspicions, that would be it.

Say What?

Are we Off Topic?
IP logged

Have a Nice Day
Salmon Trout
Sage



Thanked: 546
Posts: 7,948

Computer: Specs
Experience: Beginner
OS: Unknown

1
« Reply #22 on: August 15, 2010, 01:12:09 AM »


Only Victoria and Vishuvishal have been logged on at the same time.

Their IP address for Victoria and Vishuvishal  indicates they are not the same person.


 :)
IP logged


Proud to be European
vishuvishal
Beginner



Thanked: 3
Posts: 77




« Reply #23 on: August 15, 2010, 06:41:43 PM »

Thank you Victoria.
Pure soul!
Pure hear!
Not flirting
Truth is truth
he he he...
 ;D ;D ;D ;D ;D ;D
IP logged
RoyBailey
Rookie



Posts: 13


« Reply #24 on: August 16, 2010, 08:08:14 PM »



set Pdate=%date:~10,4%%date:~4,2%%date:~7,2%


C:test>type  sat.bat
@echo off

SET /a SatDate=%DATE:~7,2% +%1

echo SatDate=%SatDate%

Output:

C:test>sat.bat 5
SatDate=21

C:test>



___________________________________


C:test>type sat.bat
@echo off

SET /A SatDate=%DATE:~7,2% +%1

echo SatDate=%SatDate%

set Pdate=%date:~10,4%%date:~4,2%%SatDate%
echo Pdate=%Pdate%
C:test>

Output:

C:test>sat.bat  5
SatDate=21
Pdate=20100821

C:test>
« Last Edit: August 16, 2010, 08:36:11 PM by RoyBailey » IP logged

USA
Salmon Trout
Sage



Thanked: 546
Posts: 7,948

Computer: Specs
Experience: Beginner
OS: Unknown

1
« Reply #25 on: August 16, 2010, 11:56:34 PM »

So, "RoyBailey", will that script work anywhere in the world?

http://i7.photobucket.com/albums/y268/billrich/aug.jpg
IP logged


Proud to be European
RoyBailey
Rookie



Posts: 13


« Reply #26 on: August 17, 2010, 09:34:48 AM »

So, RoyBailey, will that script work anywhere in the world?

aug.jpg


ST,


My solution for finding next Saturday is with batch.  ST does not use batch.

The Original Poster will decide which method works best for his use.

The readers will make the same choice

My solution will work anywhere in the world with slight and easy modification.

One line of code instead of several lines.
IP logged

USA
Salmon Trout
Sage



Thanked: 546
Posts: 7,948

Computer: Specs
Experience: Beginner
OS: Unknown

1
« Reply #27 on: August 17, 2010, 10:32:10 AM »

My solution for finding next Saturday is with batch.

But it doesn't find the following Saturday, unless you tell it how many days there are until next Saturday! (Is this guy for real?)

Quote
ST does not use batch.

THis is false as well.

RoyBailey is actually Billrich, the banned troll. Banned for repeatedly posting misleading, wrong and false "solutions" and abusing forum members. And for evading the ban by rejoining using a proxy server.
IP logged


Proud to be European
RoyBailey
Rookie



Posts: 13


« Reply #28 on: August 17, 2010, 11:40:25 AM »

But it doesnt find the following Saturday, unless you tell it how many days there are until next Saturday.



ST,

Your Staturday solution is great.

The Original Poster and the readers will decide what works best for them.


It is good the Original Poster and the readers have a choice.

Have a good day and thanks for the kind words.
IP logged

USA
Salmon Trout
Sage



Thanked: 546
Posts: 7,948

Computer: Specs
Experience: Beginner
OS: Unknown

1
« Reply #29 on: August 17, 2010, 12:32:48 PM »

RoyBailey, you are one of the most unpleasantly stupid imbeciles it has ever been my misfortune to encounter. I see you shirk any discussion of your "code". The OP has a "choice" between: code that works and your lunatic nonsense, which you posted a long while after this very touching message:


Quote
Thanks a lot  Salmon!!!
You ROCK!!!!!! Ban-cha
Issue resolved.

I fear that ComputerHope's effectiveness will be gravely compromised until some method of permanently banning Billrich is found.


« Last Edit: August 17, 2010, 12:46:37 PM by Salmon Trout » IP logged


Proud to be European
RoyBailey
Rookie



Posts: 13


« Reply #30 on: August 17, 2010, 12:57:45 PM »

RoyBailey, you are one of the most astonishingly stupid imbeciles it has ever been my misfortune to encounter. I see you shirk any discussion of your code. The OP has a choice between: code that works and your lunatic nonsense, which you posted a long while after this very touching message.


I fear that ComputerHopes effectiveness will be gravely compromised until some method of permanently banning is found.

ST,

Thanks for the kind words.

Some computerhope members would resort to vicious personal attacks.

The people who use the Computerhope Board can filter the good code from the bad.

A member who acts as the Final  Judge is not needed.
« Last Edit: August 17, 2010, 01:11:08 PM by RoyBailey » IP logged

USA
Salmon Trout
Sage



Thanked: 546
Posts: 7,948

Computer: Specs
Experience: Beginner
OS: Unknown

1
« Reply #31 on: August 17, 2010, 01:07:43 PM »


The people who use the Computerhope Board can filter the good code from the bad.


They shouldn't have to filter code that works from deliberately posted trolling nonsense.
IP logged


Proud to be European
RoyBailey
Rookie



Posts: 13


« Reply #32 on: August 17, 2010, 03:23:08 PM »

Right now I am able to append the current date by using the below mentioned logic.

set Pdate=%date:~10,4%%date:~4,2%%date:~7,2%

Now I want to pass next saturday date in place of current date.


( The following code requires no command line arguments or user input. )

C:test>type   sat3.bat
@echo off

set day=%DATE:~0,3%
echo day=%day%
if %day%==Sun (
set /a num=6
goto  adjust
)
if %day%==Mon (
set /a num=5
goto adjust
)
if %day%==Tue (
set /a num=4
goto adjust
)
if %day%==Wed (
set /a num=3
goto adjust
)
if %day%==Thu (
set /a num=2
goto adjust
)
if %day%==Fri set /a num=1

:adjust
set /a SatDate=%DATE:~7,2% +%num%
echo SatDate=%SatDate%

set Pdate=%date:~10,4%%date:~4,2%%SatDate%
echo Pdate=%Pdate%

Output:

C:test>sat3.bat
day=Tue
SatDate=21
Pdate=20100821
C:test>
IP logged

USA
Salmon Trout
Sage



Thanked: 546
Posts: 7,948

Computer: Specs
Experience: Beginner
OS: Unknown

1
« Reply #33 on: August 17, 2010, 03:31:42 PM »

(1) echo %date%

17/08/2010

No "Tue" around here. So your code breaks. But even in Yankee land...

(2) Run the code on the 8th or 9th of the month, it'll crash. (You won't understand why)

(3) Two weeks from today, your code will say that "next Saturday" is August 35th. Nice code, genius! They must be so inbred in your trailer park that the month of August doesn't stop at 31 like it does everywhere else.

Way past time this dimbulb was banned again.






IP logged


Proud to be European
RoyBailey
Rookie



Posts: 13


« Reply #34 on: August 17, 2010, 03:58:17 PM »

Right now I am able to append the current date by using the below mentioned logic

set Pdate=%date:~10,4%%date:~4,2%%date:~7,2% {

Now I want to pass next saturday date in place of current date.

Zensar,

The ComputerHope member who is so upset has worked on his Saturday Code for years.

His code works well.


I have only worked on the Saturday Code for a day or two.  My code has a few bugs that can be worked
out.

My code is strickly batch and in the end will work better.

Roy
IP logged

USA
BC_Programmer
Mastermind


Thanked: 697
Posts: 15,874

Computer: Specs
Experience: Beginner
OS: Windows 7


Pinkie Pie is best pony

BC-Programming.com 1 1
« Reply #35 on: August 17, 2010, 04:52:52 PM »

The ComputerHope member who is so upset has worked on his Saturday Code for years.
I'm not even going to say "I doubt it" Or "probably not" and I'm just going say "that's utter nonsense".

Quote
His code works well.
Yes. It already works.

Quote
I have only worked on the Saturday Code for a day or two.  My code has a few bugs that can be worked
out.
I doubt you will figure out what they are. And even if you do, the best case scenario is you will have a locale specific implementation. It will never work anywhere the regional settings don't match yours. But of  course only terrorists would dare to vary from the MM/DD/YY format. In fact one might even suppose that the entire concept of different date formats was established in order to circumvent your code working in the future. Clearly a evil terrorist cell has gone back in time and established these silly conventions like DD/MM/YY, because clearly no sane person would ever order the values in increasing order of their magnitude. Nope, it makes far more sense to use the completely abstract MM/DD/YY ordering. Otherwise UPS wins.

Quote
My code is strickly batch and in the end will work better.
Why? How do you know this? As I noted it will not work outside North America, and in fact won't even work in some places there (some people are clearly supporting terrorist groups since they use the DD/MM/YY format)
IP logged

My Blog

BASeBlock 2.3.0 (NOW WITH MACGUFFINS!)
kpac
Web moderator
Hacker



Thanked: 180
Posts: 5,874

Certifications: List
Computer: Specs
Experience: Expert
OS: Windows 7
kpac®

1 1 1
« Reply #36 on: August 17, 2010, 04:58:47 PM »

Bill, wherever you got your "BS.c", I'm not going there.
IP logged

BC_Programmer
Mastermind


Thanked: 697
Posts: 15,874

Computer: Specs
Experience: Beginner
OS: Windows 7


Pinkie Pie is best pony

BC-Programming.com 1 1
« Reply #37 on: August 17, 2010, 05:25:23 PM »

Bill, wherever you got your "BS.c", I'm not going there.

It was the early 50's. They were different times.

In some classes the, professor was simply a bear wearing glasses. He didn't like when people would be talking on their lapphones.
IP logged

My Blog

BASeBlock 2.3.0 (NOW WITH MACGUFFINS!)
Salmon Trout
Sage



Thanked: 546
Posts: 7,948

Computer: Specs
Experience: Beginner
OS: Unknown

1
« Reply #38 on: August 17, 2010, 11:59:09 PM »


The ComputerHope member who is so upset has worked on his Saturday Code for years.


About 10 minutes actually.
IP logged


Proud to be European
Fields
Beginner



Thanked: 3
Posts: 56


« Reply #39 on: August 23, 2010, 06:08:08 PM »


Right now I am able to append the current date by using the below mentioned logic


Code:

set Pdate=%date:~10,4%%date:~4,2%%date:~7,2%
Now I want to pass next saturday date in place of current date.

http://www.unix.com/windows-dos-issues-discussions/140891-how-get-next-saturdays-date.html

  #1    4 Weeks Ago 
Zensar 
Registered User   

Join Date: Jul 2010
 
How to get next Saturdays Date?

--------------------------------------------------------------------------------
( Answer from Unix Board)
@echo off
>#.vbs echo wsh.echo Set Nextsaturday=^&dateAdd(d,7-Weekday(Date),date)
for /f delims= %%_ in (cscript /nologo #.vbs) do %%_
del #.vbs

set Nextsaturday
_______________________________________ ___

Does the above work when next saturday is next month  and/or next year?
« Last Edit: August 23, 2010, 06:30:54 PM by Fields » IP logged

Member of the Human Race; Citizen of the World.
Fields
Beginner



Thanked: 3
Posts: 56


« Reply #40 on: August 23, 2010, 09:40:41 PM »

http://www.unix.com/windows-dos-issues-discussions/140891-how-get-next-saturdays-date.html

 
Does the above work when next saturday is next month?

The VBS code works when saturday is in the next month.
Current Date is changed from Current date to Current date + 7  for test.

Code:
@echo off
For /f delims= %%D in (cscript //nologo NextSat.vbs) do (
set nextsaturday=%%D
)
set nextsaturday=%nextsaturday:~0,8%

echo Next Saturday Is %Nextsaturday%
echo When Current date + 7

Output:

C:> nix.bat
Next Saturday Is 9/4/2010
When Current date + 7


C:>type NextSat.vbs
CurrentDate=now +7
wscript.echo FormatDateTime(CurrentDate + (7 - Weekday(CurrentDate)))

C:>

Q.E.D


C:>echo %DATE%
Mon 08/23/2010

C:>echo %TIME%
23:21:39.15

C:\\\\>
« Last Edit: August 23, 2010, 10:08:38 PM by Fields » IP logged

Member of the Human Race; Citizen of the World.
Salmon Trout
Sage



Thanked: 546
Posts: 7,948

Computer: Specs
Experience: Beginner
OS: Unknown

1
« Reply #41 on: August 23, 2010, 11:51:18 PM »

Hello again, Bill. In Bill's world, you can get an edited version of my vbs script from a "Unix board".


IP logged


Proud to be European
Fields
Beginner



Thanked: 3
Posts: 56


« Reply #42 on: August 24, 2010, 09:13:52 AM »

You can get an edited version of my vbs script from a Unix board.

VBS Script does not belong to Salmon Trout. 

VBS Script is owned by Microsoft.
IP logged

Member of the Human Race; Citizen of the World.
BC_Programmer
Mastermind


Thanked: 697
Posts: 15,874

Computer: Specs
Experience: Beginner
OS: Windows 7


Pinkie Pie is best pony

BC-Programming.com 1 1
« Reply #43 on: August 24, 2010, 09:30:56 AM »

VBS Script does not belong to Salmon Trout. 

VBS Script is owned by Microsoft.

The script itself, you incontinent turkey faced badger-legged Chinchilla loving Carnal Ostrich visitor, not the interpreter.
IP logged

My Blog

BASeBlock 2.3.0 (NOW WITH MACGUFFINS!)
Salmon Trout
Sage



Thanked: 546
Posts: 7,948

Computer: Specs
Experience: Beginner
OS: Unknown

1
« Reply #44 on: August 24, 2010, 09:39:08 AM »

BCP, I think we just fed the troll.
IP logged


Proud to be European
BC_Programmer
Mastermind


Thanked: 697
Posts: 15,874

Computer: Specs
Experience: Beginner
OS: Windows 7


Pinkie Pie is best pony

BC-Programming.com 1 1
« Reply #45 on: August 24, 2010, 09:40:27 AM »

True, but I wanted to see how my insult generator worked.
IP logged

My Blog

BASeBlock 2.3.0 (NOW WITH MACGUFFINS!)
Fields
Beginner



Thanked: 3
Posts: 56


« Reply #46 on: August 24, 2010, 11:55:16 AM »

True, but I wanted to see how my insult generator worked.

Such beautiful, kind  posts are good advertisement to all vistors to the Computerhope site.

Your PR rating is excellent.
IP logged

Member of the Human Race; Citizen of the World.
gpl
Apprentice



Thanked: 25
Posts: 547




« Reply #47 on: August 24, 2010, 12:07:07 PM »

True, but I wanted to see how my insult generator worked.
Plz send me codez 4dis ;D
IP logged
kpac
Web moderator
Hacker



Thanked: 180
Posts: 5,874

Certifications: List
Computer: Specs
Experience: Expert
OS: Windows 7
kpac®

1 1 1
« Reply #48 on: August 24, 2010, 12:25:04 PM »

Code: [Select]
<a href="http://www.google.com/#hl=en&source=hp&q=insult+generator&aq=0p&aqi=g-p1g9&aql=&oq=insult+&gs_rfai=&fp=93c3c78db929eee0">Click me!</a>
IP logged

gpl
Apprentice



Thanked: 25
Posts: 547




« Reply #49 on: August 24, 2010, 02:16:01 PM »

Cheers :)
IP logged
Fields
Beginner



Thanked: 3
Posts: 56


« Reply #50 on: August 24, 2010, 02:32:05 PM »



set Pdate=%date:~10,4%%date:~4,2%%date:~7,2%

Now I want to pass next saturday date in place of current date.

The following VBS/Batch finds Saturday date when Saturday is next month. Current date is current date + 7( ran 8/23/2010).  A for loop is not necessary. 

@echo off

cscript //nologo sattwo.vbs  > cdate.txt
type cdate.txt
set /p nextsaturday=<cdate.txt
set nextsaturday=%nextsaturday:~0,8%

echo Next Saturday Is %Nextsaturday%
echo When Current date + 7

Output:

C:test> nix2.bat
9/4/2010 3:25:49 PM

Next Saturday Is 9/4/2010
When Current date + 7

C:test>type sattwo.vbs
CurrentDate=now +7
wscript.echo FormatDateTime(CurrentDate + (7 - Weekday(CurrentDate)))



C:test>
IP logged

Member of the Human Race; Citizen of the World.
Allan
Moderator
Genius



Thanked: 856
Posts: 14,482

Experience: Guru
OS: Windows 7



Forum Administrator
« Reply #51 on: August 24, 2010, 03:18:52 PM »

Okay, I'm going to assume zensar's question has been answered. If not zensar, please send me a PM. But for now, this thread is locked.
IP logged
Pages: 1 2 3 4 [All] - (Top) Print 
Home / Microsoft / Microsoft DOS / how to get next saturday 'Date' in DOS batch file « previous next »
 


Login with username, password and session length

Old Forum Search | Forum Rules
Copyright © 2010 Computer Hope ® All rights reserved.
Powered by SMF 2.0 RC3 | SMF © 2006–2010, Simple Machines LLC
Page created in 0.185 seconds with 19 queries.