Skip to content

Instantly share code, notes, and snippets.

Created June 15, 2017 18:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/10d256dcda4b9603c2c00fd6c1121f6f to your computer and use it in GitHub Desktop.
Save anonymous/10d256dcda4b9603c2c00fd6c1121f6f to your computer and use it in GitHub Desktop.
@echo off
title Cr‚‚ par Flammrock
color F0
setlocal enabledelayedexpansion
mode con lines=1 cols=40
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
if '%errorlevel%' NEQ '0' (
echo V‚rification des privileges administrateur
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
set params = %*:"="
echo UAC.ShellExecute "%~s0", "%params%", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B
TALK FSFSDF TALKFDBDTALK
:gotAdmin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
pushd "%CD%"
CD /D "%~dp0"
set width=150&set height=40&set /a mWidth=!width!/2
mode con lines=!height! cols=!width!
set batbox="%temp%\batbox.exe"
if not exist %batbox% call :MakeBatbox
set cls=call :cls
set offset=10
set txtExt=" /c 0xfc /d "[" /c 0xf0 /d "CLICK" /c 0xfc /d "]" /c 0xf0 /d "
set txtName=" /c 0xfc /d "[" /c 0xf0 /d "CLICK" /c 0xfc /d "]" /c 0xf0 /d "
set extLength=7
set ext=!txtExt!
set extLength=7
set ext=!txtExt!
set namemenuLength=7
set namemenu=!txtName!
call :header
%batbox% /g %offset% 11&call :loadingModule "-- Chargement " 20 1 command&pause
%cls%
call :main
pause>nul
exit
:header
set clsdata=
set /a clsall=150*28
%batbox% /g 1 39 /d "(C) Copyright 2017 - Flammrock"
%batbox% /g 10 9 /d "Si vous souhaitez enlever un "&set /p "..=‚"<nul&%batbox% /d "l"&set /p "..=‚"<nul&%batbox% /d "ment du sous-menu 'Nouveau' : PAS BESOIN DE REMPLIR LA 2eme ZONE DE TEXTE"
%batbox% /g 10 10 /d "[INFO] : '.' correspond aux fichiers sans extension tandis que '.bat' par exemple correspond aux fichiers s'ouvrant avec cmd.exe"
%batbox% /g 35 2 /d " ______ __ __ __ ____ _____ "
%batbox% /g 35 3 /d ".' ____ \ [ | [ | [ | |_ \|_ _| "
%batbox% /g 35 4 /d "| (___ \_| | |--. .---. | | | | | \ | | .---. _ _ __ "
%batbox% /g 35 5 /d " _.____`. | .-. |/ /__\\ | | | | | |\ \| | / /__\\[ \ [ \a [ ]"
%batbox% /g 35 6 /d "| \____) | | | | || \__., | | | | _| |_\ |_| \__., \ \/\ \/ / "
%batbox% /g 35 7 /d " \______.'[___]|__]'.__.'[___][___]|_____|\____|'.__.' \__/\__/ " /g 0 10
for /l %%a in (0,1,%clsall%) do set "clsdata=!clsdata! "
goto :eof
:main
%cls%
if not !extLength! EQU 0 (
set txtExt=!ext!
) else (
set extLength=7
)
if not !namemenuLength! EQU 0 (
set txtName=!namemenu!
) else (
set namemenuLength=7
)
set /a spaceExtnb=21-!extLength!
if !spaceExtnb! LSS 0 set spaceExtnb=0
set spaceExt=
set /a spaceNamenb=39-!namemenuLength!
if !spaceNamenb! LSS 0 set spaceNamenb=0
set spaceName=
for /l %%a in (0,1,!spaceExtnb!) do set "spaceExt=!spaceExt! "
for /l %%a in (0,1,!spaceNamenb!) do set "spaceName=!spaceName! "
%batbox% /g 60 12 /d " ---------------------------------------"
%batbox% /g 60 13 /d "| EXTENSION : !txtExt!!spaceExt!|"
%batbox% /g 60 14 /d " ---------------------------------------"
%batbox% /g 30 15 /d " ---------------------------------------------------------------------"
%batbox% /g 30 16 /d "| NOM DANS LE SOUS MENU : !txtName!!spaceName!|"
%batbox% /g 30 17 /d " ---------------------------------------------------------------------"
call :drawBTN
:loop_1
for /f "tokens=1,2,3 delims=:" %%a in ('%batBox% /m') do (
set x=%%a
set y=%%b
)
if !x! GEQ 60 if !x! LEQ 100 if !y! EQU 13 (
call :ExtFile
goto :main
)
if !x! GEQ 30 if !x! LEQ 100 if !y! EQU 16 (
call :NameMenu
goto :main
)
if !x! GEQ 58 if !x! LEQ 78 if !y! GEQ 20 if !y! LEQ 22 (
call :removenew
goto :main
)
if !x! GEQ 80 if !x! LEQ 100 if !y! GEQ 20 if !y! LEQ 22 (
call :addnew
goto :main
)
goto :loop_1
:end_loop_1
goto :eof
:ExtFile
%cls%
call :drawBTN
%batbox% /g 60 12 /d " ---------------------------------------"
%batbox% /g 60 13 /d "| EXTENSION : |"
%batbox% /g 60 14 /d " ---------------------------------------"
%batbox% /g 30 15 /d " ---------------------------------------------------------------------"
%batbox% /g 30 16 /d "| NOM DANS LE SOUS MENU : " /c 0xfc /d "[" /c 0xf0 /d "IMPOSSIBLE CLICK" /c 0xfc /d "]" /c 0xf0 /d " |"
%batbox% /g 30 17 /d " ---------------------------------------------------------------------" /g 78 13
set /p ext=
call :length "!ext!"
set extLength=!length!
goto :eof
:NameMenu
%cls%
call :drawBTN
%batbox% /g 60 12 /d " ---------------------------------------"
%batbox% /g 60 13 /d "| EXTENSION : " /c 0xfc /d "[" /c 0xf0 /d "IMPOSSIBLE CLICK" /c 0xfc /d "]" /c 0xf0 /d " |"
%batbox% /g 60 14 /d " ---------------------------------------"
%batbox% /g 30 15 /d " ---------------------------------------------------------------------"
%batbox% /g 30 16 /d "| NOM DANS LE SOUS MENU : |"
%batbox% /g 30 17 /d " ---------------------------------------------------------------------" /g 60 16
set /p namemenu=
call :length "!namemenu!"
set namemenuLength=!length!
goto :eof
:drawBTN
%batbox% /g 58 20 /d " -------------------"
%batbox% /g 58 21 /d "| ENLEVER |"
%batbox% /g 58 22 /d " -------------------"
%batbox% /g 80 20 /d " -------------------"
%batbox% /g 80 21 /d "| AJOUTER |"
%batbox% /g 80 22 /d " -------------------"
goto :eof
:addnew
set temptxtext=!txtExt:"=!
set temptextname=!txtName:"=!
set temptxtext=!temptxtext: /c 0xfc /d [ /c 0xf0 /d CLICK /c 0xfc /d ] /c 0xf0 /d =!
set temptextname=!temptextname: /c 0xfc /d [ /c 0xf0 /d CLICK /c 0xfc /d ] /c 0xf0 /d =!
if "!temptxtext!"=="" (
(
echo;x=Msgbox^("Erreur : Veuillez remplir toutes les zones de textes",vbOKOnly+vbCritical, ""^)
)> "%temp%\msg.vbs"
start /min /wait "" "cscript" /nologo "%temp%\msg.vbs"
del /q "%temp%\msg.vbs" >nul 2>&1
goto :eof
)
if "!temptextname!"=="" (
(
echo;x=Msgbox^("Erreur : Veuillez remplir toutes les zones de textes",vbOKOnly+vbCritical, ""^)
)> "%temp%\msg.vbs"
start /min /wait "" "cscript" /nologo "%temp%\msg.vbs"
del /q "%temp%\msg.vbs" >nul 2>&1
goto :eof
)
set test=
( for /f "tokens=1,2,3,4" %%a in ('reg QUERY HKCR\!ext! /v ""') do set test=%%d ) >nul 2>&1
if "!test!"=="" (
eg ADD HKCR\!ext! /d "file!ext!" /f >nul 2>&1
reg ADD HKCR\!ext!\ShellNew /v NullFile /f >nul 2>&1
reg ADD HKCR\file!ext! /d "!namemenu!" /f >nul 2>&1
) else (
if "!test:~1!"=="valeur " (
reg ADD HKCR\!ext! /d "file!ext!" /f >nul 2>&1
reg ADD HKCR\!ext!\ShellNew /v NullFile /f >nul 2>&1
reg ADD HKCR\file!ext! /d "!namemenu!" /f >nul 2>&1
) else (
reg ADD HKCR\!ext!\ShellNew /v NullFile /f >nul 2>&1
reg ADD HKCR\!test! /d "!namemenu!" /f >nul 2>&1
)
)
(
echo;x=Msgbox^("Succès ^!"^& vbNewLine ^&"'!namemenu!' rajouté au sous-menu 'Nouveau' du menu Contextuel ^!",vbOKOnly+vbInformation, ""^)
)> "%temp%\msg.vbs"
start /min /wait "" "cscript" /nologo "%temp%\msg.vbs"
del /q "%temp%\msg.vbs" >nul 2>&1
goto :eof
:removenew
set temptxtext=!txtExt:"=!
set temptxtext=!temptxtext: /c 0xfc /d [ /c 0xf0 /d CLICK /c 0xfc /d ] /c 0xf0 /d =!
if "!temptxtext!"=="" (
(
echo;x=Msgbox^("Erreur : Veuillez remplir toutes les zones de textes",vbOKOnly+vbCritical, ""^)
)> "%temp%\msg.vbs"
start /min /wait "" "cscript" /nologo "%temp%\msg.vbs"
del /q "%temp%\msg.vbs" >nul 2>&1
goto :eof
)
reg DELETE HKCR\!ext!\ShellNew /f >nul 2>&1
(
echo;x=Msgbox^("Succès ^!"^& vbNewLine ^&"'!ext!' a été enlevé du sous-menu 'Nouveau' du menu Contextuel ^!",vbOKOnly+vbInformation, ""^)
)> "%temp%\msg.vbs"
start /min /wait "" "cscript" /nologo "%temp%\msg.vbs"
del /q "%temp%\msg.vbs" >nul 2>&1
goto :eof
:cls
%batbox% /g 0 11 /d "!clsdata!" /g 0 10
goto :eof
:loadingModule <FIRST> <SIZE> <TIME> <[AFTER]>
set tempnb=
%batbox% /d "%~1"
for /l %%a in (0,1,%~2) do set "tempnb=!tempnb! "
for /f "tokens=1,2 delims=," %%a in ('powershell -nologo -noprofile -command "$U=$Host.ui.rawui;Write-Host($U.CursorPosition);"') do set Cx=%%a & set Cy=%%b
%batbox% /c 0xFA /d "[!tempnb!] : "
for /l %%a in (0,1,%~2) do (
set /a betweennb=%%a+1
for %%b in (!betweennb!) do set tempnb=!tempnb:~0,%%a!-!tempnb:~%%b,%~2!
%batbox% /g !Cx! !Cy! /c 0xFA /d "[" /c 0xDE /d "!tempnb!" /c 0xFA /d "]" /c 0xF0 /d " : .."
call :wait %~3
)
%batbox% /g !Cx! !Cy! /c 0xFA /d "[" /c 0xDE /d "!tempnb!" /c 0xFA /d "]" /c 0xF0 /d " : " !%~4!
goto :eof
:wait <nb>
for /l %%a in (0,1,%~1) do @ping localhost -n 1 >nul
goto :eof
:length <variable>
for /f "tokens=1* delims=[]" %%a in ('"%comspec% /u /c echo:%~1|more|find /n /v """') do set /a "length=%%a-4"
goto :eof
:MakeBatbox
for %%b in (
4D5343460000000073030000000000002C000000000000000301010001000000
00000000470000000100010000060000000000000000FE4259B5200062617462
6F782E657865003FD9412724030006434BB5545F485361143F5737F0CF726B3A
102ABB528B1EC24813421026D3529AB59C184460D7ED6EF7CE79EFB8F74A562F
0B1D543EF5143DC60483C27AF0C14248B18710A4979ECA40426A0329A1B21ECA
AF73EE9D4E21B287FAB6DF77CFF99DF37DDFEF3B3B779D1752C001800D5CC018
808F1C1C3ED879A41015FB9F56C064E942ED141758A8ED96649D4F6A6A4C1306
F8B0A028AAC1F789BC36A8F0B2C2B79E0DF1036A44ACDB557670638F601B4080
E3A0C3FBFDDC06B7044EAE9CE34EA2283041C3B505A48E9E450079B99B69C05B
FC4B1457BC75DD6666DECD8F981BE02EF71797FDC7A32E9A100C7C1EB1E505D9
2CDD5BC7252AC57F1E92ABCA0771EB21D968029C98E76125D25F9967D1ED838C
8372D6F24E093AD9175832FFADCAD43C7F8C459F9442D39D1E8C3947C6913F15
7BB79A7BCD18CBA6D10BB24687B9E33226E4E6904E5DE37A9DE90A3C9C7926F1
98F48C73E401F2CC731FBD66BAB2335D6E8689B0336A13E6798C76B601772CB6
F7E2565EEAD64C1589A931C93092B34B2ECE4E1C6BB466EBE82C1DDD4E8A3ED3
5ED25137B163B861AE9ED8B7D452F182D42F945F4D111213920E14F28B908D57
B3C61233710903560539A9DA3CD0E257901F6EA600D664019744879B295EE44C
3F43EF9BFD303A3FD172A61FE13CDABC17FD9BEBB39F5CD7DFD3BDEEF155565D
6E63B4D8CC0E9EEF910E15745C5D47755EAB32AB245726A20A890C55275B4616
952417A44035BA71FC8498670A970F3F77CCCD7E2862E3F524D44EBFBB6D741F
3D46F7A4DF3847E885988B835574AF0EDE4893F9056F1874970F26101F111711
B6DD3EA8411C472C20A611FD31211C8D0CA89737DAEC4665A1E532F8CA8DA13F
ED2E7013682FBA7FDFA29DA11E7F57775D6B2000A7DBBACEB4051AEA4D077EE0
02076E54833881E846488864FEB09DE2D8AAA2113222ED82124988E48744C3AF
2ABA9A103BF17F6A3BD32D0E192D86A1C97D8386B82DE21FD474550BAABA6CC8
AA42ABBA4421920F7628C941A385F213A298DCB6AE55D69309E18A79D40C6A9A
47BC422C2356106B799D7F8AE16D345931A264F5C644232C9916990382AC085A
4C475F1C920D93EFEF932C4B3734434D00FC02
) Do >>t.dat (Echo.For b=1 To len^("%%b"^) Step 2
ECHO WScript.StdOut.Write Chr^(Clng^("&H"^&Mid^("%%b",b,2^)^)^) : Next)
Cscript /b /e:vbs t.dat>batbox.ex_
Del /f /q /a t.dat >nul 2>&1
Expand -r batbox.ex_ >nul 2>&1
Del /f /q /a batbox.ex_ >nul 2>&1
Copy batbox.exe %temp% >nul 2>&1
Del /f /q /a batbox.exe >nul 2>&1
goto :eof
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment