Questions about BAT
Questions about BAT
Alright, i have been trying for a while now to do the following, i have googled up and down, searched this forum and the like.
I have a .bat file that i created to help me convert my music. The problem i have is the .bat file calls an .exe and sends it several parameters. Here is an exerpt of it:
~~~~
If ~%1 == ~ GOTO end
C:\Music\Lame_Encoder\lame.exe -b 320 -F -h %1 "%~d1%~p1%~n1 - 320.mp3"
~~~~
What this does in windows is checks to see if parameter 1 (usually a file i drag-n-dropped onto the .bat file) exists [If ~%1 == ~ GOTO end] then, if it does exist, finds lame.exe [C:\Music\Lame_Encoder\lame.exe] and then the options for lame [-b 320 -F -h] and finally the file to convert [%1] and converted file name ["%~d1%~p1%~n1 - 320.mp3"] (prior meaning ~Drive~\~PathofOriginalFile~\~NameofOriginalFile~ - 320.mp3)
This works excellent in windows, i just drag over several files and it outputs .mp3's to the original file's folder.
This does NOT work so well with wine. For various reasons i need to use this .bat and .exe file (mainly for file consistency between linux and windows). The end game i want it to be able to goto the command promt, drag-n-drop the .bat file over to it, then drag the files i want to convert to the promt as well.
The lame.exe and .bat file are currently in my '/home/~username~/.wine/drive_c/Music/Lame_Encoder/' folder, so the bat file should be looking in the right place.
One thing i have found to work is opening a terminal and drag-n-droping the lame.exe file, typing -b 320 -F -h then draging the .wav file from a different directory over. The command looks like this...
'/home/~username~/.wine/drive_c/Music/Lame_Encoder/lame.exe' -b 320 -F -h '/home/~username~/Desktop/311 - Amber.wav'
that outputs exactly like i want, one mp3 in the directory '~/Desktop' named '311 - Amber.mp3'
can anyone help me create a working .bat or other script so i can send more than one file with the options '-b 320 -F -h' to the lame.exe so i can setup a few files to convert and walk away?
Thanx for anyone who tries to help!
PS yes its a long post, but i would rather people post like this so i know all the factors then a post that really vague and i have to ask a bunch of basic questions
I have a .bat file that i created to help me convert my music. The problem i have is the .bat file calls an .exe and sends it several parameters. Here is an exerpt of it:
~~~~
If ~%1 == ~ GOTO end
C:\Music\Lame_Encoder\lame.exe -b 320 -F -h %1 "%~d1%~p1%~n1 - 320.mp3"
~~~~
What this does in windows is checks to see if parameter 1 (usually a file i drag-n-dropped onto the .bat file) exists [If ~%1 == ~ GOTO end] then, if it does exist, finds lame.exe [C:\Music\Lame_Encoder\lame.exe] and then the options for lame [-b 320 -F -h] and finally the file to convert [%1] and converted file name ["%~d1%~p1%~n1 - 320.mp3"] (prior meaning ~Drive~\~PathofOriginalFile~\~NameofOriginalFile~ - 320.mp3)
This works excellent in windows, i just drag over several files and it outputs .mp3's to the original file's folder.
This does NOT work so well with wine. For various reasons i need to use this .bat and .exe file (mainly for file consistency between linux and windows). The end game i want it to be able to goto the command promt, drag-n-drop the .bat file over to it, then drag the files i want to convert to the promt as well.
The lame.exe and .bat file are currently in my '/home/~username~/.wine/drive_c/Music/Lame_Encoder/' folder, so the bat file should be looking in the right place.
One thing i have found to work is opening a terminal and drag-n-droping the lame.exe file, typing -b 320 -F -h then draging the .wav file from a different directory over. The command looks like this...
'/home/~username~/.wine/drive_c/Music/Lame_Encoder/lame.exe' -b 320 -F -h '/home/~username~/Desktop/311 - Amber.wav'
that outputs exactly like i want, one mp3 in the directory '~/Desktop' named '311 - Amber.mp3'
can anyone help me create a working .bat or other script so i can send more than one file with the options '-b 320 -F -h' to the lame.exe so i can setup a few files to convert and walk away?
Thanx for anyone who tries to help!
PS yes its a long post, but i would rather people post like this so i know all the factors then a post that really vague and i have to ask a bunch of basic questions
Re: Questions about BAT
Don't waste your time on neutered "shell scripting". Use the real thing:GamezR2EZ wrote:Alright, i have been trying for a while now to do the following, i have googled up and down, searched this forum and the like.
I have a .bat file that i created to help me convert my music. The problem i have is the .bat file calls an .exe and sends it several parameters. Here is an exerpt of it:Code: Select all
If ~%1 == ~ GOTO end C:\Music\Lame_Encoder\lame.exe -b 320 -F -h %1 "%~d1%~p1%~n1 - 320.mp3"
Code: Select all
#!/bin/bash
[[ -f "$1" ]] && lame -b 320 -F -h "$1" "$HOME/Desktop/$(basename ${1%%.*}).mp3"
Re: Questions about BAT
which i stated i did not AND i needed to use the exe (it has a few modifications since its original source)vitamin wrote:
This of course assumes you did install lame package.
Re: Questions about BAT
Recompile it for Linux. What's the problem?GamezR2EZ wrote:which i stated i did not AND i needed to use the exe (it has a few modifications since its original source)vitamin wrote:
This of course assumes you did install lame package.
if anyone has an answer to my original question, and not a work around, please let me know
i have several .bat files with exe's that i use like this, so ill need an answer to how this can be done, or if this can be done
please do not offer alternative ways to do it, for this will not help me in the future
i have several .bat files with exe's that i use like this, so ill need an answer to how this can be done, or if this can be done
please do not offer alternative ways to do it, for this will not help me in the future
I've read your original post three times and I can't see that you've clearly explained what the problem is.GamezR2EZ wrote:if anyone has an answer to my original question, and not a work around, please let me know
i have several .bat files with exe's that i use like this, so ill need an answer to how this can be done, or if this can be done
please do not offer alternative ways to do it, for this will not help me in the future
If it's about dragging and dropping then why don't you just use a FOR statement to select the input from a directory instead of expecting it to be a parameter.
something like: FOR %%A in (C:\input\*.wav) do echo %%a
Thanx jeffz, as it turns out i decided to rewrite the .bat in C++ and just make an exe that did the same thing, because wine can handle that with no problem at all, and im not quite sure why
i have a few ideas, but it works so no matter, they are small little bat files so ill just rewrite the rest of them as well in cpp, that way i wont have anymore issues
PS jeffz, the reason i hadnt implemented the FOR command like you wanted was becuase of the way my company finds files to convert, they use the search function in windows, and that box displays more than one files from that directory, originally my script looked something like this
but people ended up converting the same files over and over again, granted i could have put in safeties, like IF %A.mp3 exists THEN, but after weighing the factors, we ended up not, people sometimes just can't be taught some things
Thanx for everyones help!
i have a few ideas, but it works so no matter, they are small little bat files so ill just rewrite the rest of them as well in cpp, that way i wont have anymore issues
PS jeffz, the reason i hadnt implemented the FOR command like you wanted was becuase of the way my company finds files to convert, they use the search function in windows, and that box displays more than one files from that directory, originally my script looked something like this
Code: Select all
If ~%1 == ~ GOTO end
For %A IN (%~d1%~p1*.wav) DO "C:\Lame_Encoder\lame.exe -b 320 -F -h %A "%~dA%~pA%~nA - 320.mp3""
Thanx for everyones help!
Questions about BAT
GamezR2EZ wrote:
2. If the answer to 1 is NO use DOSBOX.
3. If the answer to 2 is YES use:
code:
wine `C:\Music\Lame_Encoder\lame.exe -b 320 -F -h %1 "%~d1%~p1%~n1 -
320.mp3"`
This will invoke wine to run the Windows Lame executable. This should
be done for each conversion.
The problem with running a .bat file is that this is DOS speak. Using a
bash shell script is what Linux is looking for and it does work.
James McKenzie
1. Is lame.exe a Windows executible?Alright, i have been trying for a while now to do the following, i have googled up and down, searched this forum and the like.
I have a .bat file that i created to help me convert my music. The problem i have is the .bat file calls an .exe and sends it several parameters. Here is an exerpt of it:
~~~~
If ~%1 == ~ GOTO end
C:\Music\Lame_Encoder\lame.exe -b 320 -F -h %1 "%~d1%~p1%~n1 - 320.mp3"
~~~~
2. If the answer to 1 is NO use DOSBOX.
3. If the answer to 2 is YES use:
code:
wine `C:\Music\Lame_Encoder\lame.exe -b 320 -F -h %1 "%~d1%~p1%~n1 -
320.mp3"`
This will invoke wine to run the Windows Lame executable. This should
be done for each conversion.
The problem with running a .bat file is that this is DOS speak. Using a
bash shell script is what Linux is looking for and it does work.
James McKenzie
Re: Questions about BAT
hi JamesJames McKenzie wrote:GamezR2EZ wrote:1. Is lame.exe a Windows executible?Alright, i have been trying for a while now to do the following, i have googled up and down, searched this forum and the like.
I have a .bat file that i created to help me convert my music. The problem i have is the .bat file calls an .exe and sends it several parameters. Here is an exerpt of it:
~~~~
If ~%1 == ~ GOTO end
C:\Music\Lame_Encoder\lame.exe -b 320 -F -h %1 "%~d1%~p1%~n1 - 320.mp3"
~~~~
2. If the answer to 1 is NO use DOSBOX.
3. If the answer to 2 is YES use:
code:
wine `C:\Music\Lame_Encoder\lame.exe -b 320 -F -h %1 "%~d1%~p1%~n1 -
320.mp3"`
This will invoke wine to run the Windows Lame executable. This should
be done for each conversion.
The problem with running a .bat file is that this is DOS speak. Using a
bash shell script is what Linux is looking for and it does work.
James McKenzie
batch files may have their history rooted in DOS, but they are very much a part of modern windows, supported by cmd.exe
Those parameters %1 %~1d11% etc... are part of the batch programming language, you can't just pass them to lame.
Re: Questions about BAT
correct, and as stated running from an exe is no problem i have been able to do that, however that would require a one by one conversion, very time consuming, instead i turned the .bat into an exe, thus enabling a good runjeffz wrote:James McKenzie wrote:GamezR2EZ wrote:
hi James
batch files may have their history rooted in DOS, but they are very much a part of modern windows, supported by cmd.exe
Those parameters %1 %~1d11% etc... are part of the batch programming language, you can't just pass them to lame.
PS for those who would like to turn there .bat's into exe found an even easier way to do it! if you have a windows console (meaning you have to have one) goto Start>Run and type "iexpress" it will do it for you