Windows Command Line Tutorial #5 - Batch Scripts

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ธ.ค. 2024

ความคิดเห็น • 40

  • @cozakokotano6448
    @cozakokotano6448 ปีที่แล้ว +2

    Is this the entire tutorial for batch programming language and its scripts?

  • @TheClockmister
    @TheClockmister 8 ปีที่แล้ว +5

    I was literally looking for this for ages!! Thank you sooooo much man, you're my hero

    • @DrapsTV
      @DrapsTV  8 ปีที่แล้ว +1

      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

  • @gregoryfenn1462
    @gregoryfenn1462 5 ปีที่แล้ว

    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?

  • @kailahot5541
    @kailahot5541 4 ปีที่แล้ว

    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

  • @Jiahaohao
    @Jiahaohao 9 ปีที่แล้ว +2

    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?

    • @DrapsTV
      @DrapsTV  9 ปีที่แล้ว

      +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!

    • @Jiahaohao
      @Jiahaohao 9 ปีที่แล้ว

      +DrapsTV thanks for the quick response, i've forgotten all the java i've learned 4 years ago

    • @Jiahaohao
      @Jiahaohao 9 ปีที่แล้ว

      +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 '

  • @theMou
    @theMou 8 ปีที่แล้ว

    why don't we assign the local result to a global variable instead of chaining the endlocal command?

  • @vaibhavvajpai1481
    @vaibhavvajpai1481 3 ปีที่แล้ว

    Why 2^31 get's a negative value?

  • @TF0x42
    @TF0x42 8 ปีที่แล้ว

    Great video!

  • @medicineman7894
    @medicineman7894 2 ปีที่แล้ว

    Legend

  • @aryanrastogi45
    @aryanrastogi45 8 ปีที่แล้ว

    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

    • @DrapsTV
      @DrapsTV  8 ปีที่แล้ว

      +aryan rastogi Probably not so much network 'cracking' these days, but definitely recon and useful automation tools.

  • @darturi2397
    @darturi2397 8 ปีที่แล้ว

    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.

    • @DrapsTV
      @DrapsTV  8 ปีที่แล้ว

      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.

    • @darturi2397
      @darturi2397 8 ปีที่แล้ว

      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
      @DrapsTV  8 ปีที่แล้ว

      I agree :)

    • @gregoryfenn1462
      @gregoryfenn1462 5 ปีที่แล้ว

      @@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 :(

  • @sbodakhe
    @sbodakhe 8 ปีที่แล้ว

    is it possible open ANY APPLICATION CLICK on any menu fuction using bat file, if yes how

    • @DrapsTV
      @DrapsTV  8 ปีที่แล้ว

      Sure, you can start any application with the *start* command.

  • @davidg.4043
    @davidg.4043 8 ปีที่แล้ว

    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?

    • @davidg.4043
      @davidg.4043 8 ปีที่แล้ว

      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

    • @SPFAlpha
      @SPFAlpha 7 ปีที่แล้ว

      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.

  • @mantasreika
    @mantasreika 9 ปีที่แล้ว +1

    Thanks very helpfull!

  • @auguspaul9237
    @auguspaul9237 5 ปีที่แล้ว

    good stuff!

  • @hardcorehenry6580
    @hardcorehenry6580 5 ปีที่แล้ว

    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?

    • @gregoryfenn1462
      @gregoryfenn1462 5 ปีที่แล้ว

      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.

    • @tradingmogador9171
      @tradingmogador9171 5 ปีที่แล้ว

      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 .

  • @realcow1
    @realcow1 4 ปีที่แล้ว

    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

  • @fetB
    @fetB 7 ปีที่แล้ว

    why is it coloring the text differently?

    • @SPFAlpha
      @SPFAlpha 7 ปีที่แล้ว

      fetB it must be a special text editor designed for creating code. Look into notepad + + as he is apparently using

  • @livelive3762
    @livelive3762 3 ปีที่แล้ว

    thx u

  • @olegmaz3969
    @olegmaz3969 5 ปีที่แล้ว

    power 2 0 not corect working return 2, must be 1

    • @matthewdo9027
      @matthewdo9027 5 ปีที่แล้ว

      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.

  • @sushantmaharjan628
    @sushantmaharjan628 9 ปีที่แล้ว +1

    python brow

  • @farahmohumad5355
    @farahmohumad5355 4 ปีที่แล้ว

    ireally stuck here