sketchucation logo sketchucation
    • Login
    šŸ¤‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Windows spawn program

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 2 Posters 536 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • G Offline
      Garry K
      last edited by

      I've been playing around with the spawn command and found some interesting things. I'm setup as a regular user on Windows 10 and using SU 2016

      I can easily start an external Windows program such as cutmaster.exe using the spawn command providing it is not installed in program files
      filename = File.join('c:', 'program files (x86)', 'cutmaster', 'cutmaster.exe')

      File.file?(filename) returns true and yes the file exists
      spawn(filename) gives me the error 'No such File or Directory'

      If I install the program somewhere else then it spawns.
      However, if I use the old DOS subst command then it will spawn just fine.

      subst y: 'c:\program files (x86)\cutmaster'

      I've tried to run the subst command from within ruby but can't seem to do it.

      cmd = 'subst'
      drive = 'c:'
      folder = File.join('c:', 'program files (x86)', 'cutmaster')
      #{cmd} #{drive} "#{folder}"

      Has anyone any success doing this sort of thing?

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        Try something like:
        cmd = "\"#{filename}\"" spawn(cmd)
        It needs enclosing "", since the string contains spaces...
        Where filename needs to be the full path to the exe file.

        TIG

        1 Reply Last reply Reply Quote 0
        • G Offline
          Garry K
          last edited by

          Of course !! Thanks Tig

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post
          Buy SketchPlus
          Buy SUbD
          Buy WrapR
          Buy eBook
          Buy Modelur
          Buy Vertex Tools
          Buy SketchCuisine
          Buy FormFonts

          Advertisement