Wait, at 19:20 , bat/cmds scripts treat two commands on separate lines differently from two commands on one line with an ampersand & inbetween? What kind of psychopath defined this language?
Hello, thank you very good the video, I have a question if you could help me, I have been trying to block the opening and others from the contextual menu for weeks to prevent another program to opening another, for example that ResourceHacker or no other can, only it open the .exe file with double click I really appreciate your collaboration thanks
Great video! I have a question though. For your power.bat file %%G starts off at 2 and increments by 1, and lets say %1 =2 and %2 = 3. So the answer you are expecting is 8. If %%G starts off at 2, then after the for loop %%G becomes 3 because it increments by 1. Because %%G is now 3 it matches %2, but _result is only 4. Why does it loop once again even though %%G and %2 match?
+jqweeze Because it runs once on the value 2, then runs a second time on 3 then because it's run 3/3 times it finishes. Great question, it's isn't immediately obvious if you have done any other type of programming!
hi i m so glad that u posted these videos these r the videos i always wanted to learn i have a question can we do hacking using cmd like network cracking or stuff like that
Glad you liked it! I would normally say that powershell is worth learning, but since BASH was added to windows 10, I'm sure that will become the new standard in the future.
BASH is great! I hope this addition to W10 doesn't come with bugs or a new space of security vulnerabilities. With that said, I'll wait a few more years before updating to W10.
@@DrapsTV Annoyingly, my company insists on bat. Powershell is often more powerful, but my firm doesn't like it [no idea why, I think it's just run but old software engineers that still think in terms of MS-Dos and Fortran languages]. But I prefer BASH as I'm using to Linux and MacOSX. And Windows 10, which we'll migrate to in a few months, has a Linux subsystem in it anyway, so now it looks like I'll have to master at least 3 different command line languages, even though any of of them would be good enough if we just stuck to it :(
I need some help I programed in notepad ++ something. I made it to ask the user to pick a number between 1 and 10 and then make the computer pick a random number beween 1 and 10 how can I make DOS echo something if the user picks a number larger then 10?
here is the peogram @echo off :choice set /P c=PLEASE PICK A NUMBER [1/2/3/4/5/6/7/8/9/10]... if :ans set /a ran=%random% if /i %ran% GTR 10 goto :ans if /i %ran% LSS 1 goto :ans echo THE LUCKY NUMBER IS %ran% if /I "%c%" EQU "%ran%" goto :X if /I "%c%" NEQ "%ran%" goto :Y :X echo WELL DONE! YOU ARE LUCKY! goto :Z :Y echo TOO BAD! BETTER LUCK NEXT TIME! :Z set /P c=DO YOU WANT TO PLAY AGAIN [Y/N]? if /I "%c%" EQU "Y" goto :choice if /I "%c%" EQU "N" goto :eof goto :choice
David G. Have you considered a conditional check for the input from the user. Say, if x is greater than 10 goto :help and then tell the user to pick a valid number. The else part of the if else statement could be what you have already written.
The single-line command "pause" (or making a previous command com into "com & pause") will tell the script to pause and wait and ask the user to hit a key to continue. Most bat files use 'pause' as the very last line of their script to allow the user to read any echoed messages or other information in the script output before closing the window.
you have just to add /a to the variables like that : @echo off set /a _var1 = 5 set /a _var2 = 6 echo var1 is %_var1% echo var2 is %_var2% set /a _result = %_var1% + %_var2% echo _result is %_result% it will work .
Is this the entire tutorial for batch programming language and its scripts?
I was literally looking for this for ages!! Thank you sooooo much man, you're my hero
I'm glad you enjoyed it! Make sure the file your editing has the .bat extension and notepad++ should highlight it with the config for .bat's
Wait, at 19:20 , bat/cmds scripts treat two commands on separate lines differently from two commands on one line with an ampersand & inbetween? What kind of psychopath defined this language?
Hello, thank you very good the video, I have a question if you could help me, I have been trying to block
the opening and others from the contextual menu for weeks to prevent another program to opening another,
for example that ResourceHacker or no other can, only it open the .exe file with double click I really
appreciate your collaboration thanks
Great video! I have a question though. For your power.bat file %%G starts off at 2 and increments by 1, and lets say %1 =2 and %2 = 3. So the answer you are expecting is 8. If %%G starts off at 2, then after the for loop %%G becomes 3 because it increments by 1. Because %%G is now 3 it matches %2, but _result is only 4. Why does it loop once again even though %%G and %2 match?
+jqweeze Because it runs once on the value 2, then runs a second time on 3 then because it's run 3/3 times it finishes. Great question, it's isn't immediately obvious if you have done any other type of programming!
+DrapsTV thanks for the quick response, i've forgotten all the java i've learned 4 years ago
+DrapsTV i just went back and looked at a For Loop in java and i guess i'm used to having the end parameter be '
why don't we assign the local result to a global variable instead of chaining the endlocal command?
Why 2^31 get's a negative value?
Great video!
Legend
hi
i m so glad that u posted these videos these r the videos i always wanted to learn i have a question can we do hacking using cmd like network cracking or stuff like that
+aryan rastogi Probably not so much network 'cracking' these days, but definitely recon and useful automation tools.
Very useful! We use Win7 at work and I create my own bat files to fire up my python scripts. Powershell is just not worth learning...I've tried.
Glad you liked it! I would normally say that powershell is worth learning, but since BASH was added to windows 10, I'm sure that will become the new standard in the future.
BASH is great! I hope this addition to W10 doesn't come with bugs or a new space of security vulnerabilities. With that said, I'll wait a few more years before updating to W10.
I agree :)
@@DrapsTV Annoyingly, my company insists on bat. Powershell is often more powerful, but my firm doesn't like it [no idea why, I think it's just run but old software engineers that still think in terms of MS-Dos and Fortran languages]. But I prefer BASH as I'm using to Linux and MacOSX. And Windows 10, which we'll migrate to in a few months, has a Linux subsystem in it anyway, so now it looks like I'll have to master at least 3 different command line languages, even though any of of them would be good enough if we just stuck to it :(
is it possible open ANY APPLICATION CLICK on any menu fuction using bat file, if yes how
Sure, you can start any application with the *start* command.
I need some help
I programed in notepad ++ something. I made it to ask the user to pick a number between 1 and 10 and then make the computer pick a random number beween 1 and 10
how can I make DOS echo something if the user picks a number larger then 10?
here is the peogram
@echo off
:choice
set /P c=PLEASE PICK A NUMBER [1/2/3/4/5/6/7/8/9/10]...
if
:ans
set /a ran=%random%
if /i %ran% GTR 10 goto :ans
if /i %ran% LSS 1 goto :ans
echo THE LUCKY NUMBER IS %ran%
if /I "%c%" EQU "%ran%" goto :X
if /I "%c%" NEQ "%ran%" goto :Y
:X
echo WELL DONE! YOU ARE LUCKY!
goto :Z
:Y
echo TOO BAD! BETTER LUCK NEXT TIME!
:Z
set /P c=DO YOU WANT TO PLAY AGAIN [Y/N]?
if /I "%c%" EQU "Y" goto :choice
if /I "%c%" EQU "N" goto :eof
goto :choice
David G. Have you considered a conditional check for the input from the user. Say, if x is greater than 10 goto :help and then tell the user to pick a valid number. The else part of the if else statement could be what you have already written.
Thanks very helpfull!
good stuff!
Dude i do everything as you in notepad and save it on desktop as simple.bat but it wont work it just open and close cmd very fast. Can you help me?
The single-line command "pause" (or making a previous command com into "com & pause") will tell the script to pause and wait and ask the user to hit a key to continue. Most bat files use 'pause' as the very last line of their script to allow the user to read any echoed messages or other information in the script output before closing the window.
you have just to add /a to the variables like that :
@echo off
set /a _var1 = 5
set /a _var2 = 6
echo var1 is %_var1%
echo var2 is %_var2%
set /a _result = %_var1% + %_var2%
echo _result is %_result%
it will work .
I made a script using this that pings 2b2t to check if it is online and if it is offline I log on to almost fully skip the queue
why is it coloring the text differently?
fetB it must be a special text editor designed for creating code. Look into notepad + + as he is apparently using
thx u
power 2 0 not corect working return 2, must be 1
yeah, it's only a demonstration of using FOR loop and EOF, not meant for heavy math lifting. It is great for the intended purpose.
python brow
ireally stuck here