Home All Groups Group Topic Archive Search About


Author
23 Nov 2007 12:38 PM
Alberto Arias
Hi,
I'm trying to compare 2 hour but i don't find the correct script.
I'm trying to test the excution of one aplication with a flag. i like check
the flag and test if the creation time of this (flag.txt) it's 6 horas minor
to delete the file or retry it.
The problem it's that i can compare the system time with the time of the
file flag.txt

I'm a newbie in script. I think it's easy but... i'm too clumsy to find
where i have the problem...

Can you help me???

P.D: Sorry for me poor english

Author
25 Nov 2007 3:47 PM
Pegasus (MVP)
Show quote
"Alberto Arias" <AlbertoAr***@discussions.microsoft.com> wrote in message
news:54097669-7A00-4CE8-A8DA-BFD8A96F7183@microsoft.com...
> Hi,
> I'm trying to compare 2 hour but i don't find the correct script.
> I'm trying to test the excution of one aplication with a flag. i like
> check
> the flag and test if the creation time of this (flag.txt) it's 6 horas
> minor
> to delete the file or retry it.
> The problem it's that i can compare the system time with the time of the
> file flag.txt
>
> I'm a newbie in script. I think it's easy but... i'm too clumsy to find
> where i have the problem...
>
> Can you help me???
>
> P.D: Sorry for me poor english

Unfortunately your post is not clear enough to give you
a good answer. I recommend you ask a friend with good
English skills to help you reword it.
Author
25 Nov 2007 4:09 PM
Alberto Arias
i'm go to try explain it.
I want to do a script that it test the hour when a file was created.
i'm runnig a batch with multiples treaths and i want to do one file to use
this as one semafhore.

runing job==>
if file == exist then
see the creation hour of file
     if the creation hour < 6 hours (local time) then
     delete file and run batch
     if not exit
if file >< exist then
create file and run job

My problem is see and compare the file creation time

I hope that i explained, and sorry for your time


Show quote
"Pegasus (MVP)" wrote:

>
> "Alberto Arias" <AlbertoAr***@discussions.microsoft.com> wrote in message
> news:54097669-7A00-4CE8-A8DA-BFD8A96F7183@microsoft.com...
> > Hi,
> > I'm trying to compare 2 hour but i don't find the correct script.
> > I'm trying to test the excution of one aplication with a flag. i like
> > check
> > the flag and test if the creation time of this (flag.txt) it's 6 horas
> > minor
> > to delete the file or retry it.
> > The problem it's that i can compare the system time with the time of the
> > file flag.txt
> >
> > I'm a newbie in script. I think it's easy but... i'm too clumsy to find
> > where i have the problem...
> >
> > Can you help me???
> >
> > P.D: Sorry for me poor english
>
> Unfortunately your post is not clear enough to give you
> a good answer. I recommend you ask a friend with good
> English skills to help you reword it.
>
>
>
Author
25 Nov 2007 4:47 PM
Pegasus (MVP)
OK - try this batch file:
#@echo off
#setlocal EnableDelayedExpansion
#set Semaphore=d:\Data\Semaphore.txt
#
#echo>  c:\test.vbs Set objFSO = CreateObject("Scripting.FileSystemObject")
#echo>> c:\test.vbs Set file = objFSO.GetFile("%Semaphore%")
#echo>> c:\test.vbs wscript.quit (DateDiff("h", file.DateLastModified, Now)
^> 6)
#
#if exist "%Semaphore%" (
# cscript //nologo c:\test.vbs
# if !ErrorLevel! NEQ 0 goto :eof
# del "%Semaphore%"
# call batchfile.bat
#) else (
# echo. > %Semaphore%
# call batchfile.bat
#)

I placed a # to mark the beginning of each line. You must
remove them before running the batch file.
Show quote
"Alberto Arias" <AlbertoAr***@discussions.microsoft.com> wrote in message
news:B4ACE61D-D9E3-4328-8EE1-8F9AD9DCD448@microsoft.com...
> i'm go to try explain it.
> I want to do a script that it test the hour when a file was created.
> i'm runnig a batch with multiples treaths and i want to do one file to use
> this as one semafhore.
>
> runing job==>
> if file == exist then
> see the creation hour of file
>     if the creation hour < 6 hours (local time) then
>     delete file and run batch
>     if not exit
> if file >< exist then
> create file and run job
>
> My problem is see and compare the file creation time
>
> I hope that i explained, and sorry for your time
>
>
> "Pegasus (MVP)" wrote:
>
>>
>> "Alberto Arias" <AlbertoAr***@discussions.microsoft.com> wrote in message
>> news:54097669-7A00-4CE8-A8DA-BFD8A96F7183@microsoft.com...
>> > Hi,
>> > I'm trying to compare 2 hour but i don't find the correct script.
>> > I'm trying to test the excution of one aplication with a flag. i like
>> > check
>> > the flag and test if the creation time of this (flag.txt) it's 6 horas
>> > minor
>> > to delete the file or retry it.
>> > The problem it's that i can compare the system time with the time of
>> > the
>> > file flag.txt
>> >
>> > I'm a newbie in script. I think it's easy but... i'm too clumsy to find
>> > where i have the problem...
>> >
>> > Can you help me???
>> >
>> > P.D: Sorry for me poor english
>>
>> Unfortunately your post is not clear enough to give you
>> a good answer. I recommend you ask a friend with good
>> English skills to help you reword it.
>>
>>
>>
Author
26 Nov 2007 11:35 AM
Alberto Arias
Thank you very much for your time. Unfortunately your script don't work in my
enviroment. I received error in execution.
I remove all "#" tag. When i execute this i receive no valid carater for
"@". When i delete this, i found error Expected statement in line 3.

i'm trying to declare tehe variable, but i have too much problems. In your
enviroment work fine???


Show quote
"Pegasus (MVP)" wrote:

