Syntax for Command Line with Spaces

Archived from groups: microsoft.public.windowsxp.general (More info?)

I need help writing a command line.

I need to pass a filename as an argument to an executable file. The
filename may have a space in it, and the executable filename has a
space in it. For instance:

"Executable File.exe" "C:\Argument File.mde"

But that doesn't work. What is the proper syntax?


-TC
9 answers Last reply
More about syntax command line spaces
  1. Archived from groups: microsoft.public.windowsxp.general (More info?)

    Torgeir: Perhaps I simplified too much when trying to create a generic
    example. The exact command line I'm trying to use is

    "Access App Starter.exe" /ApplicationFile "C:\Program Files\Veeco
    Probes Product App\Veeco Probes Product App.mde"


    Dave: I don't understand your question "Why does a response file NEED a
    space in it?" These files have spaces in them. I don't know if they
    need them, but they have them, and I must write a command line which
    uses them as they are.


    -TC
  2. Archived from groups: microsoft.public.windowsxp.general (More info?)

    Torgeir,

    I am executing the command from the folder which contains "Access App
    Starter.exe". The error is:

    'Access' is not recognized as an internal or external command, operable
    program or batch file.


    -TC
  3. Archived from groups: microsoft.public.windowsxp.general (More info?)

    Torgeir,

    I have discovered that the following command works:

    "Access App Starter.exe" /ApplicationFile 'C:\Program Files\Veeco
    Probes Product App\Veeco Probes Product App.mde'

    >From this exercise, I have inferred that parameters passed in a command
    line may not use double quotes, but may use single quotes. The
    restriction seems to apply to commands typed directly on the command
    line or executed from a Windows Installer Shortcut, but do not apply to
    commands executed from .bat files or .lnk shortcuts. (In other words,
    the exact same command may work in a batch file and fail when typed
    directly.) Can anyone confirm this observation?

    -TC
  4. Archived from groups: microsoft.public.windowsxp.general (More info?)

    From: "TC" <golemdanube@yahoo.com>

    | I need help writing a command line.
    |
    | I need to pass a filename as an argument to an executable file. The
    | filename may have a space in it, and the executable filename has a
    | space in it. For instance:
    |
    | "Executable File.exe" "C:\Argument File.mde"
    |
    | But that doesn't work. What is the proper syntax?
    |
    | -TC

    That should work or just use the 8.3 name instead.
    The question is why does a response file NEED a space in it ?

    --
    Dave
    http://www.claymania.com/removal-trojan-adware.html
    http://www.ik-cs.com/got-a-virus.htm
  5. Archived from groups: microsoft.public.windowsxp.general (More info?)

    From: "TC" <golemdanube@yahoo.com>

    | Torgeir: Perhaps I simplified too much when trying to create a generic
    | example. The exact command line I'm trying to use is
    |
    | "Access App Starter.exe" /ApplicationFile "C:\Program Files\Veeco
    | Probes Product App\Veeco Probes Product App.mde"
    |
    | Dave: I don't understand your question "Why does a response file NEED a
    | space in it?" These files have spaces in them. I don't know if they
    | need them, but they have them, and I must write a command line which
    | uses them as they are.
    |
    | -TC

    TC:

    A simple workaround would be to script the following...

    Run_Acces_App.cmd
    ------------------------
    @echo off
    c:
    cd "C:\Program Files\Veeco Probes Product App"
    copy "Veeco Probes Product App.mde" response.mde
    "Access App Starter.exe" /ApplicationFile response.mde

    --
    Dave
    http://www.claymania.com/removal-trojan-adware.html
    http://www.ik-cs.com/got-a-virus.htm
  6. Archived from groups: microsoft.public.windowsxp.general (More info?)

    "TC" <golemdanube@yahoo.com> wrote:

    >I need help writing a command line.
    >
    >I need to pass a filename as an argument to an executable file. The
    >filename may have a space in it, and the executable filename has a
    >space in it. For instance:
    >
    > "Executable File.exe" "C:\Argument File.mde"
    >
    >But that doesn't work. What is the proper syntax?

    Looks like it should work. Maybe you need to add the path to the
    executable file name, something like:

    "c:\program files\some dir\Executable File.exe" "C:\Argument File.mde"

    --
    Tim Slattery
    MS MVP(DTS)
    Slattery_T@bls.gov
  7. Archived from groups: microsoft.public.windowsxp.general (More info?)

    TC wrote:

    > I need help writing a command line.
    >
    > I need to pass a filename as an argument to an executable file. The
    > filename may have a space in it, and the executable filename has a
    > space in it. For instance:
    >
    > "Executable File.exe" "C:\Argument File.mde"
    >
    > But that doesn't work. What is the proper syntax?
    >
    Hi,

    The syntax above is correct.

    Please post the exact command line you are trying to use.


    --
    torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
    Administration scripting examples and an ONLINE version of
    the 1328 page Scripting Guide:
    http://www.microsoft.com/technet/scriptcenter/default.mspx
  8. Archived from groups: microsoft.public.windowsxp.general (More info?)

    TC wrote:

    > Torgeir: Perhaps I simplified too much when trying to create a generic
    > example. The exact command line I'm trying to use is
    >
    > "Access App Starter.exe" /ApplicationFile "C:\Program Files\Veeco
    > Probes Product App\Veeco Probes Product App.mde"
    >
    Hi,

    The syntax above is fine.

    1)
    What exact error message do you get?

    2)
    Is "Access App Starter.exe" located in a folder that is included
    in the PATH environment variable, or are the folder where the exe
    is located your current folder when launching it, or are "Access
    App Starter.exe" added to "App Paths" in registry?


    --
    torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
    Administration scripting examples and an ONLINE version of
    the 1328 page Scripting Guide:
    http://www.microsoft.com/technet/scriptcenter/default.mspx
  9. Archived from groups: microsoft.public.windowsxp.general (More info?)

    TC wrote:

    > Torgeir,
    >
    > I am executing the command from the folder which contains "Access App
    > Starter.exe". The error is:
    >
    > 'Access' is not recognized as an internal or external command, operable
    > program or batch file.
    >
    Hi,

    That is what you would get if you had run this command without quotes
    around it:

    Access App Starter.exe


    But it should not happen if you really use quotes around it:

    "Access App Starter.exe"


    unless "Access App Starter.exe" try to launch Access.exe in a
    "bad" way.


    --
    torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
    Administration scripting examples and an ONLINE version of
    the 1328 page Scripting Guide:
    http://www.microsoft.com/technet/scriptcenter/default.mspx
Ask a new question

Read More

Filename Microsoft Command Line Windows XP