Re: How to STOP file - a command line & script - where do you put it to work?

From: David Candy (.)
Date: 12/11/04


Date: Sat, 11 Dec 2004 12:29:52 +1100

Type cmd in Start Run
You type it there

To specify directories

FOR %A IN ("C:\documents and settings\my documents\my pictures\*.jpg") do ren "%~A" "Old %~nxA"

Or you can use the original and after starting cmd type

cd C:\documents and settings\my documents\my pictures
FOR %A IN (*.jpg) do ren "%A" "Old %~nxA"

Note there are small syntax changes between the two to cope with files and paths with spaces.

-- 
----------------------------------------------------------
http://www.uscricket.com
"~ FreeSpirit ~" <spammenot@nospam.net> wrote in message news:OgNvi2x3EHA.3120@TK2MSFTNGP12.phx.gbl...
> 
> "David Candy" <.> wrote in message 
> news:Otgtcax3EHA.3224@TK2MSFTNGP10.phx.gbl...
> That batch is for a very specific problem. It can be as simple as
> 
> ren oldfilename newfilename
> 
> ## Where is that typed?  Is there a program that I need?
> 
> Or as you seem to be adding words to the beginning of a name.
> FOR %A IN (*.jpg) do ren "%A" "Old %~nxA"
> All jpgs will have old prepended to their name.
> 
> ## Where does that go to change the names of the files?  Where do I type 
> that in and tell it which folders to change the names in?
> 
> That website didn't explain where this is typed in or how to tell it what 
> folders etc.
> 
> FS~
> 
> 
> -- 
> ----------------------------------------------------------
> http://www.uscricket.com
> "~ FreeSpirit ~" <spammenot@nospam.net> wrote in message 
> news:u01ZLUx3EHA.1292@TK2MSFTNGP10.phx.gbl...
>>
>> "Malke" <malke@nospoonnotreally.com> wrote in message
>> news:O2E6tyu3EHA.1188@tk2msftngp13.phx.gbl...
>>
>>> I gave you an answer to one of your other posts (and please keep posts
>>> about one subject in one thread;
>>
>> ## Sorry.  The other thread is about WMP and how to stop it from phoning
>> home/being seen as SPYWARE.  I still can't find those buttons the face it
>> shows when it comes up.   But THAT'S another problem.
>>
>> it makes it difficult to help you
>>> otherwise). However, in addition to what I suggested there, you could
>>> also do some Googling about the command line and creating scripts.
>>
>> ##  I have no clue what a command line or a script is, what they do or how
>> to write them??!?!?!!  I'm a PC user, not a software, java or script 
>> writer.
>> :-)
>>
>> For
>>> instance, I found this link that might be quite helpful:
>>
>>> http://www.computing.net/dos/wwwboard/forum/13970.html
>>> It's about renaming files using a batch script.
>>
>> From the above site:  I have never seen anything like this nor do I know 
>> how
>> to rewrite it allowing me to change names individually in a folder.
>>
>> This is the script that was given:  (Example)
>> @echo off
>> if "%1"=="GoTo" goto %2
>> if not "%OS%"=="Windows_NT" goto eof
>> %comspec% /v:on /c %0 GoTo start
>> goto eof
>>
>> :start
>> echo.
>> echo This program will rename all files from the current directory,
>> echo and possibly from its subdirectories, following a certain rule.
>> echo.
>> echo Press any key to VIEW the renaming process . . .
>> pause > nul
>> echo Processing . . .
>>
>> type nul> %temp%.\process.bat
>> :: To include the files under subdirectories from current
>> :: directory on the renaming process, add the string ' /R'
>> :: after the string 'for' on the next line, so it becomes
>> :: 'for /R' (don't forget the space between the strings)
>> for %%F in (*.*) do (
>> set ORIG=%%~nF
>> set ORIG=!ORIG:-=!
>> set FILE=!ORIG:~3,-4!
>> set EXT=!ORIG:~-4,-1!
>> if not "!FILE!"=="" if not "!EXT!"=="" (
>> echo REN "%%F" "!FILE!.!EXT!">> %temp%.\process.bat
>> )
>> )
>>
>> ##  And the average PC user is supposed to understand that, where to put 
>> it,
>> how to get it to work, how to rewrite it to suit their needs, etc?   It
>> looks like Chinese to me.  :-(
>> Besides I'm not just changing or removing one word or number in the file
>> name. I'm adding different years to different files, shortening the 
>> Artists
>> names etc.  They can't be batchfiled even if I understood the code above.
>>
>> But I thank you for the suggestions.
>>
>> FS~
>>
>>> Malke
>>> -- 
>>> MS MVP - Windows Shell/User
>>> Elephant Boy Computers
>>> www.elephantboycomputers.com
>>> "Don't Panic!"
>> 
>