> OK - try this batch file:
> #@echo off
> #setlocal EnableDelayedExpansion
> #set Semaphore=d:\Data\Semaphore.txt
> #
> #echo>  c:\test.vbs Set objFSO = CreateObject("Scripting.FileSystemObject")
> #echo>> c:\test.vbs Set file = objFSO.GetFile("%Semaphore%")
> #echo>> c:\test.vbs wscript.quit (DateDiff("h", file.DateLastModified, Now)
> ^> 6)
> #
> #if exist "%Semaphore%" (
> # cscript //nologo c:\test.vbs
> # if !ErrorLevel! NEQ 0 goto :eof
> # del "%Semaphore%"
> # call batchfile.bat
> #) else (
> # echo. > %Semaphore%
> # call batchfile.bat
> #)
>
> I placed a # to mark the beginning of each line. You must
> remove them before running the batch file.
> "Alberto Arias" <AlbertoAr***@discussions.microsoft.com> wrote in message
> news:B4ACE61D-D9E3-4328-8EE1-8F9AD9DCD448@microsoft.com...
> > i'm go to try explain it.
> > I want to do a script that it test the hour when a file was created.
> > i'm runnig a batch with multiples treaths and i want to do one file to use
> > this as one semafhore.
> >
> > runing job==>
> > if file == exist then
> > see the creation hour of file
> >     if the creation hour < 6 hours (local time) then
> >     delete file and run batch
> >     if not exit
> > if file >< exist then
> > create file and run job
> >
> > My problem is see and compare the file creation time
> >
> > I hope that i explained, and sorry for your time
> >
> >
> > "Pegasus (MVP)" wrote:
> >
> >>
> >> "Alberto Arias" <AlbertoAr***@discussions.microsoft.com> wrote in message
> >> news:54097669-7A00-4CE8-A8DA-BFD8A96F7183@microsoft.com...
> >> > Hi,
> >> > I'm trying to compare 2 hour but i don't find the correct script.
> >> > I'm trying to test the excution of one aplication with a flag. i like
> >> > check
> >> > the flag and test if the creation time of this (flag.txt) it's 6 horas
> >> > minor
> >> > to delete the file or retry it.
> >> > The problem it's that i can compare the system time with the time of
> >> > the
> >> > file flag.txt
> >> >
> >> > I'm a newbie in script. I think it's easy but... i'm too clumsy to find
> >> > where i have the problem...
> >> >
> >> > Can you help me???
> >> >
> >> > P.D: Sorry for me poor english
> >>
> >> Unfortunately your post is not clear enough to give you
> >> a good answer. I recommend you ask a friend with good
> >> English skills to help you reword it.
> >>
> >>
> >>
>
>
>
Author
26 Nov 2007 11:40 AM
Pegasus (MVP)
You have to post YOUR version of the file, without # characters,
so that I can see what you did.


Show quote
"Alberto Arias" <AlbertoAr***@discussions.microsoft.com> wrote in message
news:F7F8DD4C-2900-466D-8F46-C4C4A2F3A69D@microsoft.com...
> Thank you very much for your time. Unfortunately your script don't work in
> my
> enviroment. I received error in execution.
> I remove all "#" tag. When i execute this i receive no valid carater for
> "@". When i delete this, i found error Expected statement in line 3.
>
> i'm trying to declare tehe variable, but i have too much problems. In your
> enviroment work fine???
>
>
> "Pegasus (MVP)" wrote:
>
>> OK - try this batch file:
>> #@echo off
>> #setlocal EnableDelayedExpansion
>> #set Semaphore=d:\Data\Semaphore.txt
>> #
>> #echo>  c:\test.vbs Set objFSO =
>> CreateObject("Scripting.FileSystemObject")
>> #echo>> c:\test.vbs Set file = objFSO.GetFile("%Semaphore%")
>> #echo>> c:\test.vbs wscript.quit (DateDiff("h", file.DateLastModified,
>> Now)
>> ^> 6)
>> #
>> #if exist "%Semaphore%" (
>> # cscript //nologo c:\test.vbs
>> # if !ErrorLevel! NEQ 0 goto :eof
>> # del "%Semaphore%"
>> # call batchfile.bat
>> #) else (
>> # echo. > %Semaphore%
>> # call batchfile.bat
>> #)
>>
>> I placed a # to mark the beginning of each line. You must
>> remove them before running the batch file.
>> "Alberto Arias" <AlbertoAr***@discussions.microsoft.com> wrote in message
>> news:B4ACE61D-D9E3-4328-8EE1-8F9AD9DCD448@microsoft.com...
>> > i'm go to try explain it.
>> > I want to do a script that it test the hour when a file was created.
>> > i'm runnig a batch with multiples treaths and i want to do one file to
>> > use
>> > this as one semafhore.
>> >
>> > runing job==>
>> > if file == exist then
>> > see the creation hour of file
>> >     if the creation hour < 6 hours (local time) then
>> >     delete file and run batch
>> >     if not exit
>> > if file >< exist then
>> > create file and run job
>> >
>> > My problem is see and compare the file creation time
>> >
>> > I hope that i explained, and sorry for your time
>> >
>> >
>> > "Pegasus (MVP)" wrote:
>> >
>> >>
>> >> "Alberto Arias" <AlbertoAr***@discussions.microsoft.com> wrote in
>> >> message
>> >> news:54097669-7A00-4CE8-A8DA-BFD8A96F7183@microsoft.com...
>> >> > Hi,
>> >> > I'm trying to compare 2 hour but i don't find the correct script.
>> >> > I'm trying to test the excution of one aplication with a flag. i
>> >> > like
>> >> > check
>> >> > the flag and test if the creation time of this (flag.txt) it's 6
>> >> > horas
>> >> > minor
>> >> > to delete the file or retry it.
>> >> > The problem it's that i can compare the system time with the time of
>> >> > the
>> >> > file flag.txt
>> >> >
>> >> > I'm a newbie in script. I think it's easy but... i'm too clumsy to
>> >> > find
>> >> > where i have the problem...
>> >> >
>> >> > Can you help me???
>> >> >
>> >> > P.D: Sorry for me poor english
>> >>
>> >> Unfortunately your post is not clear enough to give you
>> >> a good answer. I recommend you ask a friend with good
>> >> English skills to help you reword it.
>> >>
>> >>
>> >>
>>
>>
>>
Author
26 Nov 2007 11:59 AM
Alberto Arias
i use the same script. I only modified the batchfile that you use:

