Windows 7 Forums


Reply
Thread Tools

[SOLVED] Script (Batch File) Writing...

 
 
Elmer BeFuddled Elmer BeFuddled is offline
Resident eejit
Elmer BeFuddled's Avatar
Join Date: Jun 2010
Location: Durham UK
Posts: 1,050
Thanked: 203
Send a message via Skype™ to Elmer BeFuddled
 
      06-26-2010
Well How?

I'm not afraid to dig deep and change system files (Hell, I re-designed my XP totally), but I'm trying to write an "automated" way of renaming files.

All i want to do is prefix a file with a tilde (~).
This is for Photoshop, a tilde (~) stops Photoshop searching/displaying the file.

Every site I've tried shows me how to add/remove dates/numbers etc. etc. but nothing related to what I want to do, or even actually explaining what a "/" or "@" or "echo" or "U taken t'dog fe 'is walk?" does.
Well, actually the last one's self explanatory, S.W.M.B.O has just spoken!!

As an example I want to re-name Dicom.8bi to ~Dicom.8bi., wherever it may be, I'll add the "Addresses", which would be fixed, not a wild card search.
That would be one of many, in different folders, 64-bit and 32-bit etc. etc. But I'm fed up of going through and manually renaming them all. When I say manually, what I mean is:- Open folder, Highlight files to be renamed, use drag'n'drop onto a Better File Rename.dpt I've made to add tilde (~) to the start.
I need some pointers, my(??) script (below) was (AHEM!!) borrowed and amended from others. It runs OK (Now? HOW?) but does nothing??? As in, the commands work, BUT, I don't know why.

I think that's my biggest niggle, if you don't know why/how/what for, how can you ever understand / advance ????

I can add/edit the full addresses as need be, it's basically the "correct re-name" function/syntax(?) I'm looking for.

THIS WORKS!!
Quote:
@echo off
cls
set windrive=%1
echo The Adobe installed Plug-ins and Presets listed in the "Read Me" file will
echo will be pre-fixed with a tilde (~) which will disable/hide them.
echo.
echo Do you wish to continue?
set /p choice=Please press "Y" for yes or "N" for no:
if %choice%==y goto moveon
if %choice%==n goto dontmove

:moveon
THIS DOESN'T WORK/DOES NOTHING
Quote:
ren "C:\PROGRAM FILES (X86)\ADOBE\ADOBE BRIDGE CS5\Plug-Ins\Cineon.8BI" "C:\PROGRAM FILES (X86)\ADOBE\ADOBE BRIDGE CS5\Plug-Ins\~Cineon.8BI"
ren "C:\PROGRAM FILES (X86)\ADOBE\ADOBE BRIDGE CS5\Plug-Ins\Dicom.8BI" "C:\PROGRAM FILES (X86)\ADOBE\ADOBE BRIDGE CS5\Plug-Ins\~Dicom.8BI"ADOBE\ADOBE BRIDGE CS5\Presets\Color Books\TRUMATCH.acb" "C:\PROGRAM FILES (X86)\ADOBE\ADOBE BRIDGE CS5\Presets\Color Books\~TRUMATCH.acb"
ren "C:\PROGRAM FILES (X86)\ADOBE\ADOBE BRIDGE CS5\Presets\Color Books\VisiBone2.acb" "C:\PROGRAM FILES (X86)\ADOBE\ADOBE BRIDGE CS5\Presets\Color Books\~VisiBone2.acb"
THIS WORKS !! (leads on from Pt. 1)
Quote:
echo .
echo .
echo Whoopy Doo!!! Won't be seeing those again unless you want to! :-)
echo .
pause
exit /B n


:dontmove
echo .
echo The Batch File execution has been cancelled.
pause
Oh, And if you know of a good "Batch writing Tut" site, FFS!, don't be shy, let me know.
And I'll accept any offers to help me write the scripts I want.
As for my past offerings for assistance saying I'll have your children if you help, that offer is withdrawn. Somebody, (And you know who you are!! No names etc.. etc..) dived in just a tad too fast!!!

Last edited by Elmer BeFuddled; 06-26-2010 at 03:54 PM..
 
Reply With Quote
 
 
 
 
Fire cat Fire cat is offline
Established Member
Join Date: Mar 2010
Posts: 1,156
Thanked: 164
 
      06-26-2010
Hi Elmer!
Get rid of the quotes around the files. I tested the code, and this is the results:
This doesn't work:
Quote:
ren "file.txt" "file.~txt"
On the other hand, this does work:
Quote:
ren file.txt file.~txt
So the quotes are the problems. Get rid of them and you should be OK.

Cheers,
Fire Cat
 
Reply With Quote
 
clifford_cooley clifford_cooley is online now
(c_c)
clifford_cooley's Avatar
Join Date: Mar 2009
Location: Arkansas, USA
Posts: 4,509
Thanked: 931
 
      06-26-2010
