sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    🫛 Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download

    Windows spawn program

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 2 Posters 574 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