Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Running A Two-Step Program From A Batch File

46 views
Skip to first unread message

Phillip Galey

unread,
Nov 20, 2003, 1:48:18 PM11/20/03
to
If you want to run a program from a batch file that requires two entries,
e.g. the program command line and then a password like with RUNAS in Windows
2000, is there a way of doing that? RUNAS was interestingly designed to be
run as a two step process and does not allow the password to be included in
the command line.

If I do the following in a batch file, it still stops and asks me for the
password:
--------------------------------------------------
RUNAS /profile /user:MyDomain\MyUsername "xcopy c:\myfile.txt c:\elsewhere"
MyPassword
--------------------------------------------------

Is there a way of automatically taking care of RUNAS's request for the
password? Thanks.

Phil


Ray at <%=sLocation%>

unread,
Nov 20, 2003, 2:26:02 PM11/20/03
to
I believe runas is like this by design. SU.exe from the Resource Kit is a
similar tool, but includes the functionality to pass a password as an
argument.

Ray at work

"Phillip Galey" <pga...@starcalif.com> wrote in message
news:OYFdeb5r...@TK2MSFTNGP11.phx.gbl...

Matthias Tacke

unread,
Nov 20, 2003, 2:27:10 PM11/20/03
to
"Phillip Galey" wrote:

Ritchie Lawrence has done a fine job with his program sanur:

http://commandline.co.uk/sanur/index.html

hth
--
Greetings
Matthias________________________________________
For help on nt commands enter in a cmd window:
W2K>HH windows.chm::ntcmds.htm XP>HH ntcmds.chm

Torgeir Bakken (MVP)

unread,
Nov 20, 2003, 9:04:51 PM11/20/03
to
Phillip Galey wrote:

> Is there a way of automatically taking care of RUNAS's request for the
> password?

Hi

Some options that might work for you:


If it doesn't matter if the password is in clear text:

Sanur Commandline Runas Automation Utility (free)
http://www.commandline.co.uk/sanur/

CPAU on the free win32 c++ tools page of
http://www.joeware.net


if it does:

Some 3rd party RunAs solutions that "hides" (encrypt) username/password
are listed in the link below (buy solutions). Can be run from network shares,
so nothing needs to be installed on the client computers.

http://groups.google.com/groups?selm=3E272913.27CBE26D%40hydro.com


And from a recent post by Peter M.:

<quote>
I am currently using AutoIt V3 (http://www.hiddensoft.com/autoit3/)
It includes a command to run a command as a special user. You can
write a simple script and then compile it with autoit as an executable.
Protect this executable with a password and you are done.

AutoIt V3 ist still beta and under development, but the actual version
is stable and the functions you need (runasadmin,regwrite...) are
already implemented and working.
</quote>


--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter


0 new messages