Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

need a self executing batch file


  • Please log in to reply

#1
That_Thing

That_Thing

    New Member

  • Member
  • Pip
  • 2 posts
I am starting to work on a batch file that has to selfexecute. I am unsure of how to do this. The batch file that needs to selfexecute is a password protocol that protects my files in command prompt. The protocol works fine, it's just I need it to selfexecute when someone attempts to access it from command prompt. I am on windows xp right now, and I also have choice. This is what the security.bat looks like:
(The please copy and paste this. For Stewart the password is cakewalks. For tommy the password is ryalla. PLEASE!!! send reply with the entire source. It looks funny, but if you run it as is it looks perfectly normal)

@echo off
cls
set color 0a

:bof
cls

:content
color 0a
cls

:user
cls
echo.
echo _____________________________________
echo !_________Password Protocol______!^C!
echo ____________
echo Please select user: ! !
echo ~~~~~~~~~~~~
echo (1) Tommy
echo (2) Stewart
echo ____________
echo Please enter password: ! !
echo ~~~~~~~~~~~~
choice /c:12 /n
if errorlevel 2 set user=Stewart R
if errorlevel 2 set alias=Stewart
if errorlevel 2 goto password
if errorlevel 1 set user=Tommy
if errorlevel 1 set alias=Tommy

:password
cls
echo.
echo _____________________________________
echo !_________Password Protocol______!^C!
echo ____________
if %alias%==Tommy echo Please select user: !Tommy !
if %alias%==Stewart echo Please select user: !Stewart !
echo ~~~~~~~~~~~~
echo (1) Tommy
echo (2) Stewart
echo ____________
echo Please enter password: ! !
echo ~~~~~~~~~~~~
choice /c:abcdefghijklmnopqrstuvwxyz /n
set password=%errorlevel%
cls
echo.
echo _____________________________________
echo !_________Password Protocol______!^C!
echo ____________
if %alias%==Tommy echo Please select user: !Tommy !
if %alias%==Stewart echo Please select user: !Stewart !
echo ~~~~~~~~~~~~
echo (1) Tommy
echo (2) Stewart
echo ____________
echo Please enter password: !* !
echo ~~~~~~~~~~~~
choice /c:abcdefghijklmnopqrstuvwxyz /n
set password=%password%%errorlevel%
cls
echo.
echo _____________________________________
echo !_________Password Protocol______!^C!
echo ____________
if %alias%==Tommy echo Please select user: !Tommy !
if %alias%==Stewart echo Please select user: !Stewart !
echo ~~~~~~~~~~~~
echo (1) Tommy
echo (2) Stewart
echo ____________
echo Please enter password: !** !
echo ~~~~~~~~~~~~
choice /c:abcdefghijklmnopqrstuvwxyz /n
set password=%password%%errorlevel%
cls
echo.
echo _____________________________________
echo !_________Password Protocol______!^C!
echo ____________
if %alias%==Tommy echo Please select user: !Tommy !
if %alias%==Stewart echo Please select user: !Stewart !
echo ~~~~~~~~~~~~
echo (1) Tommy
echo (2) Stewart
echo ____________
echo Please enter password: !*** !
echo ~~~~~~~~~~~~
choice /c:abcdefghijklmnopqrstuvwxyz /n
set password=%password%%errorlevel%
cls
echo.
echo _____________________________________
echo !_________Password Protocol______!^C!
echo ____________
if %alias%==Tommy echo Please select user: !Tommy !
if %alias%==Stewart echo Please select user: !Stewart !
echo ~~~~~~~~~~~~
echo (1) Tommy
echo (2) Stewart
echo ____________
echo Please enter password: !**** !
echo ~~~~~~~~~~~~
choice /c:abcdefghijklmnopqrstuvwxyz /n
set password=%password%%errorlevel%
cls
echo.
echo _____________________________________
echo !_________Password Protocol______!^C!
echo ____________
if %alias%==Tommy echo Please select user: !Tommy !
if %alias%==Stewart echo Please select user: !Stewart !
echo ~~~~~~~~~~~~
echo (1) Tommy
echo (2) Stewart
echo ____________
echo Please enter password: !***** !
echo ~~~~~~~~~~~~
choice /c:abcdefghijklmnopqrstuvwxyz /n
set password=%password%%errorlevel%
if %alias%==Tommy goto verify
cls
echo.
echo _____________________________________
echo !_________Password Protocol______!^C!
echo ____________
if %alias%==Tommy echo Please select user: !Tommy !
if %alias%==Stewart echo Please select user: !Stewart !
echo ~~~~~~~~~~~~
echo (1) Tommy
echo (2) Stewart
echo ____________
echo Please enter password: !****** !
echo ~~~~~~~~~~~~
choice /c:abcdefghijklmnopqrstuvwxyz /n
set password=%password%%errorlevel%
cls
echo.
echo _____________________________________
echo !_________Password Protocol______!^C!
echo ____________
if %alias%==Tommy echo Please select user: !Tommy !
if %alias%==Stewart echo Please select user: !Stewart !
echo ~~~~~~~~~~~~
echo (1) Tommy
echo (2) Stewart
echo ____________
echo Please enter password: !******* !
echo ~~~~~~~~~~~~
choice /c:abcdefghijklmnopqrstuvwxyz /n
set password=%password%%errorlevel%
cls
echo.
echo _____________________________________
echo !_________Password Protocol______!^C!
echo ____________
if %alias%==Tommy echo Please select user: !Tommy !
if %alias%==Stewart echo Please select user: !Stewart !
echo ~~~~~~~~~~~~
echo (1) Tommy
echo (2) Stewart
echo ____________
echo Please enter password: !******** !
echo ~~~~~~~~~~~~
choice /c:abcdefghijklmnopqrstuvwxyz /n
set password=%password%%errorlevel%

:verify
cls
echo.
echo Verifying identity . . .
pause
if %alias%==Tommy set compare=1825112121
if %alias%==Stewart set compare=31115231121119
if not %compare%==%password% goto deny
if %compare%==%password% goto allow

:deny
color 0c
echo echo User name:%user% >> security.bat
echo echo Date:%date% >> security.bat
echo echo Time:%time% >> security.bat
echo echo Account:%computername% >> security.bat
echo echo Logon Server:%logonserver% >> security.bat
echo echo User Domain:%UserDomain% >> security.bat
echo echo Compuser:%username% >> security.bat
echo echo Access:Denied >> security.bat
echo echo ------------------------------------------------ >> security.bat
echo cls >> security.bat

cls
echo Access is Denied.
choice /c:ra /n Retry? Abort?
if errorlevel 2 exit
goto content

:allow
echo.
echo Identity confirmed.
echo %user%
echo Welcome, %alias%.
echo.
echo.
echo.
pause

:log setup
echo echo User name:%user% >> security.bat
echo echo Date:%date% >> security.bat
echo echo Time:%time% >> security.bat
echo echo Account:%computername% >> security.bat
echo echo Logon Server:%logonserver% >> security.bat
echo echo User Domain:%UserDomain% >> security.bat
echo echo Compuser:%username% >> security.bat
echo echo Access:Granted >> security.bat
echo echo ------------------------------------------------ >> security.bat
echo cls >> security.bat

:logfiles
echo The log files
echo -----------------------------------------------------------------------------

P.S. Please give suggestions on syntax effifiency

Edited by That_Thing, 06 June 2005 - 07:04 PM.

  • 0

Advertisements







Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP