1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Tricky command line thingy, can I have some help?

Discussion in 'DOS/Other' started by Jawah, Apr 4, 2008.

Thread Status:
Not open for further replies.
Advertisement
  1. Jawah

    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...
     
  2. TheOutcaste

    TheOutcaste

    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
     
  3. Jawah

    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... :)
     
  4. TheOutcaste

    TheOutcaste

    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
     
  5. Jawah

    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:
     
  6. TheOutcaste

    TheOutcaste

    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
     
  7. Sponsor

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 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/700355

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice