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

    • I want to like ^^ this ^^ twice 😛
    • No, it doesn't, but I'm sure you don't just mean compile when you say compile.
    • Wine is a translation layer, not an emulator. And there are many cases where performance is worse or BETTER under Proton, it really depends on the game in question.
    • ImgDrive 2.2.3 by Razvan Serea ImgDrive is a CD/DVD/BD emulator - a tool that allows you to mount optical disc images by simply clicking on them in Windows Explorer. If you have downloaded an ISO image and want to use it without burning it to a blank disc, ImgDrive is the easiest way to do it. ImgDrive features: One-click mounting of iso, cue, nrg, mds/mdf, ccd, isz images Runs on 32-bit and 64-bit Windows versions Mount ape, flac, m4a, wav, wavpack, tta file as AUDIO CD (16-bit/44.1kHz) Mount a folder as DVD/BD Mount images in command line Does not require rebooting after installation Support up to 7 virtual drives at the same time Support multi session disc image (ccd/mds/nrg) A special portable version is available Translated to more than 10 languages ImgDrive is freeware, you may use it at no cost Support File Type: .ccd - CloneCD image files .cue - Cue sheets files of ape/flac/m4a/tta/wav/wv/bin .iso - Standard ISO image files .isz - Compressed ISO image files .nrg - Nero image files .mds - Media descriptor image files ImgDrive 2.2.3 changelog: Some minor changes and improvements Download: ImgDrive 2.2.3 | 701 KB (Freeware, paid upgrade available) Download: ImgDrive Portable 547 KB View: ImgDrive Home Page | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
  • Recent Achievements

    • One Month Later
      VAT Services in UAE earned a badge
      One Month Later
    • First Post
      LsDmT earned a badge
      First Post
    • One Month Later
      evershinefacilityservice earned a badge
      One Month Later
    • Week One Done
      evershinefacilityservice earned a badge
      Week One Done
    • One Month Later
      POR2GAL4EVER earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      571
    2. 2
      ATLien_0
      253
    3. 3
      +Edouard
      162
    4. 4
      +FloatingFatMan
      151
    5. 5
      Michael Scrip
      110
  • Tell a friend

    Love Neowin? Tell a friend!