Jump to content

Sending arguments to a running executable?


Recommended Posts

One of my projects (RunAs Admin) allows administrators to run programs w/admin rights. What I'm looking to do is to add functionality that will allow you to run any file by Right-click > SendTo my running RunAs Admin program and if it's running, have it kick off the given file w/admin rights.

The easiest way I can think to do this is to add a shorcut in the SendTo folder to my RunAs Admin program BUT that attempts to run another copy of my already running program. Is the only way to accomplish what I'm looking to do through TCP sockets? And if that's the case, it sounds like I'll need to point the shortcut to a separate executable that opens a TCP socket to my running app and then pass the filename through the connection?

If I'm overthinking this, please let me know -- I'd love a simpler way to accomplish this. TIA.

thepip3r

My Additions:- RunAs AdminDeviant Fun:- Variable Sound Volume

Link to comment
Share on other sites

One of my projects (RunAs Admin) allows administrators to run programs w/admin rights. What I'm looking to do is to add functionality that will allow you to run any file by Right-click > SendTo my running RunAs Admin program and if it's running, have it kick off the given file w/admin rights.

The easiest way I can think to do this is to add a shorcut in the SendTo folder to my RunAs Admin program BUT that attempts to run another copy of my already running program. Is the only way to accomplish what I'm looking to do through TCP sockets? And if that's the case, it sounds like I'll need to point the shortcut to a separate executable that opens a TCP socket to my running app and then pass the filename through the connection?

If I'm overthinking this, please let me know -- I'd love a simpler way to accomplish this. TIA.

thepip3r

My approach would be to detect that there's another instance, then send it the parameters using a message, say WM_COPYDATA, then close, otherwise continue as before. ChrisL's udf in example scripts might help here.
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

@martin - thanx, i look into that before I try TCP sockets.

@weaponx - yes.. xp has an atrociously hard RunAs ability (when compared to competitors like Unix/Linux). My program is not so much an alternative runAs, it's more like a program shortcut aggregator. Ultimately using Windows process inheritance, you would use Microsoft's "runas" utility to kick off my executable, then anything run from within my program is run with admin rights (ie Control Panel for Add/Remove Programs, etc) and where I'm going with this post is with my program running (with admin rights) add a shortcut to the sendTo menu that would pass a path to my running executable so that when my program is running, you can simply right-click > Send to my program and it will kcik off that program (through mine) running it with admin rights. make sense?

My Additions:- RunAs AdminDeviant Fun:- Variable Sound Volume

Link to comment
Share on other sites

well the program is only running when the logged-on-user kicks it off w/an account that has admin rights to the local machine and/or domain. and yes, they can use my program to navigate to any file and run it... i'm just trying to further simplify the process by allowing the user to right-click any file and just select soething like, "Run as w/RunAs Admin" and it will auto run the program without having to navigate to the file through the File Dialogue box. I know, it may sound trivial. I'm just not getting much feedback on the project so I'm trying to think of ways that would make it more functional. The project is in my sig if you want to look at it WeaponX. =P

My Additions:- RunAs AdminDeviant Fun:- Variable Sound Volume

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...