@echo off <==The @ caracter make me one error
setlocal EnableDelayedExpansion

# Declaramos cual es el fichero que sera la variable
set Semaphore=C:\scripts\prueba\Semaphore.txt <== I use your file in other
path


# echo> c:\test.vbs <=== i'm trying in the same line all and in other line
the
Set objFSO = CreateObject("Scripting.FileSystemObject")  <==object, actually
is in only one line
#echo>> c:\test.vbs  <== same
Set file = objFSO.GetFile("%Semaphore%")
#echo>> c:\test.vbs
wscript.quit (DateDiff("h", file.DateLastModified, Now)^> 6)

if exist "%Semaphore%"
(
cscript //nologo c:\test.vbs
if !ErrorLevel! NEQ 0 goto :eof
del "%Semaphore%"
call batchfile.bat <== to try execution i call batchfile.bat that run notepad
) else
(
echo. > %Semaphore%
call batchfile2.bat <== to try execution i call batchfile.bat that run
iexplore
)

i call the script test.vbs like in your script. I'm trying in s.o xp and in
one server with w2k3 sp2

All files are in the same folder c:\scripts\prueba.

Thank you very much for your patience and time. i know i'm very clumsy with
scripting


Show quote
"Pegasus (MVP)" wrote:

> You have to post YOUR version of the file, without # characters,
> so that I can see what you did.
>
>
> "Alberto Arias" <AlbertoAr***@discussions.microsoft.com> wrote in message
> news:F7F8DD4C-2900-466D-8F46-C4C4A2F3A69D@microsoft.com...
> > Thank you very much for your time. Unfortunately your script don't work in
> > my
> > enviroment. I received error in execution.
> > I remove all "#" tag. When i execute this i receive no valid carater for
> > "@". When i delete this, i found error Expected statement in line 3.
> >
> > i'm trying to declare tehe variable, but i have too much problems. In your
> > enviroment work fine???
> >
> >
> > "Pegasus (MVP)" wrote:
> >
> >> OK - try this batch file:
> >> #@echo off
> >> #setlocal EnableDelayedExpansion
> >> #set Semaphore=d:\Data\Semaphore.txt
> >> #
> >> #echo>  c:\test.vbs Set objFSO =
> >> CreateObject("Scripting.FileSystemObject")
> >> #echo>> c:\test.vbs Set file = objFSO.GetFile("%Semaphore%")
> >> #echo>> c:\test.vbs wscript.quit (DateDiff("h", file.DateLastModified,
> >> Now)
> >> ^> 6)
> >> #
> >> #if exist "%Semaphore%" (
> >> # cscript //nologo c:\test.vbs
> >> # if !ErrorLevel! NEQ 0 goto :eof
> >> # del "%Semaphore%"
> >> # call batchfile.bat
> >> #) else (
> >> # echo. > %Semaphore%
> >> # call batchfile.bat
> >> #)
> >>
> >> I placed a # to mark the beginning of each line. You must
> >> remove them before running the batch file.
> >> "Alberto Arias" <AlbertoAr***@discussions.microsoft.com> wrote in message
> >> news:B4ACE61D-D9E3-4328-8EE1-8F9AD9DCD448@microsoft.com...
> >> > i'm go to try explain it.
> >> > I want to do a script that it test the hour when a file was created.
> >> > i'm runnig a batch with multiples treaths and i want to do one file to
> >> > use
> >> > this as one semafhore.
> >> >
> >> > runing job==>
> >> > if file == exist then
> >> > see the creation hour of file
> >> >     if the creation hour < 6 hours (local time) then
> >> >     delete file and run batch
> >> >     if not exit
> >> > if file >< exist then
> >> > create file and run job
> >> >
> >> > My problem is see and compare the file creation time
> >> >
> >> > I hope that i explained, and sorry for your time
> >> >
> >> >
> >> > "Pegasus (MVP)" wrote:
> >> >
> >> >>
> >> >> "Alberto Arias" <AlbertoAr***@discussions.microsoft.com> wrote in
> >> >> message
> >> >> news:54097669-7A00-4CE8-A8DA-BFD8A96F7183@microsoft.com...
> >> >> > Hi,
> >> >> > I'm trying to compare 2 hour but i don't find the correct script.
> >> >> > I'm trying to test the excution of one aplication with a flag. i
> >> >> > like
> >> >> > check
> >> >> > the flag and test if the creation time of this (flag.txt) it's 6
> >> >> > horas
> >> >> > minor
> >> >> > to delete the file or retry it.
> >> >> > The problem it's that i can compare the system time with the time of
> >> >> > the
> >> >> > file flag.txt
> >> >> >
> >> >> > I'm a newbie in script. I think it's easy but... i'm too clumsy to
> >> >> > find
> >> >> > where i have the problem...
> >> >> >
> >> >> > Can you help me???
> >> >> >
> >> >> > P.D: Sorry for me poor english
> >> >>
> >> >> Unfortunately your post is not clear enough to give you
> >> >> a good answer. I recommend you ask a friend with good
> >> >> English skills to help you reword it.
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>
>
>
>
Author
26 Nov 2007 12:21 PM
Pegasus (MVP)
Two comments:
1. I suspect that you saved the file as a .vbs file. This won't
    work. You must save it as a .bat file.
