CMD: OPTION to jump
#1
Posted 30 August 2011 - 07:44 PM
:Sorry
ECHO Sorry!
:Welcome
ECHO Welcome!
Is it possible to jump to the ":Sorry" label if i open the cmd file and to jump to the ":Welcome" label if i open the same cmd file followed by an option (for example: batch.cmd /jump)?
Thank you!!
#2
Posted 30 August 2011 - 09:08 PM
goto %1 :sorry Echo Sorry! Goto :end :welcome echo welcome Goto :end :end
just use the label name for the switch
#4
Posted 30 August 2011 - 11:18 PM
This post has been edited by Caml Light: 30 August 2011 - 11:20 PM
#5
Posted 31 August 2011 - 12:19 AM
#6
Posted 31 August 2011 - 03:44 AM
#7
Posted 31 August 2011 - 03:53 AM
#8
Posted 31 August 2011 - 04:17 AM
Kelsenellenelvian, on 31 August 2011 - 03:53 AM, said:
....and make it longer than 12 characters and make sure you insert "strange" non alpha-numeric characters and not a-z/A-Z ones.
Examples:
- h1_1_@m_@_|33t_p@§§vv0rd
- ÿ00_vv0n*t_cr@ç#-m3
BTW, IcemanND's nice batch may be "bettered" (assuming you are on a 2K/XP or later NT based system):
@ECHO OFF
SETLOCAL ENABLEEXTENSIONS
IF NOT "%1"=="" FOR /F %%A in ('type %~nx0 ^|FIND ":%1" ^| FIND /V "FIND"') DO GOTO :%1
Echo A suffusion of yellow ...
GOTO :EOF
:sorry
Echo Sorry!
GOTO :EOF
:welcome
echo welcome
OR (to follow your original post):
@ECHO OFF
SETLOCAL ENABLEEXTENSIONS
IF NOT "%1"=="" FOR /F %%A in ('type %~nx0 ^|FIND ":%1" ^| FIND /V "FIND"') DO GOTO :%1
Echo Sorry!
GOTO :EOF
:welcome
echo welcome
OR:
@ECHO OFF SETLOCAL IF /I "%1"=="welcome" GOTO :%1 Echo Sorry! GOTO :EOF :welcome echo welcome
jaclaz
This post has been edited by jaclaz: 31 August 2011 - 04:21 AM
#9
Posted 31 August 2011 - 04:29 AM
•h1_1_@m_@_|33t_p@§§vv0rd •ÿ00_vv0n*t_cr@ç#-m3
OMG LOLZ
#10
Posted 31 August 2011 - 06:44 AM
You could also change the code to make it so complex that just reading it would not help "the man in the middle" to understand it.
This post has been edited by allen2: 31 August 2011 - 06:44 AM
#11
Posted 31 August 2011 - 08:44 AM
#12
Posted 31 August 2011 - 09:31 AM
To convert to EXE my batch i've used "Bat To Exe Converter 1.5.1.0". Do you think it's enough secure? Better Offuscator?
Now i've added the code by jaclaz:
@ECHO OFF
SETLOCAL
IF /I "%1"=="welcome" GOTO :%1
Echo Sorry!
GOTO :EOF
:welcome
echo welcome
But if an expert user will decrypt my batch, this method will be vain.
#13
Posted 31 August 2011 - 09:36 AM
#14
Posted 31 August 2011 - 09:52 AM
I like the looks of this:
http://www.bdargo.com/
This post has been edited by Kelsenellenelvian: 31 August 2011 - 09:53 AM
#15
Posted 31 August 2011 - 10:20 AM
http://www.f2ko.de/p...lang=en&pid=b2e
But we also have an IDE for batch files
http://sourceforge.n.../batchcompiler/
And also a new thingy , Visualbatch
http://visualbatch.sourceforge.net/
The good ol' way:
http://www.ericphelp...obfuscating.txt
jaclaz
This post has been edited by jaclaz: 31 August 2011 - 10:22 AM
#16
Posted 31 August 2011 - 11:18 AM
It's free. Now i've an issue. Compiling my batch with this code:
@ECHO OFF
SETLOCAL
IF /I "%1"=="welcome" GOTO :%1
Echo Sorry!
GOTO :EOF
:welcome
echo welcome
the exe launched with welcome option goes directly to the end of the script. With the original batch instead it's all fine.
#17
Posted 31 August 2011 - 12:24 PM
@ECHO OFF ECHO=_%~1|FINDSTR/X "_-? _/?">NUL 2>&1||GOTO Sorry REM Your scripting starts below here ECHO=Welcome! PAUSE REM Your scripting ends above here GOTO :EOF :Sorry ECHO= Sorry! ECHO= ECHO=Press any key to Exit. PAUSE>NULOnly users entering a parameter of /? or -? will run the script. The idea behind this is that they should be the most obvious switches to run by someone 'switched on' an unknowing user will always get the Sorry message.
#18
Posted 31 August 2011 - 02:09 PM
@ECHO OFF
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
COLOR F0
ECHO=_%~1|FINDSTR/X "_-123456 _/123456">NUL 2>&1||GOTO Error
FOR /R %%A IN (Windows*-KB*.EXE) DO (
ECHO= Installation of %%~nA...
>NUL PING -n 4 127.0.0.1
"%%A" /quiet /norestart)
ECHO=
ECHO= == Press any key to restart. ==
>NUL PAUSE
SHUTDOWN.EXE /r /t 0
GOTO :EOF
:Error
ECHO= Error.
ECHO=
ECHO= Press any key to exit...
PAUSE>NUL
EXIT
I've for you two questions:
1) Is this batch correct for you??
2) I compile it with this utility: http://www.f2ko.de/p...lang=en&pid=b2e
Once that i launch the obtained EXE with the correct option: "file.exe /?" the batch goes directly to this string: "ECHO= == Press any key to restart. ==", jumping the FOR /R loop command.
Any idea?
This post has been edited by Caml Light: 31 August 2011 - 04:26 PM
#19
Posted 31 August 2011 - 03:39 PM
- You don't need to enable delayed expansion.
- If for some reason the file is run in the wrong location and there are no hotfixes found, your script would still restart the system
As far as your problem goes, I'd suggest that your 'compiler' may not be designed to pass parameters provided to it through to the script.
#20
Posted 31 August 2011 - 04:17 PM
Thanks for your patience.
This post has been edited by Caml Light: 31 August 2011 - 04:23 PM
- ← costum restore executeable x64
- Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
- [Powershell] Get lines of text-file and fill up a variable →



Help

Back to top









