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

Run batch file from ruby as admistrator

Scheduled Pinned Locked Moved Developers' Forum
7 Posts 2 Posters 4.0k Views
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.
  • S Offline
    simonstaton
    last edited by 23 Jun 2010, 13:10

    Hi,

    I am running a batch file from ruby using:
    ge=UI.openURL(Sketchup.find_support_file('')+"/registergoogleearthcmd.cmd")

    inside the batch file is the following:
    "C:\Users\Simon\Documents\Action Design Your Own v2\Action 3D\client\googleearth.exe" /regserver

    however when I run sketchup and the batch file is loaded it says it needs to be run as administrator now this command works fine if I load up cmd as admin and manually typing it in it goes straight through.

    So my question is how can I run this from ruby as an administrator?

    Simon

    1 Reply Last reply Reply Quote 0
    • D Offline
      Dan Rathbun
      last edited by 23 Jun 2010, 13:23

      @simonstaton said:

      So my question is how can I run this from ruby as an administrator?

      What would be the point of having an Operating System Security if any script was allowed to run with Administrative Rights?

      Oh wait... I do remember MS-DOS ๐Ÿ˜†

      I'm not here much anymore.

      1 Reply Last reply Reply Quote 0
      • S Offline
        simonstaton
        last edited by 23 Jun 2010, 13:29

        hmm so there is no way of doing this? I have updated my script with the following:

        tmp_cmd="My_tmp_file_"+Time.now.to_i.to_s+".cmd"
        cmd_path="C;/Temp/"+tmp_cmd
        cmd_line="\""+Sketchup.find_support_file('')+"/client/googleearth.exe\" /regserver\nexit"
        cmd=File.new(cmd_path, "w")
        cmd.puts(cmd_line)
        cmd.close
        UI.openURL(cmd_path)
        sleep(1)
        File.delete(cmd_path)
        

        if I cant run as admin is there any other way or registering google earths location outside of its default through command line or ruby?

        Simon

        1 Reply Last reply Reply Quote 0
        • D Offline
          Dan Rathbun
          last edited by 23 Jun 2010, 13:32

          You'd need to use the runas.exe utility.
          It's in the Windows/system32 folder, so is available in the PATH.

          Open a CMD window, and type:
          %(#004000)[**runas /?**]
          for parameter information.

          For more info, do a search at MSDN

          I'm not here much anymore.

          1 Reply Last reply Reply Quote 0
          • S Offline
            simonstaton
            last edited by 23 Jun 2010, 13:34

            dont worry solved I just need to right click sketchup and run as administrator

            1 Reply Last reply Reply Quote 0
            • D Offline
              Dan Rathbun
              last edited by 23 Jun 2010, 13:40

              @simonstaton said:

              dont worry solved I just need to right click sketchup and run as administrator

              Manual? I could have told you that!

              You asked how to do it with a batchfile... ๐Ÿ˜’

              I'm not here much anymore.

              1 Reply Last reply Reply Quote 0
              • S Offline
                simonstaton
                last edited by 23 Jun 2010, 13:49

                yes I know, but that easiest solution slipped through my hands ๐Ÿ˜ฒ

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

                Advertisement