Jump to content

Using program through command line


ajit
 Share

Recommended Posts

Hi:

I want to operate switch.exe (details given below) through command line. I have no idea on how to go about it. I want to convert a file, eg. Music.mp3 to Music.wav. The program (switch) must remain hidden during conversion.

Please help me out.

Regards

Ajit.

Details from help file on using command line.

The Switch command-line tool allows you to use Switch to convert files from the Windows command line. This can be used to let other software convert files with Switch or to automate batch conversion.

Important Note: Due to a limitation in the way Windows handles running graphical programs from the command line, Switch cannot give any feedback when an issued command has been completed, nor can it block the command line while a conversion is taking place. We are currently investigating possible ways to circumvent the Windows problem, but please note it down for now and take it into account when issuing command-line orders to Switch.

The Switch executable is usually located as "C:\Program Files\NCH Swift Sound\Switch\switch.exe"

Usage: switch.exe [options] [files to add]

"Options" is where you can issue a series of commands to Switch. The options are:

-convert - convert all files loaded into Switch.

-clear - remove all files loaded into Switch.

-addfolder [FOLDER_NAME] - add a folder of files into Switch.

-format [FORMAT_NAME] - specify the output file format for which to convert the loaded files. The format names are the file extensions for each format (e.g. .wav, .mp3).

-outfolder [FOLDER_NAME] - specify the output folder to store the converted files. Do NOT end the folder path with a backslash '\' character.

-settempfolder [FOLDER_NAME] - specify the temporary folder that Switch will store files in when playing or converting files. If the specified folder is not valid then no action will take place.