2. You still have lots of # characters in the script. You must
     remove all of them.

If you still have a problem, remember to post your version
of the file.


Show quote
"Alberto Arias" <AlbertoAr***@discussions.microsoft.com> wrote in message
news:3963A5C3-DEF8-4232-B6C4-391DBDB7CE03@microsoft.com...
>i use the same script. I only modified the batchfile that you use:
>
> @echo off <==The @ caracter make me one error
> setlocal EnableDelayedExpansion
>
> # Declaramos cual es el fichero que sera la variable
> set Semaphore=C:\scripts\prueba\Semaphore.txt <== I use your file in other
> path
>
>
> # echo> c:\test.vbs <=== i'm trying in the same line all and in other line
> the
> Set objFSO = CreateObject("Scripting.FileSystemObject")  <==object,
> actually
> is in only one line
> #echo>> c:\test.vbs  <== same
> Set file = objFSO.GetFile("%Semaphore%")
> #echo>> c:\test.vbs
> wscript.quit (DateDiff("h", file.DateLastModified, Now)^> 6)
>
> if exist "%Semaphore%"
> (
> cscript //nologo c:\test.vbs
> if !ErrorLevel! NEQ 0 goto :eof
> del "%Semaphore%"
> call batchfile.bat <== to try execution i call batchfile.bat that run
> notepad
> ) else
> (
> echo. > %Semaphore%
> call batchfile2.bat <== to try execution i call batchfile.bat that run
> iexplore
> )
>
> i call the script test.vbs like in your script. I'm trying in s.o xp and
> in
> one server with w2k3 sp2
>
> All files are in the same folder c:\scripts\prueba.
>
> Thank you very much for your patience and time. i know i'm very clumsy
> with
> scripting
>
>
> "Pegasus (MVP)" wrote:
>
>> You have to post YOUR version of the file, without # characters,
>> so that I can see what you did.
>>
>>
>> "Alberto Arias" <AlbertoAr***@discussions.microsoft.com> wrote in message
>> news:F7F8DD4C-2900-466D-8F46-C4C4A2F3A69D@microsoft.com...
>> > Thank you very much for your time. Unfortunately your script don't work
>> > in
>> > my
>> > enviroment. I received error in execution.
>> > I remove all "#" tag. When i execute this i receive no valid carater
>> > for
>> > "@". When i delete this, i found error Expected statement in line 3.
>> >
>> > i'm trying to declare tehe variable, but i have too much problems. In
>> > your
>> > enviroment work fine???
>> >
>> >
>> > "Pegasus (MVP)" wrote:
>> >
>> >> OK - try this batch file:
>> >> #@echo off
>> >> #setlocal EnableDelayedExpansion
>> >> #set Semaphore=d:\Data\Semaphore.txt
>> >> #
>> >> #echo>  c:\test.vbs Set objFSO =
>> >> CreateObject("Scripting.FileSystemObject")
>> >> #echo>> c:\test.vbs Set file = objFSO.GetFile("%Semaphore%")
>> >> #echo>> c:\test.vbs wscript.quit (DateDiff("h", file.DateLastModified,
>> >> Now)
>> >> ^> 6)
>> >> #
>> >> #if exist "%Semaphore%" (
>> >> # cscript //nologo c:\test.vbs
>> >> # if !ErrorLevel! NEQ 0 goto :eof
>> >> # del "%Semaphore%"
>> >> # call batchfile.bat
>> >> #) else (
>> >> # echo. > %Semaphore%
>> >> # call batchfile.bat
>> >> #)
>> >>
>> >> I placed a # to mark the beginning of each line. You must
>> >> remove them before running the batch file.
>> >> "Alberto Arias" <AlbertoAr***@discussions.microsoft.com> wrote in
>> >> message
>> >> news:B4ACE61D-D9E3-4328-8EE1-8F9AD9DCD448@microsoft.com...
>> >> > i'm go to try explain it.
>> >> > I want to do a script that it test the hour when a file was created.
>> >> > i'm runnig a batch with multiples treaths and i want to do one file
>> >> > to
>> >> > use
>> >> > this as one semafhore.
>> >> >
>> >> > runing job==>
>> >> > if file == exist then
>> >> > see the creation hour of file
>> >> >     if the creation hour < 6 hours (local time) then
>> >> >     delete file and run batch
>> >> >     if not exit
>> >> > if file >< exist then
>> >> > create file and run job
>> >> >
>> >> > My problem is see and compare the file creation time
>> >> >
>> >> > I hope that i explained, and sorry for your time
>> >> >
>> >> >
>> >> > "Pegasus (MVP)" wrote:
>> >> >
>> >> >>
>> >> >> "Alberto Arias" <AlbertoAr***@discussions.microsoft.com> wrote in
>> >> >> message
>> >> >> news:54097669-7A00-4CE8-A8DA-BFD8A96F7183@microsoft.com...
>> >> >> > Hi,
>> >> >> > I'm trying to compare 2 hour but i don't find the correct script.
>> >> >> > I'm trying to test the excution of one aplication with a flag. i
>> >> >> > like
>> >> >> > check
>> >> >> > the flag and test if the creation time of this (flag.txt) it's 6
>> >> >> > horas
>> >> >> > minor
>> >> >> > to delete the file or retry it.
>> >> >> > The problem it's that i can compare the system time with the time
>> >> >> > of
>> >> >> > the
>> >> >> > file flag.txt
>> >> >> >
>> >> >> > I'm a newbie in script. I think it's easy but... i'm too clumsy
>> >> >> > to
>> >> >> > find
>> >> >> > where i have the problem...
>> >> >> >
>> >> >> > Can you help me???
>> >> >> >
>> >> >> > P.D: Sorry for me poor english
>> >> >>
>> >> >> Unfortunately your post is not clear enough to give you
>> >> >> a good answer. I recommend you ask a friend with good
>> >> >> English skills to help you reword it.
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>>
>>
>>
Author
26 Nov 2007 2:30 PM
Alberto Arias
Hi, thank you very much. The script don's work by the "^" caracter. I've
delete thecaracter and work fine.