Quote:
Originally Posted by Fire cat View Post
Get rid of the quotes around the files.
This is not good advice. The quots are necessary for long filename support, especially when a space is included in the name.

Elmer have you considered using any batch renaming tools. If my file manager (Total Commander) didn't have this feature built in, I might would try using Irfanview. If these programs still do not suit you, I can help with your batch script.
 
Reply With Quote
 
TrainableMan TrainableMan is offline
^ The World's First ^
TrainableMan's Avatar
Join Date: May 2010
Location: PA, USA
Posts: 4,656
Thanked: 887
 
      06-27-2010
Does it really have to be done in a batch file? I use a freeware product WildRename which I find easy to use and allows me to rename entire folders of my digital photos.
http://www.cylog.org/utilities/wildr...?version=v2.15
 
Reply With Quote
 
Elmer BeFuddled Elmer BeFuddled is offline
Resident eejit
Elmer BeFuddled's Avatar
Join Date: Jun 2010
Location: Durham UK
Posts: 1,050
Thanked: 203
Send a message via Skype™ to Elmer BeFuddled
 
      06-27-2010
Quote:
Quote:
Originally Posted by Fire cat View Post
Hi Elmer!
Get rid of the quotes around the files.
So the quotes are the problems. Get rid of them and you should be OK.
Quote:
Originally Posted by clifford_cooley View Post
This is not good advice. The quotes are necessary for long filename support.
What I have at the moment for example is:-

ren MMXCore.8BX ~MMXCore.8BX
ren "MultiProcessor Support.8bx" "~MultiProcessor Support.8bx"


That is in an individual batch file placed inside the folder that contains the files it needs to re-name, hence I don't need to have the "address" in the re-name line. I don't have all the fancy stuff either, just wanted to see if I could get that to work!!
So I have several of these batch files now dotted in various folders throughout the Adobe System.
I was hoping to accumulate them into one batch file that would deal with them all in only one double-click.

Quote:
Originally Posted by clifford_cooley View Post
Elmer have you considered using any batch renaming tools. If my file manager (Total Commander) didn't have this feature built in, I might would try using Irfanview. If these programs still do not suit you, I can help with your batch script.
Quote:
Originally Posted by TrainableMan View Post
Does it really have to be done in a batch file? I use a freeware product WildRename which I find easy to use and allows me to rename entire folders of my digital photos.
http://www.cylog.org/utilities/wildr...?version=v2.15
I'll look into those progs. Anything I have looked at so far has only let me attend to one folder at a time and, to be honest, it would be quicker to go to that folder and re-name the files individually. It would be handy if I could just give it a list of files with their locations and tell it to go deal.

By having a (parent/main) batch file:-
a) I don't have to open a list of the files I want to re-name then open the various folders, drag'n'drop the files onto my Better File Rename droplet OR double-click individual batch files etc. etc..
b) Although this may only be needed (usually) 2 or 3 times a year, any piece of automation after a system re-install has to be seized with both hands.
c) The most important point, I'm (nearly!!) learning something, gotta keep the ole grey matter on the go at my age, don't ya know!!

Last edited by Elmer BeFuddled; 06-27-2010 at 04:46 AM..
 
Reply With Quote
 
TrainableMan TrainableMan is offline
^ The World's First ^
TrainableMan's Avatar
Join Date: May 2010
Location: PA, USA
Posts: 4,656
Thanked: 887
 
      06-27-2010
WildRename allows you to recurse subdirectories (repeat the processing on every folder under the current folder) so even if you wanted it to rename those two files in every folder on your HD it would be simple to set it to C:\ and check "Recurse into subdirectories".
 
Reply With Quote
 
clifford_cooley clifford_cooley is online now
(c_c)
clifford_cooley's Avatar
Join Date: Mar 2009
Location: Arkansas, USA
Posts: 4,509
Thanked: 931
 
      06-27-2010
Elmer, I have one question before I can help further.

Do the files have anything in common such as the file name or file extension?
 
Reply With Quote
 
eddiedd eddiedd is offline
New Member
Join Date: Jun 2010
Location: Aberkenfig Bridgend
Posts: 4
Thanked: 1
eddiedd's Twitter Pag
 
      06-27-2010
Quote:
Originally Posted by Elmer BeFuddled View Post
Well How?

I'm not afraid to dig deep and change system files (Hell, I re-designed my XP totally), but I'm trying to write an "automated" way of renaming files.

All i want to do is prefix a file with a tilde (~).
This is for Photoshop, a tilde (~) stops Photoshop searching/displaying the file.

Every site I've tried shows me how to add/remove dates/numbers etc. etc. but nothing related to what I want to do, or even actually explaining what a "/" or "@" or "echo" or "U taken t'dog fe 'is walk?" does.
Well, actually the last one's self explanatory, S.W.M.B.O has just spoken!!

