Computing.Net > Forums > Disk Operating System > rename files on dos

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

rename files on dos

Reply to Message Icon

Name: emiliano chionaky
Date: June 24, 2003 at 06:59:06 Pacific
OS: dos
CPU/Ram: p4m
Comment:

Hi all!
I've a trouble renaming some files in DOS with a batch command. I have some files with generic .txt name and I must rename in MO.txt but files already named MO* must not change name to MOMO*
I crate this script:
FOR %%f IN (*.txt) DO REN %%f MO%%f
but it renames everything...
what can I do?




Sponsored Link
Ads by Google

Response Number 1
Name: IVO
Date: June 25, 2003 at 01:42:06 Pacific
Reply:

I suppose the current directory is the one storing the text files when your For statements executes. So the following sequence should fit your need

Ren MO*.txt MO*.tx$
For %%f in (*.txt) Do Ren %%f MO%%f
Ren MO*.tx$ MO*.txt

I hope this helps.


0

Response Number 2
Name: emiliano chionaky
Date: June 25, 2003 at 04:46:42 Pacific
Reply:

Thank you very much! your suggestion has been very helpful!!!
thanks again for you help


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Unwanted character after ... Set variable to contents ...



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 files on dos

Copy Files on DOS? www.computing.net/answers/dos/copy-files-on-dos/12246.html

Rename files in DOS - How? www.computing.net/answers/dos/rename-files-in-dos-how/8486.html

Renaming files in DOS www.computing.net/answers/dos/renaming-files-in-dos/12862.html