DosTips.com

A Forum all about DOS Batch
It is currently 30 Aug 2016 11:03

All times are UTC-06:00




Post new topic  Reply to topic  [ 10 posts ] 
Author Message
PostPosted: 13 Apr 2012 04:26 
Offline

Joined: 04 Apr 2012 03:11
Posts: 38
Hi guys,

In a similar vein to a previous query that i had i've got a situation where i need to read information from 3 files to build a command to be run...

The three files contain pathnames on different lines and i simply need a loop to call the whole line of data from each of the files and echo it out to the following command:

file1.txt = %var1%
file2.txt = %var2%
file3.txt = %var3%

each file has a the same amount of entries in it and i need to be able to loop through every line in them whilst using the data in the following command...

echo shntool split "%var1%" -f "%var2%" -m \-/-*-£-$-=-+-¬-`-¦-;-:-@-'-#-~- -t "%%p - %%t" -d "%DRIVE%\OJW\TEMP\%var3%"

The other problem i have is when trying to echo out the command is that the bit that reads "%%p - %%t" dosnt show up in the echo ...

Any ideas?


Top
   
PostPosted: 13 Apr 2012 06:02 
Offline
Expert

Joined: 23 Dec 2011 13:59
Posts: 3169
Like I posted in your last thread.
The very first set of code in this thread is what you would use.
viewtopic.php?f=3&t=3126


Top
   
PostPosted: 13 Apr 2012 06:27 
Offline
Expert

Joined: 10 Feb 2012 02:20
Posts: 5914
If you describe how you create file1/2/3 then maybe other ideas can be used.


Top
   
PostPosted: 13 Apr 2012 06:50 
Offline
Expert

Joined: 23 Dec 2011 13:59
Posts: 3169
foxidrive wrote:
If you describe how you create file1/2/3 then maybe other ideas can be used.

Kind of like your last post! :lol:


Top
   
PostPosted: 13 Apr 2012 07:31 
Offline
Expert

Joined: 10 Feb 2012 02:20
Posts: 5914
:) maybe there is a simpler way.


Top
   
PostPosted: 13 Apr 2012 08:20 
Offline

Joined: 04 Apr 2012 03:11
Posts: 38
Lol ... I'm 99% of the way there... although im sure this could be a LOT cleaner! :)

@echo off
setlocal EnableDelayedExpansion
dir /s /b c:\ojw\temp\ape\*.wav >c:\ojw\logs\APE_fullpath.txt
dir /s /b c:\ojw\temp\ape\*.cue >c:\ojw\logs\APE_cuefullpath.txt
dir /b c:\ojw\temp\ape >c:\ojw\logs\APE_albumfoldername.txt
3<c:\ojw\logs\APE_cuefullpath.txt 4<c:\ojw\logs\APE_albumfoldername.txt (
for /F "delims=" %%a in (c:\ojw\logs\APE_fullpath.txt) do (
set line=
set /P line=c:\ojw\tools\shntool.exe split "%%a" -f <&3
set /P line= ""!line!" -m \-/-*-£-$-=-+-¬-`-¦-;-:-@-'-#-~- -t "%%p - %%t" -d "c:\ojw\completed_album\ape\<&4
echo(!line!
)
) >c:\ojw\logs\diditwork.txt


Now....The reasen it's only 99% there and not 100% is this...

The above bit of code generates the following command for me:

c:\ojw\tools\shntool.exe split "c:\ojw\temp\ape\Anthrax (ape).rar\CDIMAGE.wav" -f "c:\ojw\temp\ape\Anthrax (ape).rar\CUE\B52 - FUNPLEX.cue" -m \-/-*-£-$-=-+-¬-`-¦-;-:-@-'-#-~- -t "%p - %t" -d "c:\ojw\completed_album\ape\Anthrax (ape).rar


The only problem is... It needs to be like this ...

c:\ojw\tools\shntool.exe split "c:\ojw\temp\ape\Anthrax (ape).rar\CDIMAGE.wav" -f "c:\ojw\temp\ape\Anthrax (ape).rar\CUE\B52 - FUNPLEX.cue" -m \-/-*-£-$-=-+-¬-`-¦-;-:-@-'-#-~- -t "%p - %t" -d "c:\ojw\completed_album\ape\Anthrax (ape).rar"

*** The only difference is the quote mark on the VERY end of the command!!! ***

I just cant seem to get it in there!! Everything i do IGNORES the quote at the end!

Ideas?


Top
   
PostPosted: 13 Apr 2012 09:11 
Offline
Expert

Joined: 10 Feb 2012 02:20
Posts: 5914
Try this and see what is produced in testrun.bat.txt

Run it in c:\ojw\temp\ape\ folder

Code:
@echo off 
del testrun.bat.txt 2>nul
for /f "delims=" %%a ('dir *.cue /b /s') do (
for /f "delims=" %%b ("%%~dpa\..") do (
echo c:\ojw\tools\shntool.exe split "%%~dpb\cdimage.wav" -f "%%a" -m \-/-*-£-$-=-+-¬-`-¦-;-:-@-'-#-~- -t "%%%%p - %%%%t" -d "%%~dpb">>testrun.bat.txt
)
)


This one might remove the entries files where a cdimage.wav doesn't exist.

Code:
@echo off 
del testrun.bat.txt 2>nul
for /f "delims=" %%a ('dir *.cue /b /s') do (
for /f "delims=" %%b ("%%~dpa\..") do (
if exist "%%~dpb\cdimage.wav" (
echo c:\ojw\tools\shntool.exe split "%%~dpb\cdimage.wav" -f "%%a" -m \-/-*-£-$-=-+-¬-`-¦-;-:-@-'-#-~- -t "%%%%p - %%%%t" -d "%%~dpb">>testrun.bat.txt
)
)
)


Top
   
PostPosted: 13 Apr 2012 10:17 
Offline

Joined: 04 Apr 2012 03:11
Posts: 38
I'll try it when i get home tonight!

Thanks Foxi... ;)


Top
   
PostPosted: 13 Apr 2012 18:13 
Offline
Expert

Joined: 06 Dec 2011 22:15
Posts: 1184
Location: México City, México
phoenix_Rising wrote:
*** The only difference is the quote mark on the VERY end of the command!!! ***

I just cant seem to get it in there!! Everything i do IGNORES the quote at the end!

Ideas?

Did you tried to change the ending
Code:
echo(!line!
.. by this one?
Code:
echo(!line!"


Top
   
PostPosted: 15 Apr 2012 02:38 
Offline
Expert

Joined: 10 Feb 2012 02:20
Posts: 5914
phoenix_Rising wrote:
I'll try it when i get home tonight!

Thanks Foxi... ;)



Did it work?


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 10 posts ] 

All times are UTC-06:00


Who is online

Users browsing this forum: aGerman, Bing [Bot] and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited