Recommended Posts

I know it isn't secure, but it is the best thing I have right now, so, here it goes...

I need to be able to run a file as an admin in a batch file (i.e. runas /u:Administrator "%blahblah%.exe").

The runas command built into Windows doesn't support this, but I know I've seen apps that do support this. Anyone know of any that are free?

Remember, the entire thing is command line. Thanks for the help :D

Link to comment
https://www.neowin.net/forum/topic/655262-command-line-runas-with-password/
Share on other sites

  Hurmoth said:
I know it isn't secure, but it is the best thing I have right now, so, here it goes...

I need to be able to run a file as an admin in a batch file (i.e. runas /u:Administrator "%blahblah%.exe").

The runas command built into Windows doesn't support this, but I know I've seen apps that do support this. Anyone know of any that are free?

Remember, the entire thing is command line. Thanks for the help :D

Hmm I dont have any free utilities. We use the program run as professional here and it does command line and batch file.

Is this what your looking for -- it allows password on the command line

http://www.softtreetech.com/24x7/archive/53.htm

Not sure if its free or not - but you can download from this page, and it seems to run just fine, etc.

edit: Here is some info you might be interested in as well

http://www.commandline.co.uk/sanur/

Free Runas Alternatives

* CPAU Runas alternative supporting encoded passwords.

* LSrunas/LSRunase Console based Runas alternatives, the latter supports encoded passwords.

* AutoIt (v3) Scripting language for automating the Windows GUI.

* SuperExec GUI that encrypts passwords using Windows cryptography API's

BTW the AutoIT would get my vote --- its a tool any admin should have access to.

  XgD said:
But if the other option is to have the password in plaintext in the batch file
But there were many options give than allow you to encode/encrypt the password so that its not plain text, or you could turn the batch into an exe so they can not clearly read the password, etc.

There are other ways to obscure the password in a batch file, /savecred is cut and dry the user can run anything they want without even knowing anything just click use saved credentials.

Off the top a simple method would be to just turn your batch file with the commands in it to a exe. XP comes with the tool IExpress that can do this.

Or you use one of the many free batch to exe converters out there, etc.. etc.

+Budman's right. AutoIt makes this easy (for XP anyway):

; Are we already admin?
If Not IsAdmin() Then
	RunAsSet($CmdLine[1],'' , $CmdLine[2])
	Run( $CmdLine[3]  )
	Exit
EndIf

Save this script as BatchRunAs.au3 (or whatever) and compile it to an executable with Aut2Exe. Then in the batch file just add the line

BatchRunAs.exe <Username> <Password> Command

If required the username, password and the program to be run can all be hard coded (change the CmdLine[] parameters in the above script), before converting to an exe.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Wow. The Verge live blogging it with paywall turned ON and as well as deleting my opinion about that aero style glassy design. 😵‍💫
    • Yeah it is like Aero Glass reborn! (which I loved) but I do not have any Apple devices.
    • Amazon to invest $20 billion in Pennsylvania for AI infrastructure, creating 1,250 jobs by Paul Hill The governor of Pennsylvania, Josh Shapiro, has announced that Amazon has agreed to invest at least $20 billion in AI infrastructure in the state. Shapiro noted that this is the largest-ever private sector investment in the state’s history and is set to create at least 1,250 high-paying, high-tech jobs, plus thousands of construction jobs to build the AWS data centers. The initial locations for the first two data centers are Salem Township in Luzerne County and Falls Township in Bucks County. The governor said that more sites were also under consideration, so this $20 billion figure could grow further. Aside from the obvious benefits for the locals, it also helps to keep America in a strong position in its AI race with China. Why Pennsylvania? The Shapiro administration's role “Pennsylvania is competing again – and I’m proud to announce that with Amazon’s commitment of at least $20 billion to build new state-of-the-art data center campuses across our Commonwealth, we have secured the largest private sector investment in the history of Pennsylvania,” said Governor Josh Shapiro. “This initial investment from Amazon will create thousands of good-paying, stable jobs as Pennsylvania workers build, maintain, and operate the first two data center campuses in Luzerne County and Bucks County. Our team worked closely with local leaders and Amazon to land this deal, and we continue to be actively engaged on securing additional sites in Pennsylvania – helping them secure local support, developing the infrastructure needed to support more data centers, and ensuring our permitting processes move quickly and efficiently. With this historic announcement, we’re creating opportunity for our workers, generating new revenue for our local communities, and ensuring the future of AI runs right through Pennsylvania.” Based on what Shapiro said, the state has tried quite hard to get Amazon to build there instead of somewhere else. States really have to put in effort to convince big tech, as other areas are also clamoring for businesses to set up there too. Back in 2021, we reported that Samsung had agreed to build its Taylor, Texas factory after the state made a tax break offer with the Korean company. The impact on jobs, communities, and the AI landscape Initially, Amazon will need thousands of construction workers to build the data centers and when this is done, it will be hiring 1,250 operators, technicians, and engineers to help manage the facilities - these jobs promise to be high-paying jobs. These jobs are also expected to drive up tax revenues, which will be positive for the state, counties, and municipalities. David Zapolsky, Amazon’s chief global affairs and legal officer, also said that the investments would create workforce development programs and community initiatives for the benefit of residents. It’s unclear from the announcement what form these will take.
  • Recent Achievements

    • Rookie
      CHUNWEI went up a rank
      Rookie
    • Enthusiast
      the420kid went up a rank
      Enthusiast
    • Conversation Starter
      NeoToad777 earned a badge
      Conversation Starter
    • Week One Done
      VicByrd earned a badge
      Week One Done
    • Reacting Well
      NeoToad777 earned a badge
      Reacting Well
  • Popular Contributors

    1. 1
      +primortal
      478
    2. 2
      +FloatingFatMan
      281
    3. 3
      ATLien_0
      254
    4. 4
      Edouard
      202
    5. 5
      snowy owl
      201
  • Tell a friend

    Love Neowin? Tell a friend!