Guest Posted February 3, 2012 Share Posted February 3, 2012 I've attached the CMD that works for me in XPx64. The only change made from the script I posted above was to replace the reference from Disks.txt to %~dpnx1, so it takes the input file as a parameter.Unbound.cmd Link to comment Share on other sites More sharing options...
Marcos Posted February 3, 2012 Author Share Posted February 3, 2012 I tried to reply to this forum and then I saw 'you cannot reply to this Thread' !! I looked around and realized -- I wasn't logged in !!So now I'm logged in! ( Obviously !!)I tried 5eraph's script and it worked like a charm (tested on a x64 machine with 64 bit OS).... so it seems it might not work properly on a 32 bit OS (good to know).Anyways, enough of chatter ! I will put all ur scripts to test ! I will be running them on some servers to see how it goes...Thanks again for the Posts !! U GUYZ R AWESOME !!! Link to comment Share on other sites More sharing options...
Guest Posted February 3, 2012 Share Posted February 3, 2012 (edited) You're welcome, Marcos. And thanks for testing my script yourself. In the following example the text file should be named "Disks.txt".I tried the various batches timing them on the sample file posted, which I saved as "unbound.txt".This is why jaclaz's copy of my script failed. It depended upon the file being named Disks.txt.Updated, copy/paste problem was to blame.A 10x run of my script takes 1.1 seconds on my machine, when PAUSE is removed.My speedtest script:@ECHO OFFSETLOCAL EnableDelayedExpansionCALL :Func_TimeStampSET /A nStartTime=!nTimeStamp_FuncResult!FOR /L %%G IN (1,1,10) DO (CALL Unbound.cmd Unbound.txt)CALL :Func_TimeStampCALL :Func_ElapsedTime !nStartTime! !nTimeStamp_FuncResult!PAUSEGOTO :eof:Func_TimeStamp:: Set TimeStamp as the number of hundredths of seconds so far todayFOR /F "tokens=1-3 delims=:" %%Q IN ("!TIME!") DO ( SET "H_TimeStamp=%%Q" SET "M_TimeStamp=%%R" IF "!H_TimeStamp:~0,1!"=="0" (SET "H_TimeStamp=!H_TimeStamp:~1!") IF "!M_TimeStamp:~0,1!"=="0" (SET "M_TimeStamp=!M_TimeStamp:~1!") FOR /F "tokens=1-2 delims=." %%T IN ("%%S") DO ( SET "S_TimeStamp=%%T" SET "SS_TimeStamp=%%U" IF "!S_TimeStamp:~0,1!"=="0" (SET "S_TimeStamp=!S_TimeStamp:~1!") IF "!SS_TimeStamp:~0,1!"=="0" (SET "SS_TimeStamp=!SS_TimeStamp:~1!") SET /A "nTimeStamp_FuncResult=!H_TimeStamp! * 360000 + !M_TimeStamp! * 6000 + !S_TimeStamp! * 100 + !SS_TimeStamp!") )GOTO :eof:Func_ElapsedTime:: Work out the elapsed time to the hundredth of a second. Do the correct calculation to:: account for roll-over (assumes the whole elapsed time is always less than 24 hours).IF %2 GEQ %1 (SET /A "Local_ElapsedTime=%2 - %1") ELSE (SET /A "Local_ElapsedTime=%2 + 8640000 - %1")SET "LocalMessage_ElapsedTime=Total time elapsed: ":: Split elapsed time into hours, minutes and secondsSET /A "Hours_ElapsedTime=!Local_ElapsedTime! / 360000"SET /A "Minutes_ElapsedTime=(!Local_ElapsedTime! - !Hours_ElapsedTime! * 360000) / 6000"SET /A "Seconds_ElapsedTime=(!Local_ElapsedTime! - !Hours_ElapsedTime! * 360000 - !Minutes_ElapsedTime! * 6000) / 100"SET "Hundredths_ElapsedTime=!Local_ElapsedTime:~-2!"IF "!Hundredths_ElapsedTime!"=="!Hundredths_ElapsedTime:~0,1!0" (SET "Hundredths_ElapsedTime=!Hundredths_ElapsedTime:~0,1!"):: If a field is zero then do not display that field in the formatted resultIF "!Hours_ElapsedTime!"=="0" (SET "Hours_ElapsedTime=") ELSE (SET "Hours_ElapsedTime= !Hours_ElapsedTime!h")IF "!Minutes_ElapsedTime!"=="0" (SET "Minutes_ElapsedTime=") ELSE (SET "Minutes_ElapsedTime= !Minutes_ElapsedTime!m")IF NOT "!Hundredths_ElapsedTime!"=="0" (SET "Seconds_ElapsedTime= !Seconds_ElapsedTime!.!Hundredths_ElapsedTime!s") ELSE ( IF "!Seconds_ElapsedTime!"=="0" (SET "Seconds_ElapsedTime=") ELSE (SET "Seconds_ElapsedTime= !Seconds_ElapsedTime!s")):: If no time elapsed then set time as zero seconds.IF "!Hours_ElapsedTime!!Minutes_ElapsedTime!!Seconds_ElapsedTime!"=="" (SET "Seconds_ElapsedTime= 0s")ECHO !LocalMessage_ElapsedTime!!Hours_ElapsedTime!!Minutes_ElapsedTime!!Seconds_ElapsedTime!GOTO :eof Edited February 3, 2012 by 5eraph Link to comment Share on other sites More sharing options...
jaclaz Posted February 3, 2012 Share Posted February 3, 2012 (edited) This is why jaclaz's copy of my script failed. It depended upon the file being named Disks.txt.A 10x run of my script takes 1.1 seconds on my machine, when PAUSE is removed.Well, I did change the name in the batch from disks.txt to unbound.txt, obviously.Now that I can do a binary compare of the copy/paste with your original attachment, it is clear that the issue is "trailing spaces", replacing 200D0A with 0D0A solves the issue.Opera browser, copy -> Paste in notepad, Win XP 32 bit.On my machine it runs in a x10 loop in around 80/100thCross posting on:jaclaz Edited February 3, 2012 by jaclaz Link to comment Share on other sites More sharing options...
Guest Posted February 3, 2012 Share Posted February 3, 2012 My speedtest script introduces some error because it takes time to create the timestamp. It was written to measure time for operations taking hours, not fractions of a second.Cross posting on:That topic seems to have been moved to a place I cannot access, I can't read it.The copy/paste works fine in Firefox, which is the reason I discounted that possibility. Thanks for checking. Link to comment Share on other sites More sharing options...
jaclaz Posted February 3, 2012 Share Posted February 3, 2012 (edited) Yep, it is in a "developers" only test/report section, sorry for not noticing it.However nothing that cannot be re-posted publicly:It seems like text insode CODE tags gets some extra trailing spaces. Of course this ***** up very often batch code inside it.Example:Is it a "new setting" of the board?Can it be fixed?Do we need a "trailing space eliminator" and/or to post a BIG WARNING SIGN?jaclazFollowing are several tests, but not yet a definite solution (also because of the board software change).The copy/paste works fine in Firefox, which is the reason I discounted that possibility. Thanks for checking. This is strange.I will post the following text but without double quotes : "This text has NO trailing spaces" normally, inside a QUOTE, inside a CODE and inside a CODEBOX:This text has NO trailing spacesThis text has NO trailing spacesThis text has NO trailing spacesThis text has NO trailing spacesIn Opera, plain, QUOTE and CODE have NO trailing spaces, but the CODEBOX has it.If I try with two lines:"This text has NO trailing spacesand is on 2 lines"This text has NO trailing spacesand is on 2 linesThis text has NO trailing spacesand is on 2 linesThis text has NO trailing spacesand is on 2 linesThis text has NO trailing spacesand is on 2 linesplain and QUOTE are OK, in CODE first line has an added trailing space, and in CODEBOX last line has a trailng space. With Ie, the results are similar. What happens in Firefox? jaclazI am attaching opera.txt and ie.txt made by copying from "This is strange" (included) up to (excluded) pasted in Notepad.Run a binary comparison of the two and you will see the differences.Can you do the same and upload firefox.txt?opera.txtie.txt Edited February 3, 2012 by jaclaz Link to comment Share on other sites More sharing options...
Guest Posted February 3, 2012 Share Posted February 3, 2012 (edited) I usually use notepad2-mod, but have pasted the text from Firefox v10.0 into Microsoft's Notepad, saved with ANSI encoding, and attached it below for comparison.I hope this helps.I don't know which program is best for making comparisons since I don't do it often. mirkes.de Tiny Hexer shows a great many differences between Opera and IE, and Opera and Firefox. But not quite so many between Firefox and IE. Still quite a difference though.firefox.txt Edited February 3, 2012 by 5eraph Link to comment Share on other sites More sharing options...
jaclaz Posted February 3, 2012 Share Posted February 3, 2012 It seems like firefox only adds a trailng space in CODEBOX on second line.Go figure....jaclaz Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now