Computing.Net > Forums > Disk Operating System > rename batch file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

rename batch file

Reply to Message Icon

Name: OddMatt
Date: November 6, 2002 at 07:21:57 Pacific
OS: win2k
CPU/Ram: p4 256mb
Comment:

hi ,im fairly new to scipting anything in DOS so this maybe fairly simple, or not (tbh im not entirely sure). As this is my first application i have written id really really like it to work, so il really appreciate some help..
I have created two batch files - one renames file x to x1, the other renames it back to x......
what i really need is one file to do both ie. check the filename, so if x=0 then it will rename x by running batch file 1 etc etc
hope someone can help me on my path to greater scripting :) cheers




Sponsored Link
Ads by Google

Response Number 1
Name: chris db
Date: November 6, 2002 at 08:13:51 Pacific
Reply:

here you are oddmatt:

@echo off
if exist x goto bob
rename x1 x
goto end
:bob
rename x x1
:end

The '@echo off' line is just (as you may know) to stop the batch commands appearing as the program runs.
'bob' and 'end' are just labels and can
be anything as long as they match up.


0

Response Number 2
Name: OddMatt
Date: November 6, 2002 at 08:18:19 Pacific
Reply:

Cheers dude,
will try it now :)


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: rename batch file

Rename in a Batch file www.computing.net/answers/dos/rename-in-a-batch-file/12873.html

batch file to rename files by date. www.computing.net/answers/dos/batch-file-to-rename-files-by-date/5517.html

Renaming Files in DOS Batch file www.computing.net/answers/dos/renaming-files-in-dos-batch-file/8950.html