Computing.Net > Forums > Programming > Simple batch script. Need Help.

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.

Simple batch script. Need Help.

Reply to Message Icon

Name: SeekingWisdom
Date: June 26, 2008 at 14:19:54 Pacific
OS: WindowsXPSP3
CPU/Ram: 2GB
Product: Dell
Comment:

Hello.
I'm a complete newb to scripting and would like some help. What I'm trying to accomplish is just simply prefixing information to a file name.
Example:
File1 to old_File1
File2 to old_File2
etc...

I tried.

@echo off
RENAME "c:\PATH\To\Files\*.txt" "Old_*.txt"

It doesn't work.. it renamed two files, removed some characters in the. It didn't work at all how expected and it also failed how I did not expect it to either.

Please help!

Thank you!



Sponsored Link
Ads by Google

Response Number 1
Name: devil_himself
Date: June 26, 2008 at 19:39:24 Pacific
Reply:

@echo off
setlocal
set src=c:\test
pushd "%src%"
for /f "tokens=*" %%a in ('dir /b /s /a-d *.txt') do (ren "%%a" "old_%%~na%%~xa")


0

Response Number 2
Name: SeekingWisdom
Date: June 27, 2008 at 07:04:01 Pacific
Reply:

Thanks. I appreciate it.


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 Programming Forum Home


Sponsored links

Ads by Google


Results for: Simple batch script. Need Help.

Simple Batch Script help www.computing.net/answers/programming/simple-batch-script-help/12744.html

Help with simple batch scripting www.computing.net/answers/programming/help-with-simple-batch-scripting/15226.html

Simple Batch Script www.computing.net/answers/programming/simple-batch-script/16428.html