LOL, Batch help

Discussion in 'Software' started by Sara, Sep 21, 2004.

  1. Sara

    Sara Private E-2

    Hello people :) Name is Sara and i was a member of some batch forum but now i cant find it :rolleyes: Sooo hope you can help?

    Oh and this is for winXP.

    Ok here is an example of what i want to do...

    Rename Logs.bat Logs2.bat :rolleyes:

    Hrmm well i have 2 batch files. 1 called Logs.bat & Logs2.bat. Now when i try to rename Logs2.bat to the same name as Logs.bat i get this funny Ouput...
    (Logs2.bat.bat) :rolleyes:

    I'm really a n00b :) But i'm learning from google -> Learn Batch. But google dont give me the answer :)

    Thanx
     
  2. GregoryDalton

    GregoryDalton Private E-2

    Hmmm I'm a little confused here...

    i messed around with a batch file to put my limited knowledge of DOS based commands into a quick file to rename a file called logs.bat to logs2.bat:

    ren logs.bat logs2.bat

    Simple. I ran it from the command prompt in XP. if there is already a file there called logs2.bat in the directory it will complain that the file exists and not work properly. TO get around this you can do one of several things.
    Either remove the file logs2.bat, and rename logs.bat to logs2.bat:

    del logs2.bat
    ren logs.bat logs2.bat

    Or... rename logs2.bat to logs3.bat and maintain 3 copies... nermous things that could be done.

    ren logs2.bat logs3.bat
    ren logs.bat logs2.bat

    Batch files are a handy tool for doing this kind of thing but they are a little limited in what they can do... personally I would be tempted to look at something like bash scripting (in windows this can be done through a handy program called cywin) as this offers much more flexibility and functionality. Altenratively Perl is a handy programming language that can do this kind of thing very easily.

    Hope this helps

    Cheers,
    Greg
     
  3. Sara

    Sara Private E-2

    Ahh i'm rubbish with the english :(

    Copy %0 Logs.bat
    Ren Logs.bat Logs2.bat

    Now this dont rename anything! Thats all i end up with is (Logs.bat)

    The file "Logs2.bat" is already there!

    Auuu i must learn english!!!
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds