Thank you for being a valued part of the CNET community. As of December 1, 2020, the forums are in read-only format. In early 2021, CNET Forums will no longer be available. We are grateful for the participation and advice you have provided to one another over the years.

Thanks,

CNET Support

Question

Dos script problem

Mar 6, 2013 2:18AM PST

Hello,

I'm new in this forum. So let me know if I have posted in the wrong place. I have a small problem with this script.

@echo off
setlocal enabledelayedexpansion

for /f %%G in ('dir /b /o:n *.mp3') do (
call SillyrintVal 30 %%~nG
set CP=!var!
echo !CP!>> rresult.txt
)
goto:eof

SillyrintVal
for /L %%a in (1,1,%1) do set zero= !zero!
set var=!zero!%2
set var=!var:~-%1!
goto :eof

Could someone tell me why after some good results, the !CP! value is always the same ? It looks like a variable cannot change more than 75 times or something like that. You can run directly this script in a .bat file to see the result.

Thanks for your answer.
Nico

Discussion is locked

- Collapse -
Clarification Request
(NT) So is this the old MP3 FILE RENAMER discussion?
Mar 6, 2013 2:26AM PST
- Collapse -
Different topic
Mar 6, 2013 2:34AM PST

Actually I changed the file type. The script is initially to retrieve some information from .html files (result files from a software used in my job). I changed to mp3 files because everybody has as many mp3 files as necessary to test this script.

The result of the script would be:
ACDC
Aerosmith
Aerosmith
A-Ha
Alanis
Alanis
Alanis
Alanis
All
Alphaville
America
Animals
Archive
Archive
Army
Avril
Avril
Avril
Avril
B
Bananarama
Beach
Beck
Beck
Beck
Beck
Beck
Beck
Beck
Beck
Belinda
Better
Big
Billy
Billy
Blink
Blink
Blink
Blink
Blink
Bloc
Blondie
Blondie
Blondie
Blondie
Blondie
Bob
Bob
Bob
Bob
Bon
Bonnie
Bonnie
Bonnie
Breeders
Breeders
Breeders
Bruce
Bruce
Bruce
Bruce
Bryan
Buffalo
Buggles
Calexico
Calexico
Calexico
Calexico
Calexico
Calexico
and then even if the other mp3 files have a different name, the script will write Calexico in the result files. That's why I do not understand. Is there any limitation ?

Thanks

- Collapse -
Not here.
Mar 7, 2013 3:01PM PST

But the script looks too convoluted. That is...
set CP=!var!
echo !CP!>> rresult.txt

I might try to echo var >> result rather than toss it to CP.

Then I think there's no need for the subroutine either. Could be wrong but seems it could be simplified.
Bob

- Collapse -
!CP!
May 15, 2013 10:08PM PDT

Believe Bob's answer will be helpful. Did you tried? what the output you got?