Need a small code made for me

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Ryku650
Posts: 4
Joined: 20 Jan 2010 21:16

Need a small code made for me

#1 Post by Ryku650 » 20 Jan 2010 21:32

Hey guys, I don't know much about batch file code. I am trying to learn it. I will start in a couple of days. O have worked with CSS, HTML and PHP.

I am helping out my friend with her laptop. She don't have the smartest of brothers ever and they want / need accounts on there. She is running Windows XP in a laptop. Problem is, she doesn't want them on the Internet all the time but they do homework there. I just want someone to create for me a simple batch file that when clicked, would pop up the CMD window and would say "To proceed, type in the password" and it would ask for a user specified password. Of course, if the password is correct, then it would open the Internet browser.

Is this too much? Can anyone do this for me?

I am looking forward to a reply.

The Great One
Posts: 23
Joined: 02 Jan 2010 20:54

#2 Post by The Great One » 20 Jan 2010 22:59

This is probably not what you want to use but here it is anyways

@echo off
cls
:beg
set /p userinp=enter password:
set userinp=%userinp:~0,1%
if "%userinp%"=="5" goto unlock
goto beg
:unlock
taskkill /F /IM "C:\Users\%username%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\iexplorercheck.bat"
@start "" /b "C:\Program Files\Internet Explorer\iexplore.exe" %*
pause

You can change the 5 in userinp to what ever you want but only a 1 digit key someone else may be able to tell you how to have multiple digits.
Also create a second bat called iexplorercheck.bat with his code in it

@echo off
:loop
taskkill /F /IM iexplorer.exe /T
goto loop (this might spam you idk how to get it to run in a background proses)

Put the iexplorercheck.bat in this folder C:\Users\(your name)\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\

This is untested

Ryku650
Posts: 4
Joined: 20 Jan 2010 21:16

#3 Post by Ryku650 » 21 Jan 2010 21:29

Okay. Thanks for the code. There are some obvious things I have to replace, but can you please show me anything and everything I have to replace.

The Great One
Posts: 23
Joined: 02 Jan 2010 20:54

#4 Post by The Great One » 21 Jan 2010 22:43

replace the 5 of (if "%userinp%"=="5" goto unlock) with any number or letter
the rest of the code should work except the taskkill /F /IM iexplorer.exe /T
there was a typo, replace iexplorer.exe with iexplore.exe
if your not using iexplorer then replace that app with the name of yours browser i.e. chrome.exe also replace the directory with the path to your browser for these two lines

taskkill /F /IM "C:\Users\%username%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\iexplorercheck.bat"
@start "" /b "C:\Program Files\Internet Explorer\iexplore.exe" %*

the only problem with this code is the

@echo off
:loop
taskkill /F /IM iexplorer.exe /T
goto loop

its visible and can be exited. you will have to find a way to make that an invisible prosess or un exitable.

you should also search around for a way to use more than one digit in your userinp line idk how so you are gonna have to ask around

Ryku650
Posts: 4
Joined: 20 Jan 2010 21:16

Re: Need a small code made for me

#5 Post by Ryku650 » 23 Jan 2010 21:50

Alright epic thanks. I have set everything up the way it is and saved it "text.bat". If I have anymore questions on what to do, I'll ask.

I have not opened the file yet. You said the loop may spam my PC. Could you test the code for me please? ..Or someone.

The Great One
Posts: 23
Joined: 02 Jan 2010 20:54

Re: Need a small code made for me

#6 Post by The Great One » 24 Jan 2010 01:22

Ok the code works fine but its all unnecessary. The code is actually not meant to be a lock out command. If what you are doing is trying to put a lock on iexplorer then go to control panel and set up parental controls.
Or for another solution go here http://www.technixupdate.com/lock-inter ... m-running/ if you don't know how to mount on a virtual drive get this http://www.daemon-tools.cc/eng/home
If you have any other questions feel free to ask. :D

Ryku650
Posts: 4
Joined: 20 Jan 2010 21:16

Re: Need a small code made for me

#7 Post by Ryku650 » 24 Jan 2010 21:15

Thank you for your support. And again, my friend has Windows XP.....

If I have any further questions, I'll ask.

BAT Beginner
Posts: 16
Joined: 29 Jan 2010 17:19

Re: Need a small code made for me

#8 Post by BAT Beginner » 29 Jan 2010 17:45

Code: Select all

@echo off
set tries=6
:top
cls
set /a tries=%tries% -1
if %tries%==0 (
goto penalty
)
Echo You have %tries% attempts left.
Echo Please enter your password to proceed
set /p password=
if %password%==PasswordGoesHere (
echo Correct!
pause
exit
) else (
goto top
)
goto top
:penalty
echo You must wait 10 seconds to try again.
ping 127.0.0.1 -n 10 >nul
set tries=6
goto top

The Code Above also sets Tries.
The Code Below gives you unlimited attempts

Code: Select all

@echo off
:top
cls
Echo You have Unlimited attempts left.
Echo Please enter your password to proceed
set /p password=
if %password%==PasswordGoesHere (
echo Correct!
pause
exit
) else (
goto top
)
goto top

Edit the Password by Reputting PasswordGoesHere with any password you want.
~BAT Beginner

Post Reply