|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
"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. |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
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. > > > |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
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. >> >> >> |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
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. > >> > >> > >> > > > |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
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. >> >> >> >> >> >> >> >> >> |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
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. > >> >> > >> >> > >> >> > >> > >> > >> > > > |
|
|
|
#8 |
|
Messages: n/a
Hébergeur: |
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. >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> |
|
|
|
#9 |
|
Messages: n/a
Hébergeur: |
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. > >> >> >> > >> >> >> > >> >> >> > >> >> > >> >> > >> >> > >> > >> > >> > > > |
|
|
|
#10 |
|
Messages: n/a
Hébergeur: |
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. >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> |
|
|
|
#11 |
|
Messages: n/a
Hébergeur: |
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. > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> >> > >> >> >> > >> >> >> > >> >> > >> >> > >> >> > >> > >> > >> > > > |
|
![]() |
| Outils de la discussion | |
|
|