We help IT Professionals succeed at work.

Batch File changes

RadioGeorge
RadioGeorge used Ask the Experts™
on
I have a VERY small batch file which was created a couple of years ago by an expert here on EE.  Now I need two very small and simple changes made to it (I am not a programmer, obviously). I just tried posting it to Fiverr, where I have an account, but their list-a-job is miserably lacking for such a thing.

SO...would any expert care to handle this for me? I have a strong feeling that this is a 5-minute or less task for anyone who knows .bat files.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2018
Distinguished Expert 2018

Commented:
Took me less than 5 minutes:
@echo Hello World

Open in new window

Now, seriously, without the batch file, and without you describing the changes you want, it's a wee bit hard to do ...
Top Expert 2014

Commented:
You haven't given us much to go on
RadioGeorgeOwner/Programmer

Author

Commented:
OK,OK, I get it, guys!

Remember, if I still retained ANY of the programming skills I had as a self-taught BASIC user, I MIGHT be able to handle this myself.

But that IS a BIG maybe!

I was able to search out how to display the file, and here it is:

@echo off
setlocal EnableDelayedExpansion
echo Please enter the number of the break and the
echo order in the break for the following spots:
for /f "tokens=*" %%f in ('dir /b *.mp3') do (
  echo -- Break and play order for %%f
  set /p a="Which break? "
  set /p b="Play order? "
  ren "%%f" !a!.!b!-Spot!b!.mp3
)

Thank you for your responses, looking forward to seeing the tweaks.
nociSoftware Engineer
Distinguished Expert 2018

Commented:
And waht is the change you need?
RadioGeorgeOwner/Programmer

Author

Commented:
Looks like this little problem wants to get the best of me. Somehow, the specifics which I included in my original note never made it here.

The program displays grey lettering on a black background. I want it to display white lettering, so it's easier to read.

The expression -Spot needs to be changed to _Spot -- that is, changing the hyphen to a single underscore as seen in this line.

Thanks for your patience. This has been a weird day!
Bill PrewTest your restores, not your backups...
Top Expert 2016

Commented:
There is nothing in the BAT script you posted that would affect the color of text displayed, that must be comping from someplace else. Perhaps the PROMPT environment variable, or the default screen colors in the DOS window.

You can open the file in Notepad and change the dash to an underscore there and save it.

~bp
Try adding:

color 0F

to the top of the file (after @echo off).  That should turn the display color for the window to be white on a black background.

Note that's the digit zero followed by F, not the letter O.

Doug
Top Expert 2016

Commented:
the colors also can be changed by clicking onto the icon in the title line of the dos box, choose properties - colors.

Sara
Bill PrewTest your restores, not your backups...
Top Expert 2016

Commented:
So, your updated script could look like:

@echo off
setlocal EnableDelayedExpansion

rem Reset color to white on black
color 0F

echo Please enter the number of the break and the
echo order in the break for the following spots:

for /f "tokens=*" %%f in ('dir /b *.mp3') do (
  echo -- Break and play order for %%f
  set /p a="Which break? "
  set /p b="Play order? "
  ren "%%f" !a!.!b!_Spot!b!.mp3
)

Open in new window


»bp
RadioGeorgeOwner/Programmer

Author

Commented:
I saved the updated script as a .bat file, loaded it into my computer and cranked it up, just like I always start the other one.

It ran...BUT....

(1) it still displayed as grey letters on a black background exactly the same as what I have been using.
(2) the hyphen was not changed to an underscore.

I should point out that the bat file that started this whole discussion displays grey letters on a black background when I run it on my desk computer which uses Windows 7 but DOES display nice bright white letters on my laptop Windows 10.  But I do not want to change operating systems until I absolutely have to. Been there, done that, and unless there are major multiple problems, my experience says that if it ain't broke, don't fix it is a realistic and workable attitude.
 



Any further comments?
Bill PrewTest your restores, not your backups...
Top Expert 2016

Commented:
(1) it still displayed as grey letters on a black background exactly the same as what I have been using.
(2) the hyphen was not changed to an underscore.
That sounds like you were still running the old script.  You could try the script modification below which will display a message and pause to make certain you ran the new changes.

@echo off
setlocal EnableDelayedExpansion

ECHO ***** THIS IS THE NEW SCRIPT *****
PAUSE

rem Reset color to white on black
color 0F

echo Please enter the number of the break and the
echo order in the break for the following spots:

for /f "tokens=*" %%f in ('dir /b *.mp3') do (
  echo -- Break and play order for %%f
  set /p a="Which break? "
  set /p b="Play order? "
  ren "%%f" !a!.!b!_Spot!b!.mp3
)

Open in new window


»bp
RadioGeorgeOwner/Programmer

Author

Commented:
First, my apologies for not following up on this question. I got hit with an unexpected digestive ailment that left me very tired for the past few weeks. Over it now and playing catch-up.

Still having problems with the latest revision here. I copied, pasted, saved, and ran the script Bill Prew posted on 11/23. A new screen opened and it appeared to be working OK. But when I pressed the key to continue, the program simply shut down, windows and all.

Comments?
Top Expert 2016

Commented:
it appeared to be working OK. But when I pressed the key to continue, the program simply shut down, windows and all.

can you post here all output and input you got/did before the command window closed.

also show output you got when typing

dir /b *.mp3

Open in new window


before you invoke the batch file.

Sara
Bill PrewTest your restores, not your backups...
Top Expert 2016

Commented:
But when I pressed the key to continue, the program simply shut down, windows and all.
Was this in response to the first PAUSE statement, or further down the script where it prompts for input?  

ALso, if there are no MP3 files in the current directory the BAT script is running in, then that whole FOR loop will be skipped and no prompting will occur.

Did it rename the file, keep in mind the way this script is written, once you reply to those prompts it will quickly do the rename and then exit closing the window the BAT file was run in, unless it was launched from a DOS command prompt window originally.


»bp
nociSoftware Engineer
Distinguished Expert 2018

Commented:
@echo off
setlocal EnableDelayedExpansion

ECHO ***** THIS IS THE NEW SCRIPT *****
PAUSE

rem Reset color to white on black
color 0F

echo Please enter the number of the break and the
echo order in the break for the following spots:

for /f "tokens=*" %%f in ('dir /b *.mp3') do (
  echo -- Break and play order for %%f
  set /p a="Which break? "
  set /p b="Play order? "
  ren "%%f" !a!.!b!_Spot!b!.mp3
)
Echo Done renaming....
pause

Open in new window

Owner/Programmer
Commented:
Well, actually, I did not "find my own solution," but something popped up that changed things entirely.

That "something" was a couple of naming conventions of which I was unaware and an audio system change that requires a complete rewrite of the specialized way sets of files are "played" on the website.

Add to that the diagnosis of angina (with the fatigue that is often a side effect) and that pretty much wipes out this question.

Thank you for all the responses. I hope that I'll get back to normal in all ways soon and can offer you more on Experts Exchange from time to time starting in the near future.