Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - .bat parameters

Reply
 
Old 10-21-2009   #1 (permalink)
Stephen


 
 

.bat parameters

Hi Folks,

Appologies in advance if this is not the right place to post this but I
coud'nt find any groups specific to batch files...

I have a batch file that calls to a url to gather data and dump it into a
SQL DB. The command takes a bunch of parameters including url, server and
login info, and beginning and ending dates.

I would like to be able to run the batch file overnight and have the date
parameters equal the previous day in a mm/dd/yyyy format.

Any help would be fantastic as I'm sort of new to scripting.

TIA!

My System SpecsSystem Spec
Old 10-21-2009   #2 (permalink)
Pegasus [MVP]


 
 

Re: .bat parameters


"Stephen" <Stephen@newsgroup> wrote in message
news:AF48AD29-FD76-4B43-BCA1-412572D9CC72@newsgroup
Quote:

> Hi Folks,
>
> Appologies in advance if this is not the right place to post this but I
> coud'nt find any groups specific to batch files...
>
> I have a batch file that calls to a url to gather data and dump it into a
> SQL DB. The command takes a bunch of parameters including url, server and
> login info, and beginning and ending dates.
>
> I would like to be able to run the batch file overnight and have the date
> parameters equal the previous day in a mm/dd/yyyy format.
>
> Any help would be fantastic as I'm sort of new to scripting.
>
> TIA!
The boys in alt.msdos.batch.nt would love this type of batch file
question. Here is a hybrid VB Script/Batch solution that will always
generate the desired format, regardless of your OS's regional
settings (e.g. MM/DD/YYY or DD/MM/YYYY).
@echo off
set Scr=c:\TempVBS.vbs
set VB=echo^>^>%Scr%
cd 1>nul 2>%Scr%
%VB% dYesterday = DateAdd("d", date(), -1)
%VB% wscript.echo right("0" ^& month(dYesterday), 2) _
%VB% ^& "/" ^& right("0" ^& day(dYesterday), 2) _
%VB% ^& "/" ^& year(dYesterday)
for /F %%a in ('cscript //nologo %Scr%') do set MyDate=%%a
del %Scr%
echo Yesterday=%MyDate%


My System SpecsSystem Spec
Old 4 Weeks Ago   #3 (permalink)
Pegasus [MVP]


 
 

Re: .bat parameters


"Stephen" <Stephen@newsgroup> wrote in message
news:732572AD-E48B-4F40-9E0E-F8FCF53AC81E@newsgroup
Quote:

> perfect! exactly what I was looking for.
>
> Thank you very much!
>
Thanks for the feedback.


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
parameters in .net .NET General
Parameters PowerShell
Far Cry parameters Vista Games
Startup parameters Vista mail
Parameters with ScriptMethod? PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46