Results 1 to 4 of 4
  1. #1
    5 Star Lounger
    Join Date
    Mar 2001
    Location
    New York, NY
    Posts
    856
    Thanks
    0
    Thanked 9 Times in 8 Posts

    Where to put quotes in Shell command?

    I'm having trouble with the quotes in a Shell command that contains arguments.

    In the following line, where do the quotes go? I believe I need to add more, but I'm not sure where.

    Shell "C:\Program Files (x86)\HotDocs\HotDocs.exe" /ex

    Thanks.
    Richard

  2. Subscribe to our Windows Secrets Newsletter - It's Free!

    Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    Super Moderator BATcher's Avatar
    Join Date
    Feb 2008
    Location
    A cultural area in SW England
    Posts
    2,812
    Thanks
    19
    Thanked 107 Times in 101 Posts
    Probably where you put them!
    Or possibly include the /ex within the quotes.
    Easy enough to try both options?
    BATcher

    If it wasn't for the weather, Great Britain would be a silent nation.

  4. #3
    Gold Lounger
    Join Date
    Dec 2009
    Location
    Earth
    Posts
    3,433
    Thanks
    7
    Thanked 213 Times in 202 Posts
    The rule is "anything with spaces need quotes", parameters don't unless the value you are passing has a required space.
    C:\Program Files (x86)\HotDocs\HotDocs.exe has a space so it must be quoted.
    /ex is a parameter with no required spaces in it.

    The SHELL function requires you to pass the program and arguments as a string, which means enclosing the whole lot in quotes.
    In your case you have a space in the program that must be quoted, so you need to "quote the quotes". See this Microsoft page for examples.

    cheers, Paul

  5. #4
    Super Moderator BATcher's Avatar
    Join Date
    Feb 2008
    Location
    A cultural area in SW England
    Posts
    2,812
    Thanks
    19
    Thanked 107 Times in 101 Posts
    That's probably one of the reasons I stuck to BATch files!
    BATcher

    If it wasn't for the weather, Great Britain would be a silent nation.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •