Results 1 to 5 of 5

Thread: os.execute() doesn't work with spaces in path?

  1. #1
    Join Date
    Feb 2005
    Location
    Great White North
    Posts
    27

    Default os.execute() doesn't work with spaces in path?

    I've been trying to get lua code to execute an autoit script when a variable changes, so that my Homeseer computer can wake up Netremote touchscreens (which don't respond when in standby).

    After several hours I narrowed it down to not being able to execute a command if there are spaces in the path or filename. Is there a way around this (or is no one else seeing this behavior)?

    os.execute("F:\Program Files\Netremote\ccf\MonitorOn.au3") <fails>
    os.execute("F:\Progra~1\Netremote\ccf\Monitor On.au3") <fails>
    os.execute("F:\Progra~1\Netremote\ccf\MonitorOn.au 3") <works>

    It fails the same way with a simple .bat file which I copied to various directories until it worked. I saw some old post that had "[[..]]" around the os.execute parm, but that seemed to run cmd.exe without any command (DOS window came up but stayed at prompt).

    I'm running on XP.

  2. #2

    Default

    Try doubling up the '\' like this:

    Code:
    os.execute&#40;"F&#58;\\Program Files\\Netremote\\ccf\\MonitorOn.au3"&#41;
    JLee
    OpusNR & JLee CCF/GML available in the downloads section.

  3. #3
    Join Date
    Feb 2005
    Location
    Great White North
    Posts
    27

    Default

    Actually I do have the dual backslashes - mistyped that in the post.

  4. #4
    Join Date
    May 2004
    Location
    Cardigan, UK
    Posts
    9,278

    Default

    Try os.execute('"path"')

    ie with the full path in double quotes within single quotes
    --Rob

  5. #5
    Join Date
    Feb 2005
    Location
    Great White North
    Posts
    27

    Default

    Yes, that works...thanks.

Posting Permissions

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