Tricky command line thingy, can I have some help?

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Jawah

Thread Starter
Joined
Apr 4, 2008
Messages
3
Hello!

OK, I'm left with a slight problem. I just can't do this whole command line business!

What I'm making is a toolbar for someone, for their web browser. Everything works and I've got a software package to make the main part of the toolbar for me.

But I need a button that can launch his BitTorrent client program.

The software package only allows you to, when trying to open an exe, specify two things: 1) The Exe name, and 2) any parametres to go with it.

The problem is that I don't know which BitTorrent client he's got. So I know that I can fathom it out like this:

1) Set the exe name as "cmd.exe" to open up the command line...

2) Put this is as the parametre values:

Code:
/k ftype BitTorrent
By putting that in, it pops up the Command Line and shows that BitTorrent files are associated with the program (in my case, my download manager, FlashGet - so for me it says "BitTorrent = "C:\Program Files\FlashGet\FlashGet.exe" "%1".

The problem I'm facing is how to get the computer to fathom out what his BitTorrent client is (solved), BUT THEN launch it, all in one Parameter line!

If anyone could tell me how to do this, then I'd be very appreciative :)

Thank you!

EDIT: I know you say don't post about BitTorrent, etc... but, this doesn't really involve USING BitTorrent or whatever... it'd be just the same if it was Microsoft Word... ? Sorry, delete this if you have to...
 
Joined
Aug 7, 2007
Messages
9,028
Code:
/k for /f "tokens=1,* delims==" %I in ('ftype bittorrent') do start %~dpnJ.exe
Note: This will only work if the file type bittorrent is associated with his client; not all clients set up that association.
Also, the path returned must not contain a variable.
For example ftype txtfile gives txtfile=%SystemRoot%\system32\NOTEPAD.EXE %1
the start command then becomes start c:\%SystemRoot%\system32\NOTEPAD.exe
%SystemRoot% doesn't get expanded, and if it did, the drive letter would not be needed.
You can do one path format or the other, but I haven't gotten it to work reliably with both types.
If you can start a batch file instead of an exe file, this can be checked easily.

Jerry
 

Jawah

Thread Starter
Joined
Apr 4, 2008
Messages
3
Working... well, sort of...

It's very close, just a little bit of an error now. When running cmd.exe with the parameters you specified, the command line window pops this up:

"Windows cannot find 'C:\Program'. Make sure the name you typed blah blah blah"...

As you say, I would do it in a batch file but the way the toolbar software works limits you from doing this...

The final output on the DOS screen is this (after clicking OK on the cannot find dialog)...

Code:
C:\PROGRA~1\SOFTOM~1\TOOLBA~1\projects\cab.in.work>start C:\Program Files\FlashGet\FlashGet.exe
The system cannot find the file C:\Program.

C:\PROGRA~1\SOFTOM~1\TOOLBA~1\projects\cab.in.work>
Thanks for the help so far though... :)
 
Joined
Aug 7, 2007
Messages
9,028
Dang, hate when I forget the durned quotes. Seems I always pick folders without spaces so I never notice. Try this:
Code:
/k for /f "tokens=1,* delims==" %I in ('ftype bittorrent') do start [COLOR="Red"]"[/COLOR]%~dpnJ.exe[COLOR="Red"]"[/COLOR]
Jerry
 

Jawah

Thread Starter
Joined
Apr 4, 2008
Messages
3
Almost there... :rolleyes:

What happens now:

Two windows open - the first window:

First window titled "C:\WINDOWS\system32\cmd.exe"
Contents of window (same as last time but without the error):
Code:
C:\PROGRA~1\SOFTOM~1\TOOLBA~1\projects\cab.in.work>start C:\Program Files\FlashGet\FlashGet.exe

C:\PROGRA~1\SOFTOM~1\TOOLBA~1\projects\cab.in.work>
Then there's a second window, titled "C:\Program Files\FlashGet\FlashGet.exe"
Contents of window:
Code:
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\PROGRA~1\SOFTOM~1\TOOLBA~1\projects\cab.in.work>
And then, no program actually opens... :confused:

Sorry this is dragging on a bit longer than I guess it should... :eek:
 
Joined
Aug 7, 2007
Messages
9,028
Check the shortcut that starts the program. Perhaps there is a command line switch that needs to be specified.
If you open a command prompt, can you start the program by entering:
start C:\Program Files\FlashGet\FlashGet.exe
or just
C:\Program Files\FlashGet\FlashGet.exe
If neither work, try first switching to the program folder
cd C:\Program Files\FlashGet
and see if it will start then. Could be the program is looking for it's configuration file in the current folder which it expects to be C:\Program Files\FlashGet, but the current folder is actually C:\PROGRA~1\SOFTOM~1\TOOLBA~1\projects\cab.in.work

Jerry
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top