PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Hébergement serveur > ms.win.server.scripting > new script
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
new script

Réponse
 
LinkBack Outils de la discussion
Vieux 23/11/2007, 12h38   #1
Alberto Arias
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut new script

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 me???

P.D: Sorry for me poor english
  Réponse avec citation
Vieux 25/11/2007, 15h47   #2
Pegasus \(MVP\)
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: new script


"Alberto Arias" <AlbertoArias@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 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 you reword it.


  Réponse avec citation
Vieux 25/11/2007, 16h09   #3
Alberto Arias
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: new script

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" <AlbertoArias@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 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 you reword it.
>
>
>

  Réponse avec citation
Vieux 25/11/2007, 16h47   #4
Pegasus \(MVP\)
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: new script

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" <AlbertoArias@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" <AlbertoArias@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 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 you reword it.
>>
>>
>>



  Réponse avec citation
Vieux 26/11/2007, 11h35   #5
Alberto Arias
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: new script

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" <AlbertoArias@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" <AlbertoArias@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 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 you reword it.
> >>
> >>
> >>

>
>
>

  Réponse avec citation
Vieux 26/11/2007, 11h40   #6
Pegasus \(MVP\)
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: new script

You have to post YOUR version of the file, without # characters,
so that I can see what you did.


"Alberto Arias" <AlbertoArias@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" <AlbertoArias@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" <AlbertoArias@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 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 you reword it.
>> >>
>> >>
>> >>

>>
>>
>>



  Réponse avec citation
Vieux 26/11/2007, 11h59   #7
Alberto Arias
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: new script

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" <AlbertoArias@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" <AlbertoArias@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" <AlbertoArias@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 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 you reword it.
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>

>
>
>

  Réponse avec citation
Vieux 26/11/2007, 12h21   #8
Pegasus \(MVP\)
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: new script

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" <AlbertoArias@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" <AlbertoArias@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" <AlbertoArias@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" <AlbertoArias@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 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 you reword it.
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>

>>
>>
>>



  Réponse avec citation
Vieux 26/11/2007, 14h30   #9
Alberto Arias
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: new script


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 (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" <AlbertoArias@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" <AlbertoArias@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" <AlbertoArias@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" <AlbertoArias@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 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 you reword it.
> >> >> >>
> >> >> >>
> >> >> >>
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>

>
>
>

  Réponse avec citation
Vieux 26/11/2007, 15h10   #10
Pegasus \(MVP\)
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: new script

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" <AlbertoArias@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 (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" <AlbertoArias@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" <AlbertoArias@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" <AlbertoArias@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" <AlbertoArias@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 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 you reword it.
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>

>>
>>
>>



  Réponse avec citation
Vieux 26/11/2007, 17h04   #11
Alberto Arias
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: new script

I don't make the file test.vbs and work fine without "^" caracter. I'm going
to test in w2k3.
Thanks

"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" <AlbertoArias@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 (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" <AlbertoArias@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" <AlbertoArias@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" <AlbertoArias@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" <AlbertoArias@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 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 you reword it.
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>

>
>
>

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 05h31.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,45587 seconds with 19 queries