Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
Knighter
- Posts: 8
- Joined: 24 Jan 2014 15:52
#1
Post
by Knighter » 24 Jan 2014 18:37
Hello !! I have a problem , how i can verify account's password login and if someone wrong the password login delete the file in C:\Users\XXX\pollo.txt ?
Thanks for the help

-
Knighter
- Posts: 8
- Joined: 24 Jan 2014 15:52
#3
Post
by Knighter » 25 Jan 2014 06:41
Hi !!

i have done only the delete command ( del C:\Users\Desktop\pollo.txt ) but i think how i can do the verify ,
if net user XXX password
if [NOT] password==hello
if DEFINE password==hello
but these are wrong :/
it's possible to make in dos ?
-
foxidrive
- Expert
- Posts: 6031
- Joined: 10 Feb 2012 02:20
#4
Post
by foxidrive » 25 Jan 2014 07:10
You wrote net user and I'm wondering: are you are referring to the password when someone tries to log onto the account when Windows starts up?
-
Squashman
- Expert
- Posts: 4488
- Joined: 23 Dec 2011 13:59
#5
Post
by Squashman » 25 Jan 2014 07:11
You cannot verify a users Windows password like that. The passwords are encrypted in the sam database.
-
Knighter
- Posts: 8
- Joined: 24 Jan 2014 15:52
#7
Post
by Knighter » 25 Jan 2014 09:33
Yes foxi i referring to the password when someone tries to log onto the account when Windows starts up
Squash i tries the Auth tools , in cmd the command Usage: Auth.exe /d:dom /u:uid /p:pwd auth /?
but when i write auth /u:XXX the message is :
Auth V01.01.00cpp Joe Richards August 2001
Usage: Auth.exe /d:dom /u:uid /p:pwd
-
Squashman
- Expert
- Posts: 4488
- Joined: 23 Dec 2011 13:59
#8
Post
by Squashman » 25 Jan 2014 10:12
You need to supply the computer name, username and password.
-
Squashman
- Expert
- Posts: 4488
- Joined: 23 Dec 2011 13:59
#9
Post
by Squashman » 25 Jan 2014 10:21
Code: Select all
C:\Batch>auth /d:%computername% /u:Squashman /p:CorrectPassword
Auth V01.01.00cpp Joe Richards (joe@joeware.net) August 2001
Authenticating COCO\Squashman
Logon Successful.
C:\Batch>auth /d:%computername% /u:Squashman /p:WrongPassword
Auth V01.01.00cpp Joe Richards (joe@joeware.net) August 2001
Authenticating COCO\Squashman
Logon failure: unknown user name or bad password.
-
Knighter
- Posts: 8
- Joined: 24 Jan 2014 15:52
#10
Post
by Knighter » 25 Jan 2014 15:08
Ok it's work : Logon Successfull
but how i can use it for my scope ? xD
if auth /d:XX /u:XX /p:hello
del C:\Users\XX\Desktop\pollo.txt
Mmmm no dont work xD
-
Squashman
- Expert
- Posts: 4488
- Joined: 23 Dec 2011 13:59
#11
Post
by Squashman » 25 Jan 2014 15:27
A couple of options but I think the easiest would be checking the errorlevel.
Code: Select all
C:\Batch>auth /d:%computername% /u:Squashman /p:CorrectPassword >nul 2>&1
C:\Batch>echo %errorlevel%
1
C:\Batch>auth /d:%computername% /u:Squashman /p:WrongPassword >nul 2>&1
C:\Batch>echo %errorlevel%
0
-
Knighter
- Posts: 8
- Joined: 24 Jan 2014 15:52
#12
Post
by Knighter » 25 Jan 2014 16:39
But the error level would create when the bath file are start and are ever 1
cd C:\Users\XX\Desktop\ auth /d:%XX% /u:XX /p:hello >nul 2>&1
echo %errorlevel%
cd C:\Users\XX\Desktop\ auth /d:%XX% /u:XX /p:help >nul 2>&1
echo %errorlevel%
if ERRORLEVEL 1 GOTO End
:Error
del C:\Users\XX\Desktop\pollo.txt
:End
pause
in this mode if i insert the wrong password at login the pollo.txt file aren't deleted because the command "auth /d:%XX% /u:XX /p:hello" return errorlevel = 1
-
Squashman
- Expert
- Posts: 4488
- Joined: 23 Dec 2011 13:59
#13
Post
by Squashman » 25 Jan 2014 17:24
I was giving you examples of what the errorlevel is when the command is sucessfull and when it is not successful. You dont need to run it twice in you batch file.
-
Knighter
- Posts: 8
- Joined: 24 Jan 2014 15:52
#14
Post
by Knighter » 25 Jan 2014 17:40
Ok , but what i do ?
if i use only one ( this ) , the error level are 1 and goto end
cd C:\Users\XX\Desktop\ auth /d:%XX% /u:XX /p:hello >nul 2>&1
if ERRORLEVEL 1 GOTO End
:Error
del C:\Users\XX\Desktop\pollo.txt
:End
pause
and if i use only one ( this ) , delete the file
cd C:\Users\XX\Desktop\ auth /d:%XX% /u:XX /p:help >nul 2>&1
if ERRORLEVEL 1 GOTO End
:Error
del C:\Users\XX\Desktop\pollo.txt
:End
pause
i dont undestand how i can apply to login, the user enter the correct password ( in login windows ) ? ok , do nothing
the user enter the wrong password ? ok , delete the file
how i can apply this ?
-
Squashman
- Expert
- Posts: 4488
- Joined: 23 Dec 2011 13:59
#15
Post
by Squashman » 25 Jan 2014 17:55
You cant apply this to the Windows login screen. There is no way to capture the password they typed in to the Windows Login screen and pass it to the batch file. If they cant login how do you expect a file to be deleted?