Announcement

Collapse
No announcement yet.

SHELL with spaces in path

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • SHELL with spaces in path

    How can i shell another programm where the path to this program includes spaces (i hate this).

    shell "C:\Myfile.exe" => works
    shell "C:\Program Files\NotMyFile.exe" => does not work, because it's interpreted as:
    Call program "C:\Program" with parameter "File\NotMyFiles"

    Any help appreciated.
    Thanks.
    I'am still confused...but on a higher level.

  • #2
    Hi Michael,
    I just ran the following:

    SHELL "C:\Program Files\UltraVNC\vncviewer.exe"


    worked fine on Vista Business.
    What OS are you running ?



    Originally posted by Michael Zimmer View Post
    How can i shell another programm where the path to this program includes spaces (i hate this).

    shell "C:\Myfile.exe" => works
    shell "C:\Program Files\NotMyFile.exe" => does not work, because it's interpreted as:
    Call program "C:\Program" with parameter "File\NotMyFiles"

    Any help appreciated.
    Thanks.

    Comment


    • #3
      You can always make it the shortfilenotation.
      hellobasic

      Comment


      • #4
        Originally posted by Neil J Hosgood View Post
        Hi Michael,
        I just ran the following:

        SHELL "C:\Program Files\UltraVNC\vncviewer.exe"


        worked fine on Vista Business.
        What OS are you running ?
        Tried on Vista (no SP) and W2K8 Server.
        I forgot one thing: need to call a program with paramter

        SHELL "C:\Program Files\VMware\VMware Server\vmware.exe -l"
        I'am still confused...but on a higher level.

        Comment


        • #5
          Originally posted by Michael Zimmer View Post
          Tried on Vista (no SP) and W2K8 Server.
          I forgot one thing: need to call a program with paramter

          SHELL "C:\Program Files\VMware\VMware Server\vmware.exe -l"
          Hmmm, I am running SP1, but just tried:

          SHELL "C:\Program Files\UltraVNC\vncviewer.exe test.vnc"


          and it worked.
          Have you tried shelling a different app ?

          Comment


          • #6
            My fault.
            Sometimes it's usefull to reboot.
            Works now.
            I'am still confused...but on a higher level.

            Comment


            • #7
              You can always use ShellExecuteEx (demo:Win 32: Monitor Process with ShellExecuteEx June 22, 2001 instead of SHELL.

              (CreateProcess offers same option I think, let me a moment... yes, it does.)

              Both these functions let you specify the program name in one var and the parameter in another and the operating system sorts it out for you.

              I think you can also do it using the command processor to parse things out for you...
              Code:
              SHELL CMD.EXE /C "programname containing spaces"  parameters
              Michael Mattias
              Tal Systems (retired)
              Port Washington WI USA
              [email protected]
              http://www.talsystems.com

              Comment


              • #8
                Originally posted by Michael Zimmer View Post
                Tried on Vista (no SP) and W2K8 Server.
                I forgot one thing: need to call a program with paramter

                SHELL "C:\Program Files\VMware\VMware Server\vmware.exe -l"
                I think the command option should be outside the double quotes ie
                SHELL "C:\Program Files\VMware\VMware Server\vmware.exe" -l
                Correction thats only if you are doing it from a command prompt or shortcut, not SHELL in PB
                Last edited by John Petty; 13 Jun 2008, 10:34 AM.

                Comment


                • #9
                  Code:
                  #include "win32API.INC"
                  ...
                  ...
                    LOCAL szShortPath AS ASCIIZ * %MAX_PATH 
                    LOCAL szLongPath  AS ASCIIZ * %MAX_PATH
                    szLongPath = " whatever  it is " 
                    GetShortPathName szLongPath, szShortPath, SIZEOF(szShortPath) 
                    SHELL  szShortPath  parameters
                  (quick thank you to Edwin for suggestion)
                  Michael Mattias
                  Tal Systems (retired)
                  Port Washington WI USA
                  [email protected]
                  http://www.talsystems.com

                  Comment

                  Working...
                  X