-overwrite [OVERWRITE_FLAG] - specifies what to do when the converted file already exists. The flags are "PROMPT" (Prompt for What to Do), "ALWAYS" (Overwrite the File), "NEVER" (Don't Convert the Original File), "CANCEL" (Abort All Conversions), "APPENDNUMBER [format]" (Append number to filename - [format] is optional, if blank it will use the format already specified in the program).

-settings [FORMAT_NAME] [sETTINGS_OPTIONS] - specifies the settings configuration to use for the specified format. For more detail on what parameters to use, see further down the page.

-insettings [FORMAT_NAME] [sETTINGS_OPTIONS] - specifies the settings configuration to use for formats requiring decoding prior to conversion (e.g. .vox, .raw) For more detail on what parameters to use, see further down the page.

-hide - hide the Switch window.

-show - show the Switch window.

-exit - exit Switch.

"Files to Add" is where you type in the files you want to load into Switch. All typed filenames must use the full filepath of the name, and circumfixed with inverted commas.

Examples:

switch.exe -format MP3

switch.exe -outfolder "C:\My Music";

switch.exe -hide

switch.exe "C:\My Documents\sound.mp3"

switch.exe -convert "C:\My Music\music.mp3" -format .wav -overwrite ALWAYS

switch.exe -convert "C:\My Music\music.ogg" -format .mp3 -overwrite APPENDNUMBER "%filename%-%number%"

Unless you are in the Switch folder you will need to replace "switch.exe" from above with the full path "C:\Program Files\NCH Swift Sound\Switch\switch.exe" like this:

"C:\Program Files\NCH Swift Sound\Switch\switch.exe" -convert "C:\My Music\music.mp3" -format WAV

Settings Options:

The following details what parameters to enter when using the "-settings" and "-insettings" options. Note the order in which the parameters are written is the order in which they must be typed. Additionally, all parameters must be entered otherwise the command will not take effect.

WAV [codeC] [sAMPLE_RATE] [CHANNELS]

CODEC - either "PCM8", "PCM16", "ALAW" or "MULAW" (note ADPCM is not supported at this time)

SAMPLE_RATE - entered in Hz e.g. 8000

CHANNELS - either 1 or 2

Note the possible combination of values that can be entered depend largely on the codec, so you would have to open Switch and determine beforehand what values you can use for the codec in question.

Example: -settings .wav PCM16 44100 2

MP3 ENCODER_TYPE CBR[bITRATE] [HIGH_QUALITY] VBR[MIN_BITRATE] [MAX_BITRATE] [QUALITY] [CHANNEL_MODE] [ERROR_PROTECT]

ENCODER_TYPE - either "CBR" or "VBR"

CBR OPTIONS:

BITRATE - entered in kbps e.g. 128

HIGH_QUALITY - either "TRUE" or "FALSE"

VBR OPTIONS:

MIN_BITRATE - entered in kbps e.g. 128

MAX_BITRATE - entered in kbps e.g. 192

QUALITY - a value from 0 to 9

CHANNEL_MODE - either "STEREO", "JOINT", "FORCE" or "MONO"

ERROR_PROTECT - either "TRUE" or "FALSE"

Examples:

-settings .mp3 CBR 128 TRUE STEREO TRUE

-settings .mp3 VBR 128 192 4 MONO FALSE

OGG ENCODER_TYPE Quality[QUALITY] VBR[MIN_BITRATE] [MAX_BITRATE] [CHANNELS] [sTRIP_COMMENTS]

ENCODER_TYPE - either "Quality" or "VBR"

Quality OPTIONS:

QUALITY - a value between 0 and 10

VBR OPTIONS:

MIN_BITRATE - entered in kbps e.g. 128

MAX_BITRATE - entered in kbps e.g. 192

CHANNELS - either 1 or 2

STRIP_COMMENTS - either "TRUE" or "FALSE"

Examples:

-settings .ogg Quality 5 2 TRUE

-settings .ogg VBR 96 192 1 FALSE

AAC/M4A ENCODER_TYPE ABR[bITRATE] VBR[QUALITY] [FORCE_MPEG2] [TNS]

ENCODER_TYPE - either "ABR" or "VBR"

ABR OPTIONS:

BITRATE - entered in kbps e.g. 128

VBR OPTIONS:

QUALITY - a value between 0 and 10

FORCE_MPEG2 - either "TRUE" or "FALSE"

TNS - either "TRUE" or "FALSE"

Examples:

-settings .aac ABR 128 FALSE FALSE

-settings .m4a VBR 100 TRUE TRUE

FLAC [COMPRESSION_LEVEL] [sAMPLE_RATE] [CHANNELS]

COMPRESSION_LEVEL - a value between 0 and 8

SAMPLE_RATE - entered in Hz e.g. 8000

CHANNELS - either 1 or 2

Example: -settings .flac 6 44100 2

VOX/RAW [codeC] [sAMPLE_RATE] [CHANNELS]

(Note: applies to both "-settings" and "-insettings" commands)

CODEC - a number between 0 and 8, representing the codec type. The codecs on offer are (in order):

Dialogic ADPCM

G.711 uLaw

G.711 aLaw

16 bit PCM (Intel Endian)

8 bit unsigned

8 bit signed

16 bit PCM (Big Endian)

32 bit float (Intel Endian)

32 bit float (Big Endian)

SAMPLE_RATE - entered in Hz e.g. 8000

CHANNELS - either 1 or 2

Examples:

-settings .vox 0 44100 2

-settings .raw 3 32000 1

-insettings .vox 2 22050 2

-insettings .raw 4 8000 1

AMR [bITRATE]

BITRATE - the bitrate at which you want to encode the AMR file (in kbps). The choices are 4.75, 5.15, 5.9, 6.7, 7.4, 7.95, 10.2 and 12.2.

Examples:

-settings .amr 4.75

-settings .amr 10.2

M3U/PLS/WPL/RSS

URL - the URL of the site where you will host the playlist file. URLs should start with the http:// or ftp:// protocol string as appropriate.

To configure the settings for the generated MP3 file, use the standard MP3 settings syntax to configure it (i.e. -settings .mp3 etc. etc.)

Examples:

-settings .rss "http://www.music.com/"

-settings .m3u "http://livebands.com/rock/"

-settings .pls "ftp://latinmusic.net/samba/"

Link to comment
Share on other sites

How can I put this in Runwait or Run

"C:\Program Files\NCH Swift Sound\Switch\switch.exe" -convert "C:\Documents and Settings\Ajit\My Documents\My Music\music.mp3"

Regards

Ajit

Either add your line to the run command, but enclosed in single quotes, or do the same to create a variable, and then run($variable)

William

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...