+ Post New Thread
Results 1 to 11 of 11
Windows Thread, Dos Batch file question in Technical; Hi, In a logon script I am writing, I use the following line: for %%a in (\server\netlogon\shortcuts.zip) do set shorcuts_timestamp=%%~taa ...
  1. #1
    rocknrollstar's Avatar
    Join Date
    Jun 2008
    Location
    Hampshire
    Posts
    435
    Thank Post
    387
    Thanked 28 Times in 24 Posts
    Rep Power
    19

    Dos Batch file question

    Hi,
    In a logon script I am writing, I use the following line:

    for %%a in (\\server\netlogon\shortcuts.zip) do set shorcuts_timestamp=%%~taa

    It works in trying to get the timestamp of the shortcuts.zip folder. However, sometimes it takes a very long time e.g. 20seconds, when it is only checking the timestamp of 1 file. Any ideas if I am doing something wrong? Is it checking the whole netlogon folder or something?

    Thanks!

  2. #2

    Join Date
    Oct 2006
    Location
    uk
    Posts
    494
    Thank Post
    19
    Thanked 3 Times in 2 Posts
    Rep Power
    16
    Try a different file is it the .zip it's having issues with?

  3. Thanks to Uraken from:

    rocknrollstar (27th June 2011)

  4. #3
    rocknrollstar's Avatar
    Join Date
    Jun 2008
    Location
    Hampshire
    Posts
    435
    Thank Post
    387
    Thanked 28 Times in 24 Posts
    Rep Power
    19
    Quote Originally Posted by Uraken View Post
    Try a different file is it the .zip it's having issues with?
    Will give that a try in the morning. Thanks.

  5. #4
    rocknrollstar's Avatar
    Join Date
    Jun 2008
    Location
    Hampshire
    Posts
    435
    Thank Post
    387
    Thanked 28 Times in 24 Posts
    Rep Power
    19
    Doesn't seem to make a difference I'm afraid, renamed it to .zip or even .txt and still can take time.

    Interestingly, sometimes it is instant, sometimes it takes 20secs. This happened even when it was a .zip file.

    Any ideas?

  6. #5

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,656
    Thank Post
    324
    Thanked 506 Times in 474 Posts
    Rep Power
    177
    What exactly are you trying to do? Read the files "in" the zip file? or just get the date/time of the zip file?

    Steve

  7. Thanks to Steve21 from:

    rocknrollstar (29th June 2011)

  8. #6
    rocknrollstar's Avatar
    Join Date
    Jun 2008
    Location
    Hampshire
    Posts
    435
    Thank Post
    387
    Thanked 28 Times in 24 Posts
    Rep Power
    19
    Just get the time stamp of the zip file, and stick it into a dos variable!

  9. #7

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,656
    Thank Post
    324
    Thanked 506 Times in 474 Posts
    Rep Power
    177
    Quote Originally Posted by rocknrollstar View Post
    Just get the time stamp of the zip file, and stick it into a dos variable!
    Shouldn't it be a single "a" then?

    Code:
    for %%a in (myfile.zip) do set timestamp=%%~ta
    Steve

  10. Thanks to Steve21 from:

    rocknrollstar (29th June 2011)

  11. #8
    rocknrollstar's Avatar
    Join Date
    Jun 2008
    Location
    Hampshire
    Posts
    435
    Thank Post
    387
    Thanked 28 Times in 24 Posts
    Rep Power
    19
    Thanks, but a single 'a' doesn't make a difference unfortunately.

  12. #9
    rocknrollstar's Avatar
    Join Date
    Jun 2008
    Location
    Hampshire
    Posts
    435
    Thank Post
    387
    Thanked 28 Times in 24 Posts
    Rep Power
    19
    Does anyone know of a different way to check if 2 files are the same in dos?

  13. #10


    Join Date
    Feb 2007
    Location
    51.405546, -0.510212
    Posts
    8,120
    Thank Post
    203
    Thanked 2,385 Times in 1,765 Posts
    Rep Power
    703
    Are you checking the date and/or time because you only want to copy/extract the zip file when it has been updated?

    Quote Originally Posted by rocknrollstar View Post
    Does anyone know of a different way to check if 2 files are the same?
    http://www.dostips.com/DtCodeCmdLib....ction.CmpFTime?

  14. Thanks to Arthur from:

    rocknrollstar (29th June 2011)

  15. #11
    rocknrollstar's Avatar
    Join Date
    Jun 2008
    Location
    Hampshire
    Posts
    435
    Thank Post
    387
    Thanked 28 Times in 24 Posts
    Rep Power
    19
    Quote Originally Posted by Arthur View Post
    Are you checking the date and/or time because you only want to copy/extract the zip file when it has been updated?


    DOS Batch - Functions?
    Pretty much. Thanks for the link- very interesting and helpful.

SHARE:
+ Post New Thread

Similar Threads

  1. Help with beginner script/batch file to rename Program File?
    By El_Nombre in forum How do you do....it?
    Replies: 3
    Last Post: 23rd June 2011, 02:05 PM
  2. Quick Batch File Question
    By karldenton in forum Windows
    Replies: 10
    Last Post: 5th November 2009, 12:34 PM
  3. Batch File (select random file) help
    By fil_b in forum Windows Server 2000/2003
    Replies: 5
    Last Post: 5th November 2009, 04:13 AM
  4. dos batch file to whs script
    By davidm in forum Windows
    Replies: 3
    Last Post: 26th March 2009, 09:37 PM
  5. Ms-Dos file conversion in word
    By eric.777 in forum Windows
    Replies: 0
    Last Post: 1st December 2008, 01:52 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •