I am trying to combine multiple batch scripts into one large batch script from which I can preform individual tasks. My idea is to have a line saying to type a # for a certain task. (EX: To clean your system press 1, to go to a plain command prompt press 2, ect.) If there are any scripts that you think would be a nice addition, let me know. So far, I can delete thumbs.db files, Hide/protect a folder, and exit.
Things to do:
-Find way to clear text in script
-Have blank DOS box open in same window instead of new one
Scripts I'd like
-More clean-up scripts
Thank you m2 for setting me in the right direction
You got some errors.
Menu was totally wrong. Typo: %imput%. After deleting thumbs.db you should goto somewhere, because otherwise you end up protecting folder.
cls
@ECHO OFF
:Menu
ECHO To clean up your system type 1:
ECHO To protect your folder type 2:
ECHO To quit type 3:
set /p input=
If %input%==1 goto 1
If %input%==2 goto PROTECT
If %input%==3 goto End
ECHO Incorrect selection
goto Menu
:1
DEL /F /S /Q /A:H Thumbs.db
goto Menu
:PROTECT
title Folder Personal
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST Personal goto MDLOCKER
:CONFIRM
echo Are you sure u want to Lock the folder(Y/N)
set/p "cho=>"
if %cho%==Y goto LOCK
if %cho%==y goto LOCK
if %cho%==n goto END
if %cho%==N goto END
echo Invalid choice.
goto CONFIRM
:LOCK
ren Personal "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
echo Folder locked
goto End
:UNLOCK
echo Enter password to Unlock folder
set/p "pass=>"
if NOT %pass%==secure goto FAIL
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Personal
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
goto end
:MDLOCKER
md Personal
echo Personal created successfully
goto Menu
goto End
:End
"Those people who think they know everything are a great annoyance to those of us who do." Asimov
I was going to send it back to the menu with a script later. I know practically no batch/DOS, so I was only basing this off a password script, and those two scripts. Thank you very much for the suggestions. So I need to write the text before the password entry. Also, nice Idea for menu, as when I got more commands, I wanted menus. I knew how to start them, but not repeat them. Thanks! Also, I don't thing the imput matters too much, as password entry still worked, and I had at one point, a password fior the end of clean up %choice1%. I was wondering though, what is echo? Also, can I have a script for a blank command prompt without opening a new window?
Simplifying daily life through technology
Echo prints a message on the screen. Such as
ECHO Hello World
will print:
Hello World
on the screen when executed.
ECHO.
is an empty line.@ECHO OFF
turns off displaying executed commands.Blank command prompt?
start "" %comspec%
"Those people who think they know everything are a great annoyance to those of us who do." Asimov
I see now. Also, for the blank command prompt. Although. I was hoping not to leave the old prompt, so it could be like "Type 9 to return to the menu" or something. Is this possible? Also, is there a way to make it so the commands register without needing to hit enter? And can you clear all text on a screen before moving on to a new command/redirect?
Simplifying daily life through technology
Although. I was hoping not to leave the old prompt, so it could be like "Type 9 to return to the menu" or something. Is this possible?
I'm not sure, but probably not.
You can open a blank prompt in a new window instead.
Just remove the start command, so you execute
%COMSPEC%
Also, is there a way to make it so the commands register without needing to hit enter?
No.
And can you clear all text on a screen before moving on to a new command/redirect?
cls
"Those people who think they know everything are a great annoyance to those of us who do." Asimov
The /P switch for set requires command extensions, which may not be enabled on every machine you encounter. I avoided it in my project for that reason. Just FYI.
Vintage!