As an example I want to re-name Dicom.8bi to ~Dicom.8bi., wherever it may be, I'll add the "Addresses", which would be fixed, not a wild card search.
That would be one of many, in different folders, 64-bit and 32-bit etc. etc. But I'm fed up of going through and manually renaming them all. When I say manually, what I mean is:- Open folder, Highlight files to be renamed, use drag'n'drop onto a Better File Rename.dpt I've made to add tilde (~) to the start.
I need some pointers, my(??) script (below) was (AHEM!!) borrowed and amended from others. It runs OK (Now? HOW?) but does nothing??? As in, the commands work, BUT, I don't know why.

I think that's my biggest niggle, if you don't know why/how/what for, how can you ever understand / advance ????

I can add/edit the full addresses as need be, it's basically the "correct re-name" function/syntax(?) I'm looking for.

THIS WORKS!!THIS DOESN'T WORK/DOES NOTHING THIS WORKS !! (leads on from Pt. 1)Oh, And if you know of a good "Batch writing Tut" site, FFS!, don't be shy, let me know.
And I'll accept any offers to help me write the scripts I want.
As for my past offerings for assistance saying I'll have your children if you help, that offer is withdrawn. Somebody, (And you know who you are!! No names etc.. etc..) dived in just a tad too fast!!!
try a carat
eg
ren c:\cookies.txt ^~cookies.tx
a ^ carat tell batch files to ignore the next character as an instruction,
its just a character
 
Reply With Quote
 
Elmer BeFuddled Elmer BeFuddled is offline
Resident eejit
Elmer BeFuddled's Avatar
Join Date: Jun 2010
Location: Durham UK
Posts: 1,050
Thanked: 203
Send a message via Skype™ to Elmer BeFuddled
 
      06-27-2010
Quote:
Originally Posted by TrainableMan View Post
WildRename allows you to recurse subdirectories (repeat the processing on every folder under the current folder) so even if you wanted it to rename those two files in every folder on your HD it would be simple to set it to C:\ and check "Recurse into subdirectories".
Thanks for this pointer TM. Although I'm struggling to get it to do what I want to do here (beginners ignorance), I've already made use of it elsewhere. So it's now been added to my "Stand-Alones To Keep" folder!!

Quote:
Originally Posted by clifford_cooley View Post
Elmer, I have one question before I can help further.

Do the files have anything in common such as the file name or file extension?
There are some duplicates in different locations, mainly because I still run my old PS CS3 but they are not all say ".abc" file extensions. I'm attaching a list with the address of each individual "rename" batch file.

Give me a while and I'll add the list, the dog's decided it's time to go to the Offy, ready for later!!

Last edited by Elmer BeFuddled; 06-27-2010 at 02:43 PM..
 
Reply With Quote
 
Elmer BeFuddled Elmer BeFuddled is offline
Resident eejit
Elmer BeFuddled's Avatar
Join Date: Jun 2010
Location: Durham UK
Posts: 1,050
Thanked: 203
Send a message via Skype™ to Elmer BeFuddled
 
      06-27-2010
Quote:
Originally Posted by clifford_cooley View Post
Elmer, I have one question before I can help further.

Do the files have anything in common such as the file name or file extension?
Clifford, I've attached the "full" list of the files I want to rename. Some of these I'll have to remove from the list as and when, but I think I'll do better to start full and walk backwards as reqd.
I've split them into the four main groups or parent program folder with ===========.

BTW. The dog didn't really want to go for a walk to the Offy, but I thought, what the heck, "Two birds. One stone"

Quote:
Originally Posted by eddiedd View Post
try a carat
eg
ren c:\cookies.txt ^~cookies.tx
a ^ carat tell batch files to ignore the next character as an instruction,
its just a character
I had to read that 3 or 4 times before it sank in. Missing 't' on end of second 'txt' threw me a wobbly!!
But about the carat is something else I've learnt!! Never thought that a tilde was actually a "command", even though I've lost count of the times I've read "Docu~1" or something like that.
Attached Files
File Type: txt .txt (9.2 KB, 412 views)

Last edited by Elmer BeFuddled; 06-27-2010 at 01:18 PM..
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows 7 CMD Help & Tips Fire cat Customization 16 04-18-2012 05:17 PM
Windows 7 Tip of the Week: Smarter File Copying Nibiru2012 General Discussion 9 10-14-2011 06:29 PM
Stand-Alone Software Every 7 System Should Have Available Elmer BeFuddled General Discussion 6 05-15-2011 06:52 AM
Running a batch file on shutdown win7 64 bit masplin General Discussion 0 03-21-2010 01:03 PM
Windows 7 install keeps rebooting Stephen47 Installation, Setup and Updates 32 05-24-2009 06:26 PM


All times are GMT +1. The time now is 07:05 AM.
W7Forums is an independent website and is not affiliated with Microsoft Corporation.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33