+ Post New Thread
Results 1 to 6 of 6
Windows Server 2000/2003 Thread, Batch File (select random file) help in Technical; hi there we are playing with batch file where we copy a file to a location and then rename it ...
  1. #1

    Join Date
    Jul 2009
    Location
    Wolverhampton
    Posts
    116
    Thank Post
    6
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Batch File (select random file) help

    hi there

    we are playing with batch file where we copy a file to a location and then rename it

    @echo off
    rem to remove screen output updates ... less clutter
    if exist "Z:\Profiles\Teaching\desktop.jpg" del "Z:\Profiles\Teaching\desktop.jpg" /S/Q


    xcopy "Z:\Profiles\Backgrounds\SELECT - RANDOM.jpg" "Z:\Profiles\Teaching\" /E/I



    REN Z:\Profiles\Teaching\*.jpg desktop.jpg


    we can set a file manually, is it possible to make it a random selection for the JPG plz

    Tar


    feebs

  2. #2


    Join Date
    Feb 2007
    Location
    Northamptonshire
    Posts
    4,706
    Thank Post
    354
    Thanked 807 Times in 722 Posts
    Rep Power
    348
    I'd name the files by number and then use a random number generator + .jpg

    Something like

    Random number batch file - Programming - Forums - www.atomicmpc.com.au

    I suppose you could in theory read the directory contents into an array and do it that way but this would work fine, how often are you doing it?

  3. #3

    Join Date
    Jul 2009
    Location
    Wolverhampton
    Posts
    116
    Thank Post
    6
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Quote Originally Posted by kmount View Post
    I'd name the files by number and then use a random number generator + .jpg

    Something like

    Random number batch file - Programming - Forums - www.atomicmpc.com.au

    I suppose you could in theory read the directory contents into an array and do it that way but this would work fine, how often are you doing it?
    we were going to do a schedule to run nightly so every day is different.

  4. #4

    Join Date
    Nov 2007
    Location
    Rotherham
    Posts
    1,679
    Thank Post
    122
    Thanked 126 Times in 102 Posts
    Rep Power
    46
    Could you numerically name the files and then just incrament the number
    e.g.
    Monday = 1
    Tuesdy = 2
    and so on?

  5. #5

    Join Date
    Jul 2009
    Location
    Wolverhampton
    Posts
    116
    Thank Post
    6
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Quote Originally Posted by Stuart_C View Post
    Could you numerically name the files and then just incrament the number
    e.g.
    Monday = 1
    Tuesdy = 2
    and so on?
    if we had 20 or more tho it would break it up

    numbers for the files is good but how do i do the random select a file for the code??

  6. #6

    Join Date
    Nov 2009
    Posts
    54
    Thank Post
    3
    Thanked 12 Times in 12 Posts
    Rep Power
    13
    echo %random%



SHARE:
+ Post New Thread

Similar Threads

  1. batch file for temporary profiles
    By gshaikh in forum Windows
    Replies: 4
    Last Post: 7th October 2008, 10:16 AM
  2. batch file comman
    By jussy65 in forum Scripts
    Replies: 3
    Last Post: 13th August 2008, 08:10 AM
  3. Pass £ in batch file
    By meastaugh1 in forum Windows
    Replies: 2
    Last Post: 17th January 2008, 09:02 PM
  4. executing a random command in a batch file
    By Halfmad in forum Scripts
    Replies: 12
    Last Post: 6th November 2007, 10:25 PM
  5. batch file help
    By beeswax in forum Scripts
    Replies: 9
    Last Post: 3rd March 2006, 08:48 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
  •