Sorry but i am not familiar with stackoverflow, so i can't make it that understandable, but i hope that this is enough.
First of all, you have lots of errors handling variables and the idea with a password is quite good, but impractical. Batch was not made for that. I teach software security and pentesting classes and literally have a similar script for students to crack their password. Not to mention that you will have many problems with deleting and recovering files, and the user does not need to go through your program to do what you want, in addition to being extremely practical using the common trash. Excellent idea, I can help you with this if you want without price, but I don't think it would be so useful outside of handling content in a preferential, casual and personal way.
Well, the first mistake in your script was not giving spaces between the desktop.ini codes and not correctly assigning values to it with attrib, probably not using the correct trash can icon code either.
The Windows have some bugs with the desktop.ini file and a big delay, but here is what you need to do:
@echo off
set "var=%cd%"
if not EXIST trash goto create
if EXIST trash goto exists
:create
mkdir trash
set katorn=%random%
md "%temp%\%katorn%"
:: As we can see bellow, SHELL32.dll,31 means empty trash ico, SHELL32.dll,32 means full trash ico.
(
echo [.ShellClassInfo]
echo IconResource=C:\Windows\system32\SHELL32.dll,31
echo [ViewState]
echo Mode=
echo Vid=
echo FolderType=Generic
)>"%temp%\%katorn%\desktop.ini"
attrib +S +H "%temp%\%katorn%\desktop.ini"
del /q /f /s "%var%\trash\desktop.in*"
move "%temp%\%katorn%\desktop.ini" "%var%\trash"
rd /s /q "%temp%\%katorn%"
attrib +r +s %var%\trash
goto end
:exists
echo Would you like to delete the files inside of the trash? (y/n)
set /p YESNO=" "
if not %YESNO%==y goto end
if %YESNO%==y goto check
:check
echo Please state the correct password
set /p PASSWORD=" "
if %PASSWORD%==1243 del trash\*.* /s /f /q
goto end
:end
You can also insert a VBScript to make shortcuts and then insert icons.
Set WshShell = CreateObject ("Wscript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop")
Set Shortcut = WshShell.CreateShortcut(strDesktop + "\ShortcutName.lnk")
Shortcut.WindowStyle = "4"
Shortcut.IconLocation = "X:\ICoLOcation\icon.ico"
Shortcut.TargetPath = "ProgramToBeOpened\program.exe"
Shortcut.Save
You can use a batch to write and execute the script.
@echo off
:loop
set /p "schname=Shortcut name: "
set /p "schlocation=Shortcut Location: "
set /p "schdestination=Shortcut Destination: "
set /p "schicon=Icon Location: "
set "schname=%schname:"=%"
set "schlocation=%schlocation:"=%"
set "schdestination=%schdestination:"=%"
set "schicon=%schicon:"=%"
echo >>"%temp%\shortcut.vbs" Set WshShell = CreateObject ("Wscript.Shell")
echo >>"%temp%\shortcut.vbs" strDesktop = "%schdestination%"
echo >>"%temp%\shortcut.vbs" Set Shortcut = WshShell.CreateShortcut(strDesktop + "\%shcname%.lnk")
echo >>"%temp%\shortcut.vbs" Shortcut.WindowStyle = "4"
echo >>"%temp%\shortcut.vbs" Shortcut.IconLocation = "%schicon%"
echo >>"%temp%\shortcut.vbs" Shortcut.TargetPath = "%schlocation%"
echo >>"%temp%\shortcut.vbs" Shortcut.Save
cscript "%temp%\shortcut.vbs"
del /q /f "%temp%\shortcut.vbs"
goto loop
Hope this helps,
K.