Forum Search:
Forum.Brain-Cluster.com: Brain Cluster Technical Forum
Ultimate forum for Technical Discussions

Home » Microsoft » Windows Server » Windows Server General Help » Script that use date
Script that use date [message #163619] Thu, 04 June 2009 03:20 Go to next message
Uyyy  is currently offline Uyyy
Messages: 7
Registered: June 2009
Junior Member
Hi!.
I have this script 1 that it copy files starts "dife" from f unit to g, but
now i'm trying it copy files with starts "dife" and date of previous date
(script 2)
Script 1
for /f "usebackq tokens=1,2,3 delims=/" %%i IN (`DATE /T`) do set
tmpfecha=%%k%%j%%i
for /f "usebackq tokens=1,2,3 delims= " %%i in (`echo %tmpfecha%`) do set
mifecha=%%i%%k%%j

C:\WINDOWS\system32\robocopy F:\ G:\ Dife*.*

Script 2
for /f "usebackq tokens=1,2,3 delims=/" %%i IN (`DATE /T`) do set
tmpfecha=%%k%%j%%i
for /f "usebackq tokens=1,2,3 delims= " %%i in (`echo %tmpfecha%`) do set
mifecha=%%i%%k%%j
set cont=1
set /a mifecha2=%mifecha%-%cont%
C:\WINDOWS\system32\robocopy F:\ G:\ Dife*%mifecha2%.*

This substract one day to mifecha, but if day of mifecha is 20090601 result
of mifecha2 is 20090600 instead of 20090531 or 20090530 depending month. Of
course february only have 28 days.

Any one knows script to control this ?
Thanks a lot.
Re: Script that use date [message #163638 is a reply to message #163619] Thu, 04 June 2009 08:04 Go to previous messageGo to next message
news  is currently offline news  Switzerland
Messages: 2294
Registered: July 2009
Senior Member
"Uyyy" <informaticasre@telefonica.net> wrote in message
news:FEDCDD03-C1FC-4A3A-9F84-91D30D22E5FB@microsoft.com...
> Hi!.
> I have this script 1 that it copy files starts "dife" from f unit to g,
> but
> now i'm trying it copy files with starts "dife" and date of previous date
> (script 2)
> Script 1
> for /f "usebackq tokens=1,2,3 delims=/" %%i IN (`DATE /T`) do set
> tmpfecha=%%k%%j%%i
> for /f "usebackq tokens=1,2,3 delims= " %%i in (`echo %tmpfecha%`) do set
> mifecha=%%i%%k%%j
>
> C:\WINDOWS\system32\robocopy F:\ G:\ Dife*.*
>
> Script 2
> for /f "usebackq tokens=1,2,3 delims=/" %%i IN (`DATE /T`) do set
> tmpfecha=%%k%%j%%i
> for /f "usebackq tokens=1,2,3 delims= " %%i in (`echo %tmpfecha%`) do set
> mifecha=%%i%%k%%j
> set cont=1
> set /a mifecha2=%mifecha%-%cont%
> C:\WINDOWS\system32\robocopy F:\ G:\ Dife*%mifecha2%.*
>
> This substract one day to mifecha, but if day of mifecha is 20090601
> result
> of mifecha2 is 20090600 instead of 20090531 or 20090530 depending month.
> Of
> course february only have 28 days.
>
> Any one knows script to control this ?
> Thanks a lot.

You would need to convert the date into a format that counts days since
1970, perform the subtraction, then do a back-conversion. The newsgroup
alt.msdos.batch.nt would be the right place to post this question.
Alternatively you could use the following hybrid batch file:

@echo off
echo WScript.Echo DateAdd("d", Date, -1) > "%temp%\MyDate.vbs
cscript //nologo "%temp%\MyDate.vbs"
Re: Script that use date [message #163666 is a reply to message #163638] Thu, 04 June 2009 12:58 Go to previous messageGo to next message
Uyyyy  is currently offline Uyyyy  Spain
Messages: 4
Registered: June 2009
Junior Member
I don't know about scripting and i don't understand how i can use that
"hibrid" script with lines of my script i post in this message.

Thanks.

On 4 jun, 14:04, "Pegasus [MVP]" <n...@microsoft.com> wrote:
> "Uyyy" <informatica...@telefonica.net> wrote in message
>
> news:FEDCDD03-C1FC-4A3A-9F84-91D30D22E5FB@microsoft.com...
>
>
>
>
>
> > Hi!.
> > I have this script 1 that it copy files starts "dife" from f unit to g,
> > but
> > now i'm trying it copy files with starts "dife" and date of previous date
> > (script 2)
> > Script 1
> > for /f "usebackq tokens=1,2,3 delims=/" %%i IN (`DATE /T`) do set
> > tmpfecha=%%k%%j%%i
> > for /f "usebackq tokens=1,2,3 delims= " %%i in (`echo %tmpfecha%`) do set
> > mifecha=%%i%%k%%j
>
> > C:\WINDOWS\system32\robocopy F:\ G:\ Dife*.*
>
> > Script 2
> > for /f "usebackq tokens=1,2,3 delims=/" %%i IN (`DATE /T`) do set
> > tmpfecha=%%k%%j%%i
> > for /f "usebackq tokens=1,2,3 delims= " %%i in (`echo %tmpfecha%`) do set
> > mifecha=%%i%%k%%j
> > set cont=1
> > set /a mifecha2=%mifecha%-%cont%
> > C:\WINDOWS\system32\robocopy F:\ G:\ Dife*%mifecha2%.*
>
> > This substract one day to mifecha, but if day of mifecha is 20090601
> > result
> > of mifecha2 is 20090600 instead of 20090531 or 20090530 depending month.
> > Of
> > course february only have 28 days.
>
> > Any one knows script to control this ?
> > Thanks a lot.
>
> You would need to convert the date into a format that counts days since
> 1970, perform the subtraction, then do a back-conversion. The newsgroup
> alt.msdos.batch.nt would be the right place to post this question.
> Alternatively you could use the following hybrid batch file:
>
> @echo off
> echo WScript.Echo DateAdd("d", Date, -1) > "%temp%\MyDate.vbs
> cscript //nologo "%temp%\MyDate.vbs"- Ocultar texto de la cita -
>
> - Mostrar texto de la cita -
Re: [message #163667 is a reply to message #163666] Thu, 04 June 2009 13:33 Go to previous messageGo to next message
Frankster  is currently offline Frankster
Messages: 147
Registered: July 2009
Senior Member
"Eric S" <eistacey@adam.com.au> wrote in message
news:89mdnZNkVrBhTLrXnZ2dnUVZ_smdnZ2d@adnap.net.au...
> hi,
> I applogise as I think this is a absic question - Is active directory
> installed by default?
> On a new server I have installed sbs prem 2003 R2 and used the add user
> wizard to add some users but have read that I maybe should have used
> intall active directory instead?
> I thought that after completing the installation active directory will be
> installed by default?
> Is this true?
> how can I check that active directory will be installed and working ok?
> regards
>

Yes, it should be installed by default. Check to see if you have a menu
choice of Activie Directory Users and Computers.

-Frank
Re: Script that use date [message #163669 is a reply to message #163666] Thu, 04 June 2009 14:33 Go to previous message
news  is currently offline news  Switzerland
Messages: 2294
Registered: July 2009
Senior Member
Your original batch file contains the line
for /f "usebackq tokens=1,2,3 delims=/" %%i IN (`DATE /T`) do set
tmpfecha=%%k%%j%%i

What does it do? It generates a reformatted date string.

My batch file contains this line:
cscript //nologo "%temp%\MyDate.vbs"

What does it do? It generates a reformatted date string, one day in the
past. Run my batch file and you will see it for yourself!

Since the two commands do the same thing, all you have to do is replace your
own `date /t` command with my date command. It's as simple as this! There is
actually no need to make things overly complicated by using the BackQuote
parameter. The following batch file will do very nicely. Watch out for
unintended line breaks!

[1] @echo off
[2] echo WScript.Echo DateAdd("d", Date, -1) > "%temp%\MyDate.vbs
[3] for /F "tokens=2-4 delims=/ " %%a in ('cscript //nologo
"%temp%\MyDate.vbs"') do set MyDate=%%a-%%b-%%c
[4] echo Date=%MyDate%


"Uyyyy" <jopeme2000@yahoo.es> wrote in message
news:005d50a2-5065-423c-a591-d52cf8c9983c@o20g2000vbh.googlegroups.com...
>I don't know about scripting and i don't understand how i can use that
> "hibrid" script with lines of my script i post in this message.
>
> Thanks.
>
> On 4 jun, 14:04, "Pegasus [MVP]" <n...@microsoft.com> wrote:
>> "Uyyy" <informatica...@telefonica.net> wrote in message
>>
>> news:FEDCDD03-C1FC-4A3A-9F84-91D30D22E5FB@microsoft.com...
>>
>>
>>
>>
>>
>> > Hi!.
>> > I have this script 1 that it copy files starts "dife" from f unit to g,
>> > but
>> > now i'm trying it copy files with starts "dife" and date of previous
>> > date
>> > (script 2)
>> > Script 1
>> > for /f "usebackq tokens=1,2,3 delims=/" %%i IN (`DATE /T`) do set
>> > tmpfecha=%%k%%j%%i
>> > for /f "usebackq tokens=1,2,3 delims= " %%i in (`echo %tmpfecha%`) do
>> > set
>> > mifecha=%%i%%k%%j
>>
>> > C:\WINDOWS\system32\robocopy F:\ G:\ Dife*.*
>>
>> > Script 2
>> > for /f "usebackq tokens=1,2,3 delims=/" %%i IN (`DATE /T`) do set
>> > tmpfecha=%%k%%j%%i
>> > for /f "usebackq tokens=1,2,3 delims= " %%i in (`echo %tmpfecha%`) do
>> > set
>> > mifecha=%%i%%k%%j
>> > set cont=1
>> > set /a mifecha2=%mifecha%-%cont%
>> > C:\WINDOWS\system32\robocopy F:\ G:\ Dife*%mifecha2%.*
>>
>> > This substract one day to mifecha, but if day of mifecha is 20090601
>> > result
>> > of mifecha2 is 20090600 instead of 20090531 or 20090530 depending
>> > month.
>> > Of
>> > course february only have 28 days.
>>
>> > Any one knows script to control this ?
>> > Thanks a lot.
>>
>> You would need to convert the date into a format that counts days since
>> 1970, perform the subtraction, then do a back-conversion. The newsgroup
>> alt.msdos.batch.nt would be the right place to post this question.
>> Alternatively you could use the following hybrid batch file:
>>
>> @echo off
>> echo WScript.Echo DateAdd("d", Date, -1) > "%temp%\MyDate.vbs
>> cscript //nologo "%temp%\MyDate.vbs"- Ocultar texto de la cita -
>>
>> - Mostrar texto de la cita -
>
Previous Topic:Windows Server 2003 Standard Edition - After login problem
Next Topic:System State question?
Goto Forum:
  


Current Time: Sat Aug 19 05:09:50 EDT 2017

Total time taken to generate the page: 0.03811 seconds
.:: Contact :: Home ::Sitemap::.

Powered by: FUDforum 3.0.0RC2.
Copyright ©2001-2009 FUDforum Bulletin Board Software