change user
Moderator: DosItHelp
change user
I am new to batch files. Just learning. I want to write a batch file to change my password. I know If I goto the start and go to ass and right click on command prompt and click runas administrator. I know how to change It than. I would like to know how to go to the administrator account with the batch file? For example I am In my account and want to go to the Administrator account with batch file. I also don't want the box to pop up.
-
- Posts: 233
- Joined: 21 Nov 2010 08:07
- Location: At My Computer
Re: change user
==To Change Administrator Password==
net user Administrator <password>
see script example below using "dostips" as password then log-off and backon with new pw.
You could use vbs script also to prompt you for password and do the same thing, without having to go in and type in a new password each time.
net user Administrator <password>
see script example below using "dostips" as password then log-off and backon with new pw.
You could use vbs script also to prompt you for password and do the same thing, without having to go in and type in a new password each time.
Code: Select all
@echo off
::CHANGE ADMIN PW ON THE FLY-NO CONSOLE CONFIRMATION::
::Change PW::
net user Administrator dostips>nul
::Logoff and backon with new password::
Shutdown -L
Re: change user
'
One possible solution would be for your script to re-spawn itself using the runAs command to gain the required privileges.
I must add to say that hard-coding passwords in scripts is a security risk but, an encryption tool should be easy enough to get your hands on.
That will only work if the script already has elevated privileges.Dos_Probie wrote:Code: Select all
net user Administrator dostips>nul
One possible solution would be for your script to re-spawn itself using the runAs command to gain the required privileges.
Code: Select all
runAs /?
-
- Posts: 233
- Joined: 21 Nov 2010 08:07
- Location: At My Computer
Re: change user
For elevated privileges you can always use:
For specific file:
takeown /f "%systemroot%\pw.cmd"
icacls "%systemroot%\pw.cmd" %* /grant :r administrators:(OI)(CI)F:
Or just add the right-click "Run as Administrator" to your context menu.
http://www.davescomputertips.com/wp-con ... ership.txt

Code: Select all
::disable uac and supress prompt::
reg add "hklm\software\microsoft\windows\currentversion\policies\system" /v enableLUA /t REG_DWORD /d 0 /f
reg add "hklm\software\Wow6432Node\microsoft\windows\currentversion\policies\system" /v enableLUA /t REG_DWORD /d 0 /f
reg add "hklm\software\microsoft\windows\currentversion\policies\system" /v ConsentPromptBehaviorAdmin /t REG_DWORD /d 0 /f
reg add "hklm\software\Wow6432Node\microsoft\windows\currentversion\policies\system" /v ConsentPromptBehaviorAdmin /t REG_DWORD /d 0 /f
For specific file:
takeown /f "%systemroot%\pw.cmd"
icacls "%systemroot%\pw.cmd" %* /grant :r administrators:(OI)(CI)F:
Or just add the right-click "Run as Administrator" to your context menu.
http://www.davescomputertips.com/wp-con ... ership.txt