I did not know why you call a test.vbs. I understand all now.

I'm really thankfull for your help (and script).

Show quote
"Pegasus (MVP)" wrote:

> Two comments:
> 1. I suspect that you saved the file as a .vbs file. This won't
>     work. You must save it as a .bat file.
> 2. You still have lots of # characters in the script. You must
>      remove all of them.
>
> If you still have a problem, remember to post your version
> of the file.
>
>
> "Alberto Arias" <AlbertoAr***@discussions.microsoft.com> wrote in message
> news:3963A5C3-DEF8-4232-B6C4-391DBDB7CE03@microsoft.com...
> >i use the same script. I only modified the batchfile that you use:
> >
> > @echo off <==The @ caracter make me one error
> > setlocal EnableDelayedExpansion
> >
> > # Declaramos cual es el fichero que sera la variable
> > set Semaphore=C:\scripts\prueba\Semaphore.txt <== I use your file in other
> > path
> >
> >
> > # echo> c:\test.vbs <=== i'm trying in the same line all and in other line
> > the
> > Set objFSO = CreateObject("Scripting.FileSystemObject")  <==object,
> > actually
> > is in only one line
> > #echo>> c:\test.vbs  <== same
> > Set file = objFSO.GetFile("%Semaphore%")
> > #echo>> c:\test.vbs
> > wscript.quit (DateDiff("h", file.DateLastModified, Now)^> 6)
> >
> > if exist "%Semaphore%"
> > (
> > cscript //nologo c:\test.vbs
> > if !ErrorLevel! NEQ 0 goto :eof
> > del "%Semaphore%"
> > call batchfile.bat <== to try execution i call batchfile.bat that run
> > notepad
> > ) else
> > (
> > echo. > %Semaphore%
> > call batchfile2.bat <== to try execution i call batchfile.bat that run
> > iexplore
> > )
> >
> > i call the script test.vbs like in your script. I'm trying in s.o xp and
> > in
> > one server with w2k3 sp2
> >
> > All files are in the same folder c:\scripts\prueba.
> >
> > Thank you very much for your patience and time. i know i'm very clumsy
> > with
> > scripting
> >
> >
> > "Pegasus (MVP)" wrote:
> >
> >> You have to post YOUR version of the file, without # characters,
> >> so that I can see what you did.
> >>
> >>
> >> "Alberto Arias" <AlbertoAr***@discussions.microsoft.com> wrote in message
> >> news:F7F8DD4C-2900-466D-8F46-C4C4A2F3A69D@microsoft.com...
> >> > Thank you very much for your time. Unfortunately your script don't work
> >> > in
> >> > my
> >> > enviroment. I received error in execution.
> >> > I remove all "#" tag. When i execute this i receive no valid carater
> >> > for
> >> > "@". When i delete this, i found error Expected statement in line 3.
> >> >
> >> > i'm trying to declare tehe variable, but i have too much problems. In
> >> > your
> >> > enviroment work fine???
> >> >
> >> >
> >> > "Pegasus (MVP)" wrote:
> >> >
> >> >> OK - try this batch file:
> >> >> #@echo off
> >> >> #setlocal EnableDelayedExpansion
> >> >> #set Semaphore=d:\Data\Semaphore.txt
> >> >> #
> >> >> #echo>  c:\test.vbs Set objFSO =
> >> >> CreateObject("Scripting.FileSystemObject")
> >> >> #echo>> c:\test.vbs Set file = objFSO.GetFile("%Semaphore%")
> >> >> #echo>> c:\test.vbs wscript.quit (DateDiff("h", file.DateLastModified,
> >> >> Now)
> >> >> ^> 6)
> >> >> #
> >> >> #if exist "%Semaphore%" (
> >> >> # cscript //nologo c:\test.vbs
> >> >> # if !ErrorLevel! NEQ 0 goto :eof
> >> >> # del "%Semaphore%"
> >> >> # call batchfile.bat
> >> >> #) else (
> >> >> # echo. > %Semaphore%
> >> >> # call batchfile.bat
> >> >> #)
> >> >>
> >> >> I placed a # to mark the beginning of each line. You must
> >> >> remove them before running the batch file.
> >> >> "Alberto Arias" <AlbertoAr***@discussions.microsoft.com> wrote in
> >> >> message
> >> >> news:B4ACE61D-D9E3-4328-8EE1-8F9AD9DCD448@microsoft.com...
> >> >> > i'm go to try explain it.
> >> >> > I want to do a script that it test the hour when a file was created.
> >> >> > i'm runnig a batch with multiples treaths and i want to do one file
> >> >> > to
> >> >> > use
> >> >> > this as one semafhore.
> >> >> >
> >> >> > runing job==>
> >> >> > if file == exist then
> >> >> > see the creation hour of file
> >> >> >     if the creation hour < 6 hours (local time) then
> >> >> >     delete file and run batch
> >> >> >     if not exit
> >> >> > if file >< exist then
> >> >> > create file and run job
> >> >> >
> >> >> > My problem is see and compare the file creation time
> >> >> >
> >> >> > I hope that i explained, and sorry for your time
> >> >> >
> >> >> >
> >> >> > "Pegasus (MVP)" wrote:
> >> >> >
> >> >> >>
> >> >> >> "Alberto Arias" <AlbertoAr***@discussions.microsoft.com> wrote in
> >> >> >> message
> >> >> >> news:54097669-7A00-4CE8-A8DA-BFD8A96F7183@microsoft.com...
> >> >> >> > Hi,
> >> >> >> > I'm trying to compare 2 hour but i don't find the correct script.
> >> >> >> > I'm trying to test the excution of one aplication with a flag. i
> >> >> >> > like
> >> >> >> > check
> >> >> >> > the flag and test if the creation time of this (flag.txt) it's 6
> >> >> >> > horas
> >> >> >> > minor
> >> >> >> > to delete the file or retry it.
> >> >> >> > The problem it's that i can compare the system time with the time
> >> >> >> > of
> >> >> >> > the
> >> >> >> > file flag.txt
> >> >> >> >
> >> >> >> > I'm a newbie in script. I think it's easy but... i'm too clumsy
> >> >> >> > to
> >> >> >> > find
> >> >> >> > where i have the problem...
> >> >> >> >
> >> >> >> > Can you help me???
> >> >> >> >
> >> >> >> > P.D: Sorry for me poor english
> >> >> >>
> >> >> >> Unfortunately your post is not clear enough to give you
> >> >> >> a good answer. I recommend you ask a friend with good
> >> >> >> English skills to help you reword it.
> >> >> >>
> >> >> >>
> >> >> >>
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>
>
>
>
Author
26 Nov 2007 3:10 PM
Pegasus (MVP)
Thanks for the feedback.

