PC Review


Reply
Thread Tools Rate Thread

add to Runas command

 
 
Mint
Guest
Posts: n/a
 
      1st Jun 2010
I tried adding some more functionality to the batch file below with no
success.
Is there a way that I can add to this batch file?

For example, color 1f and loading some macros would be great too.

Thanks.

runas.exe /user:Administrator cmd.exe
 
Reply With Quote
 
 
 
 
Tim Meddick
Guest
Posts: n/a
 
      2nd Jun 2010
Below is an example batch file (incorporating the command you quoted ) I
have working on my system to add some helpful stuff to a new "cmd"
window....

*NB Make sure the batch-file is named ADMCMD.BAT and is in the system's
"path" (i.e.; in a folder included in the PATH variable, usually C:\WINDOWS
is one) and that the file containing the macros is named ADMIN.MAC and is
[also] placed in C:\WINDOWS.


ADMCMD.BAT
------------------- copy between lines -(start)------------------

@echo off
if %1]==start] goto BATCH
runas.exe /user:Administrator cmd.exe /k call admcmd.bat start
goto :EOF

:BATCH
SET DIRCMD=/A /O /P /X
PATH=%path%;C:\WINDOWS\COMMAND
DOSKEY /INSERT /MACROFILE=C:\WINDOWS\ADMIN.MAC
COLOR 0B
CLS
VER
echo.

------------------- copy between lines -(end)-------------------

The first line "@echo off" prevents the commands from being displayed
[echoed] on the screen as they are executed and the "@" prevents that
command itself from being displayed.

The next couple of lines incorporate your command to start a cmd.exe window
with ADMIN credentials and also points it back to the starting batch-file
again to run the other commands from the line labelled "BATCH". You can
use the "goto LABEL" command to jump to another part of the batch-file
beginning with a colon followed by a chosen word i.e.; :LABEL
The "goto :EOF" line is different, as you don't normally use the colon *in*
the goto command and the line-label :EOF does not exist. This special form
of the "goto" command means : "goto [E]nd [O]f [F]ile"

The SET command can be used to set an environment variable that can be
recalled in various ways and in this case is used by the DIR command to set
chosen "switches" that will be applied automatically when set in the DIRCMD
variable. You can display a list of environment variables currently set,
by typing the SET command with no parameters.

The COLOR command changes the default text color to cyan-on-black (my
personal favourite). Some doskey macros (see next item) can be set to
simply change the text color by typing such as "red", "blue" and "green".

The DOSKEY command is for a command-line editor program that allows you to
use the up / down left /right arrow keys to modify past typed commands.
This allows you to change a small part of a large command or repeat a
command often used to save time in both cases. It also points doskey to
the file: ADMIN.MAC is a file which contains doskey command-line macros, a
sample of which is reproduced below :

ADMIN.MAC
------------------- copy between lines -(start)------------------

maced=edit C:\WINDOWS\ADMIN.MAC
macm=DOSKEY /MACROS
macf=DOSKEY.EXE /MACROFILE=C:WINDOWS\ADMIN.MAC
c=cls
q=exit
red=color 0C
blue=color 09
green=color 0A
cyan=color 0B
cmdhelp=hh.exe ntcmds.chm::/ntcmds.htm

------------------- copy between lines -(end)-------------------

For a list of commands for use with the "command-line" (that is; in a
"dos-box") type the following into the "Run" box on the Start Menu :

hh.exe ntcmds.chm::/ntcmds.htm

==

Cheers, Tim Meddick, Peckham, London. :-)




"Mint" <(E-Mail Removed)> wrote in message
news:78ea8389-c926-4b19-be77-(E-Mail Removed)...
>I tried adding some more functionality to the batch file below with no
> success.
> Is there a way that I can add to this batch file?
>
> For example, color 1f and loading some macros would be great too.
>
> Thanks.
>
> runas.exe /user:Administrator cmd.exe


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RUNAS Command XP Dave Leonardi Windows XP General 7 15th Mar 2005 05:58 PM
Re: RunAs command Torgeir Bakken \(MVP\) Windows XP Customization 0 15th Sep 2004 10:04 PM
RUNAS command Mario Windows XP General 6 9th Jul 2004 07:10 PM
RUNAS command Garry Drinkall Microsoft Windows 2000 CMD Promt 2 2nd Apr 2004 05:44 PM
runas dos command Steve Majot Microsoft Windows 2000 CMD Promt 6 29th Oct 2003 08:57 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:37 AM.