Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

Batch Files Tutorial - Loops

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
4,397
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Jan 5, 2009

In this video, learn how to use loops in .BAT ;]

Category:

Howto & Style

Tags:

License:

Standard YouTube License

  • likes, 2 dislikes

Link to this comment:

Share to:

Uploader Comments (MasterJake777)

  • Very good video! I had absolutely no knowledge of loops before I watches this, and now i know some of the basics, didn't understand /p and /a, though

  • @maiahi0 Thanks! Well essentially if you set var=value then it takes that value immediately without question. If you'd rather *prompt* the user to enter the value for the variable instead, then you need to use the /p switch. The /a switch is used if you need to use mathematical operations like +, -, *, / etc. when setting the variable. For example, this would not work:

    set test=5+4

    but this would:

    set /a test=5+4

  • Whats wrong with my code? I copied it basically letter for letter from this, please help @echo off set varloopcancel=5 set varloopcounter=1 :loop if %varloopcounter% LEQ %varcancel% ( set /a varloopcounter=varloopcounter+­1 echo %varloopcounter% goto loop ) echo Loop ended pause
  • @turtleownage This line: if %varloopcounter% LEQ %varcancel% (

    %varcancel% needs to be %varloopcancel%

  • hey is there a way you can loop a delete for folders or programs?

  • @AnnieBoPookie If you mean deleting *all* the files in a folder, then yes you can do that. Search on google "cmd recursive delete" and you should find tons of info on it!

see all

All Comments (43)

Sign In or Sign Up now to post a comment!
  • I used set /a like a million times for my mafia batch game. EVERYONE CHECK IT OUT!!! Free and no damn surveys

  • @MasterJake777 You teach better than my teacher :) Keep making vids, very useful! Do not respond to this.

  • @MasterJake777 Aaaah thank you very much! Noob mistake lol

  • oh kk

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more