Adding commands to the command line
-
How do I create a shortcut to a command prompt window that will start a programme, with specific variables within the command prompt window? I'm using ffmpeg to convert some .flv files to .mp4 files. The command I'm using is: ffmpeg.exe -vcodec copy -acodec copy -i INPUT.flv OUTPUT.mp4 I have a shortcut (.lnk file) in the Start Menu that will load a command prompt window, which is this: Target: C:\WINDOWS\system32\cmd.exe /k ffmpeg.exe Start in: C:\Program Files\ffmpeg\bin Everything works great, apart from the fact that I have to type the whole command into the command prompt window every time. I want a shortcut that will load the command prompt window (like it already does) with the relevant command already inputted, so that when the window loads, it looks like this: C:\Program Files\ffmpeg\bin>ffmpeg.exe -vcodec copy -acodec copy -i This is on XP.
-
Answer:
There's a better way to handle this, using the command line and variables: Put the following into a new .bat file SET /P INPUT=Type your input filename SET /P OUTPUT=Type your output filename ffmpeg.exe -vcodec copy -acodec copy -i %INPUT%.flv %OUTPUT%.mp4 So when you double click that batch file, just type in the name of the .flv file (and don't put the .flv extension on it), hit enter, enter the output file name (again, no extension), hit enter, and ffmpeg should take off.
Solomon at Ask.Metafilter.Com Visit the source
Other answers
Does this work? (I don't have a Windows box to test with) Target: C:\WINDOWS\system32\cmd.exe /k ffmpeg.exe -vcodec copy -acodec copy -i INPUT.flv OUTPUT.mp4
mohrr
Nevermind, reread the question. I don't know.
mohrr
Why do you have to launch a command prompt. Won't a batch ( .bat ) file do this for you?
kaizen
"In DOS, OS/2, and Microsoft Windows, a batch file is a text file containing a series of commands intended to be executed by the command interpreter. When a batch file is run, the shell program (usually COMMAND.COM or cmd.exe) reads the file and executes its commands, normally line-by-line." No?
kaizen
Or you could make a batch file (similar to deezil's) that you associate with the flv extension. set INPUT=%~f1 set OUTPUT=%~d1%~p1%~n1.mp4 ffmpeg.exe -vcodec copy -acodec copy -i "%INPUT%" "%OUTPUT%" Then all you have to do is right click the file and "open with" your batch file. The fancy tildes in INPUT mean the fully qualified path name for the input file, and in OUTPUT mean the drive letter, the path and the filename without the extension. This worked for me in a similar batch file I made using vlc. Vlc didn't work, but the batch file worked.
gjc
I like gjc's solution as good as mine, so consider me endorsing that as well. In mine, if you wanted the .FLV and the .MP4 to have the same name, you could get rid of the second SET line, and replace %OUTPUT% in the third line with %INPUT%.
deezil
Related Q & A:
- How to remove path of my command line?Best solution by Super User
- How do I issue multiple commands using telnet or netcat?Best solution by Super User
- How to create jar file from command line?Best solution by Stack Overflow
- How to change brightness on Linux desktop through the command line?Best solution by Super User
- What is the difference between internal command and external command in Linux?Best solution by answers.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.