Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
Mohammad_Dos
- Posts: 84
- Joined: 08 Sep 2010 10:25
- Location: Iran,Kashan
-
Contact:
#1
Post
by Mohammad_Dos » 09 Feb 2012 05:03
i want to add several characters (+++) to name of all files in a folder. i use this:
but names change like these:
new file.txt ------> +++ file.txt
extra.wmv ------> +++ra.wmv
can somebody help me?
-
Mohammad_Dos
- Posts: 84
- Joined: 08 Sep 2010 10:25
- Location: Iran,Kashan
-
Contact:
#3
Post
by Mohammad_Dos » 09 Feb 2012 08:54
thank u
but! is there a way to do this work for all files in the folder with any format?
Last edited by
Mohammad_Dos on 09 Feb 2012 12:33, edited 2 times in total.
-
Squashman
- Expert
- Posts: 4484
- Joined: 23 Dec 2011 13:59
#4
Post
by Squashman » 09 Feb 2012 12:22
Mohammad_Dos wrote:thank u
but! is there a way to do this work for all files in the folder with any format?
Use the wildcard character as the only character inside the parentheses.
-
Ocalabob
- Posts: 79
- Joined: 24 Dec 2010 12:16
- Location: Micanopy Florida
#5
Post
by Ocalabob » 09 Feb 2012 14:58
Greetings Mohammad_Dos,
In addition to Squashman's reply have a look here:
viewtopic.php?f=3&t=1525&p=5852#p5852A simple modification may work for you. For example:
Code: Select all
@echo off
setlocal
attrib %0 +h
for /f "delims=" %%f in (
'dir /b *.*') do (
set name=%%~nxf
echo ren "%%~nxf" "+++%%~nxf"
)>>test_file.bat
attrib %0 -h
Best wishes.