The caret character ^ is required when generating test.vbs
file from within the batch file. If you create test.vbs manually
then you must remove the ^ character.


Show quote
"Alberto Arias" <AlbertoAr***@discussions.microsoft.com> wrote in message
news:6BAEBC16-82AB-4C37-A8F7-2E953F826698@microsoft.com...
>
> Hi, thank you very much. The script don's work by the "^" caracter. I've
> delete thecaracter and work fine.
>
> I did not know why you call a test.vbs. I understand all now.
>
> I'm really thankfull for your help (and script).
>
> "Pegasus (MVP)" wrote:
>
>> Two comments:
>> 1. I suspect that you saved the file as a .vbs file. This won't
>>     work. You must save it as a .bat file.
>> 2. You still have lots of # characters in the script. You must
>>      remove all of them.
>>
>> If you still have a problem, remember to post your version
>> of the file.
>>
>>
>> "Alberto Arias" <AlbertoAr***@discussions.microsoft.com> wrote in message
>> news:3963A5C3-DEF8-4232-B6C4-391DBDB7CE03@microsoft.com...
>> >i use the same script. I only modified the batchfile that you use:
>> >
>> > @echo off <==The @ caracter make me one error
>> > setlocal EnableDelayedExpansion
>> >
>> > # Declaramos cual es el fichero que sera la variable
>> > set Semaphore=C:\scripts\prueba\Semaphore.txt <== I use your file in
>> > other
>> > path
>> >
>> >
>> > # echo> c:\test.vbs <=== i'm trying in the same line all and in other
>> > line
>> > the
>> > Set objFSO = CreateObject("Scripting.FileSystemObject")  <==object,
>> > actually
>> > is in only one line
>> > #echo>> c:\test.vbs  <== same
>> > Set file = objFSO.GetFile("%Semaphore%")
>> > #echo>> c:\test.vbs
>> > wscript.quit (DateDiff("h", file.DateLastModified, Now)^> 6)
>> >
>> > if exist "%Semaphore%"
>> > (
>> > cscript //nologo c:\test.vbs
>> > if !ErrorLevel! NEQ 0 goto :eof
>> > del "%Semaphore%"
>> > call batchfile.bat <== to try execution i call batchfile.bat that run
>> > notepad
>> > ) else
>> > (
>> > echo. > %Semaphore%
>> > call batchfile2.bat <== to try execution i call batchfile.bat that run
>> > iexplore
>> > )
>> >
>> > i call the script test.vbs like in your script. I'm trying in s.o xp
>> > and
>> > in
>> > one server with w2k3 sp2
>> >
>> > All files are in the same folder c:\scripts\prueba.
>> >
>> > Thank you very much for your patience and time. i know i'm very clumsy
>> > with
>> > scripting
>> >
>> >
>> > "Pegasus (MVP)" wrote:
>> >
>> >> You have to post YOUR version of the file, without # characters,
>> >> so that I can see what you did.
>> >>
>> >>
>> >> "Alberto Arias" <AlbertoAr***@discussions.microsoft.com> wrote in
>> >> message
>> >> news:F7F8DD4C-2900-466D-8F46-C4C4A2F3A69D@microsoft.com...
>> >> > Thank you very much for your time. Unfortunately your script don't
>> >> > work
>> >> > in
>> >> > my
>> >> > enviroment. I received error in execution.
>> >> > I remove all "#" tag. When i execute this i receive no valid carater
>> >> > for
>> >> > "@". When i delete this, i found error Expected statement in line 3.
>> >> >
>> >> > i'm trying to declare tehe variable, but i have too much problems.
>> >> > In
>> >> > your
>> >> > enviroment work fine???
>> >> >
>> >> >
>> >> > "Pegasus (MVP)" wrote:
>> >> >
>> >> >> OK - try this batch file:
>> >> >> #@echo off
>> >> >> #setlocal EnableDelayedExpansion
>> >> >> #set Semaphore=d:\Data\Semaphore.txt
>> >> >> #
>> >> >> #echo>  c:\test.vbs Set objFSO =
>> >> >> CreateObject("Scripting.FileSystemObject")
>> >> >> #echo>> c:\test.vbs Set file = objFSO.GetFile("%Semaphore%")
>> >> >> #echo>> c:\test.vbs wscript.quit (DateDiff("h",
>> >> >> file.DateLastModified,
>> >> >> Now)
>> >> >> ^> 6)
>> >> >> #
>> >> >> #if exist "%Semaphore%" (
>> >> >> # cscript //nologo c:\test.vbs
>> >> >> # if !ErrorLevel! NEQ 0 goto :eof
>> >> >> # del "%Semaphore%"
>> >> >> # call batchfile.bat
>> >> >> #) else (
>> >> >> # echo. > %Semaphore%
>> >> >> # call batchfile.bat
>> >> >> #)
>> >> >>
>> >> >> I placed a # to mark the beginning of each line. You must
>> >> >> remove them before running the batch file.
>> >> >> "Alberto Arias" <AlbertoAr***@discussions.microsoft.com> wrote in
>> >> >> message
>> >> >> news:B4ACE61D-D9E3-4328-8EE1-8F9AD9DCD448@microsoft.com...
>> >> >> > i'm go to try explain it.
>> >> >> > I want to do a script that it test the hour when a file was
>> >> >> > created.
>> >> >> > i'm runnig a batch with multiples treaths and i want to do one
>> >> >> > file
>> >> >> > to
>> >> >> > use
>> >> >> > this as one semafhore.
>> >> >> >
>> >> >> > runing job==>
>> >> >> > if file == exist then
>> >> >> > see the creation hour of file
>> >> >> >     if the creation hour < 6 hours (local time) then
>> >> >> >     delete file and run batch
>> >> >> >     if not exit
>> >> >> > if file >< exist then
>> >> >> > create file and run job
>> >> >> >
>> >> >> > My problem is see and compare the file creation time
>> >> >> >
>> >> >> > I hope that i explained, and sorry for your time
>> >> >> >
>> >> >> >
>> >> >> > "Pegasus (MVP)" wrote:
>> >> >> >
>> >> >> >>
>> >> >> >> "Alberto Arias" <AlbertoAr***@discussions.microsoft.com> wrote
>> >> >> >> in
>> >> >> >> message
>> >> >> >> news:54097669-7A00-4CE8-A8DA-BFD8A96F7183@microsoft.com...
>> >> >> >> > Hi,
>> >> >> >> > I'm trying to compare 2 hour but i don't find the correct
>> >> >> >> > script.
>> >> >> >> > I'm trying to test the excution of one aplication with a flag.
>> >> >> >> > i
>> >> >> >> > like
>> >> >> >> > check
>> >> >> >> > the flag and test if the creation time of this (flag.txt) it's
>> >> >> >> > 6
>> >> >> >> > horas
>> >> >> >> > minor
>> >> >> >> > to delete the file or retry it.
>> >> >> >> > The problem it's that i can compare the system time with the
>> >> >> >> > time
>> >> >> >> > of
>> >> >> >> > the
>> >> >> >> > file flag.txt
>> >> >> >> >
>> >> >> >> > I'm a newbie in script. I think it's easy but... i'm too
>> >> >> >> > clumsy
>> >> >> >> > to
>> >> >> >> > find
>> >> >> >> > where i have the problem...
>> >> >> >> >
>> >> >> >> > Can you help me???
>> >> >> >> >
>> >> >> >> > P.D: Sorry for me poor english
>> >> >> >>
>> >> >> >> Unfortunately your post is not clear enough to give you
>> >> >> >> a good answer. I recommend you ask a friend with good
>> >> >> >> English skills to help you reword it.
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>>
>>
>>
Author
26 Nov 2007 5:04 PM
Alberto Arias
I don't make the file test.vbs and work fine without  "^" caracter. I'm going
to test in w2k3.
Thanks

Show quote
"Pegasus (MVP)" wrote:

> Thanks for the feedback.
>
> The caret character ^ is required when generating test.vbs
> file from within the batch file. If you create test.vbs manually
> then you must remove the ^ character.
>
>
> "Alberto Arias" <AlbertoAr***@discussions.microsoft.com> wrote in message
> news:6BAEBC16-82AB-4C37-A8F7-2E953F826698@microsoft.com...
> >
> > Hi, thank you very much. The script don's work by the "^" caracter. I've
> > delete thecaracter and work fine.
> >
> > I did not know why you call a test.vbs. I understand all now.
> >
> > I'm really thankfull for your help (and script).
> >
> > "Pegasus (MVP)" wrote:
> >
> >> Two comments:
> >> 1. I suspect that you saved the file as a .vbs file. This won't
> >>     work. You must save it as a .bat file.
> >> 2. You still have lots of # characters in the script. You must
> >>      remove all of them.
> >>
> >> If you still have a problem, remember to post your version
> >> of the file.
> >>
> >>
> >> "Alberto Arias" <AlbertoAr***@discussions.microsoft.com> wrote in message
> >> news:3963A5C3-DEF8-4232-B6C4-391DBDB7CE03@microsoft.com...
> >> >i use the same script. I only modified the batchfile that you use:
> >> >
> >> > @echo off <==The @ caracter make me one error
> >> > setlocal EnableDelayedExpansion
> >> >
> >> > # Declaramos cual es el fichero que sera la variable
> >> > set Semaphore=C:\scripts\prueba\Semaphore.txt <== I use your file in
> >> > other
> >> > path
> >> >
> >> >
> >> > # echo> c:\test.vbs <=== i'm trying in the same line all and in other
> >> > line
> >> > the
> >> > Set objFSO = CreateObject("Scripting.FileSystemObject")  <==object,
> >> > actually
> >> > is in only one line
> >> > #echo>> c:\test.vbs  <== same
> >> > Set file = objFSO.GetFile("%Semaphore%")
> >> > #echo>> c:\test.vbs
> >> > wscript.quit (DateDiff("h", file.DateLastModified, Now)^> 6)
> >> >
> >> > if exist "%Semaphore%"
> >> > (
> >> > cscript //nologo c:\test.vbs
> >> > if !ErrorLevel! NEQ 0 goto :eof
> >> > del "%Semaphore%"
> >> > call batchfile.bat <== to try execution i call batchfile.bat that run
> >> > notepad
> >> > ) else
> >> > (
> >> > echo. > %Semaphore%
> >> > call batchfile2.bat <== to try execution i call batchfile.bat that run
> >> > iexplore
> >> > )
> >> >
> >> > i call the script test.vbs like in your script. I'm trying in s.o xp
> >> > and
> >> > in
> >> > one server with w2k3 sp2
> >> >
> >> > All files are in the same folder c:\scripts\prueba.
> >> >
> >> > Thank you very much for your patience and time. i know i'm very clumsy
> >> > with
> >> > scripting
> >> >
> >> >
> >> > "Pegasus (MVP)" wrote:
> >> >
> >> >> You have to post YOUR version of the file, without # characters,
> >> >> so that I can see what you did.
> >> >>
> >> >>
> >> >> "Alberto Arias" <AlbertoAr***@discussions.microsoft.com> wrote in
> >> >> message
> >> >> news:F7F8DD4C-2900-466D-8F46-C4C4A2F3A69D@microsoft.com...
> >> >> > Thank you very much for your time. Unfortunately your script don't
> >> >> > work
> >> >> > in
> >> >> > my
> >> >> > enviroment. I received error in execution.
> >> >> > I remove all "#" tag. When i execute this i receive no valid carater
> >> >> > for
> >> >> > "@". When i delete this, i found error Expected statement in line 3.
> >> >> >
> >> >> > i'm trying to declare tehe variable, but i have too much problems.
> >> >> > In
> >> >> > your
> >> >> > enviroment work fine???
> >> >> >
> >> >> >
> >> >> > "Pegasus (MVP)" wrote:
> >> >> >
> >> >> >> OK - try this batch file:
> >> >> >> #@echo off
> >> >> >> #setlocal EnableDelayedExpansion
> >> >> >> #set Semaphore=d:\Data\Semaphore.txt
> >> >> >> #
> >> >> >> #echo>  c:\test.vbs Set objFSO =
> >> >> >> CreateObject("Scripting.FileSystemObject")
> >> >> >> #echo>> c:\test.vbs Set file = objFSO.GetFile("%Semaphore%")
> >> >> >> #echo>> c:\test.vbs wscript.quit (DateDiff("h",
> >> >> >> file.DateLastModified,
> >> >> >> Now)
> >> >> >> ^> 6)
> >> >> >> #
> >> >> >> #if exist "%Semaphore%" (
> >> >> >> # cscript //nologo c:\test.vbs
> >> >> >> # if !ErrorLevel! NEQ 0 goto :eof
> >> >> >> # del "%Semaphore%"
> >> >> >> # call batchfile.bat
> >> >> >> #) else (
> >> >> >> # echo. > %Semaphore%
> >> >> >> # call batchfile.bat
> >> >> >> #)
> >> >> >>
> >> >> >> I placed a # to mark the beginning of each line. You must
> >> >> >> remove them before running the batch file.
> >> >> >> "Alberto Arias" <AlbertoAr***@discussions.microsoft.com> wrote in
> >> >> >> message
> >> >> >> news:B4ACE61D-D9E3-4328-8EE1-8F9AD9DCD448@microsoft.com...
> >> >> >> > i'm go to try explain it.
> >> >> >> > I want to do a script that it test the hour when a file was
> >> >> >> > created.
> >> >> >> > i'm runnig a batch with multiples treaths and i want to do one
> >> >> >> > file
> >> >> >> > to
> >> >> >> > use
> >> >> >> > this as one semafhore.
> >> >> >> >
> >> >> >> > runing job==>
> >> >> >> > if file == exist then
> >> >> >> > see the creation hour of file
> >> >> >> >     if the creation hour < 6 hours (local time) then
> >> >> >> >     delete file and run batch
> >> >> >> >     if not exit
> >> >> >> > if file >< exist then
> >> >> >> > create file and run job
> >> >> >> >
> >> >> >> > My problem is see and compare the file creation time
> >> >> >> >
> >> >> >> > I hope that i explained, and sorry for your time
> >> >> >> >
> >> >> >> >
> >> >> >> > "Pegasus (MVP)" wrote:
> >> >> >> >
> >> >> >> >>
> >> >> >> >> "Alberto Arias" <AlbertoAr***@discussions.microsoft.com> wrote
> >> >> >> >> in
> >> >> >> >> message
> >> >> >> >> news:54097669-7A00-4CE8-A8DA-BFD8A96F7183@microsoft.com...
> >> >> >> >> > Hi,
> >> >> >> >> > I'm trying to compare 2 hour but i don't find the correct
> >> >> >> >> > script.
> >> >> >> >> > I'm trying to test the excution of one aplication with a flag.
> >> >> >> >> > i
> >> >> >> >> > like
> >> >> >> >> > check
> >> >> >> >> > the flag and test if the creation time of this (flag.txt) it's
> >> >> >> >> > 6
> >> >> >> >> > horas
> >> >> >> >> > minor
> >> >> >> >> > to delete the file or retry it.
> >> >> >> >> > The problem it's that i can compare the system time with the
> >> >> >> >> > time
> >> >> >> >> > of
> >> >> >> >> > the
> >> >> >> >> > file flag.txt
> >> >> >> >> >
> >> >> >> >> > I'm a newbie in script. I think it's easy but... i'm too
> >> >> >> >> > clumsy
> >> >> >> >> > to
> >> >> >> >> > find
> >> >> >> >> > where i have the problem...
> >> >> >> >> >
> >> >> >> >> > Can you help me???
> >> >> >> >> >
> >> >> >> >> > P.D: Sorry for me poor english
> >> >> >> >>
> >> >> >> >> Unfortunately your post is not clear enough to give you
> >> >> >> >> a good answer. I recommend you ask a friend with good
> >> >> >> >> English skills to help you reword it.
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>
>
>
>

AddThis Social Bookmark Button