Richard's profile  red hot place  BlogLists Tools Help

Blog


    March 21

    Progressive Dots

    I just found out about this (thanks to Live Search!) from a fellow Canadian's blog entry "batch file snippets" and it's got me super excited.

    Haven't you ever found it annoying that you can't print to a line without a newline (carriage return/line feed) in a batch script?  (At least, I didn't know how to.)  Well, now you can!

    For instance:

    echo Copying files .

    for %%f in (A B C D) do (
        echo .
        xcopy %%f %DEST% /cqy 2>&1>NUL
    )

    would give you:

    Copying files .
    .
    .
    .
    .

    as opposed to a progressive:

    Copying files ....

    So what you actually want is:

    set /p CRLF=Copying files .<NUL
    for %%f in (A B C D) do (
        set /p CRLF=.<NUL
        xcopy %%f %DEST% /cqy 2>&1>NUL
    )

    Don't tell me that's not cool!  How does it work?  The '/p' option given to set is asking for user input:

    SET /P variable=[promptString]

    The /P switch allows you to set the value of a variable to a line of input entered by the user.  Displays the specified promptString before reading the line of input.  The promptString can be empty.

    The key is that it prompts for input *on the same line*!  And by redirecting the NUL device into it, you get an immediate return.  How absolutely clever.

    I love it!

    Comments (1)

    Please wait...
    Sorry, the comment you entered is too long. Please shorten it.
    You didn't enter anything. Please try again.
    Sorry, we can't add your comment right now. Please try again later.
    To add a comment, you need permission from your parent. Ask for permission
    Your parent has turned off comments.
    Sorry, we can't delete your comment right now. Please try again later.
    You've exceeded the maximum number of comments that can be left in one day. Please try again in 24 hours.
    Your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. If you believe that your account has been disabled in error please contact Windows Live support.
    Complete the security check below to finish leaving your comment.
    The characters you type in the security check must match the characters in the picture or audio.

    To add a comment, sign in with your Windows Live ID (if you use Hotmail, Messenger, or Xbox LIVE, you have a Windows Live ID). Sign in


    Don't have a Windows Live ID? Sign up

    No namewrote:
    http://www.adapterlist.com/dell/d400.htm dell d400 battery
    http://www.adapterlist.com/dell/latitude-d400.htm dell latitude d400 battery
    http://www.adapterlist.com/dell/original-inspiron-1525.htm dell original inspiron 1525 battery
    http://www.adapterlist.com/dell/original-inspiron-1526.htm dell original inspiron 1526 battery
    http://www.adapterlist.com/dell/latitude-d810.htm dell latitude d810 battery
    http://www.adapterlist.com/dell/precision-m70.htm dell precision m70 battery
    http://www.adapterlist.com/dell/y4367.htm dell y4367 battery
    http://www.adapterlist.com/dell/inspiron-1100-series.htm dell inspiron 1100 series battery
    http://www.adapterlist.com/dell/inspiron-1150.htm dell inspiron 1150 battery
    http://www.adapterlist.com/dell/inspiron-5150.htm dell inspiron 5150 battery
    http://www.adapterlist.com/dell/inspiron-5100.htm dell inspiron 5100 battery
    http://www.adapterlist.com/dell/inspiron-1000.htm dell inspiron 1000 battery
    http://www.adapterlist.com/dell/inspiron-1200.htm dell inspiron 1200 battery
    http://www.adapterlist.com/dell/inspiron-2200.htm dell inspiron 2200 battery
    http://www.adapterlist.com/dell/e1405.htm dell e1405 battery
    http://www.adapterlist.com/dell/inspiron-630m.htm dell inspiron 630m battery
    http://www.adapterlist.com/dell/inspiron-640m.htm dell inspiron 640m battery
    http://www.adapterlist.com/dell/xps-m140.htm dell xps m140 battery
    http://www.adapterlist.com/dell/xps-1330.htm dell xps 1330 battery
    http://www.adapterlist.com/dell/xps-m1330.htm dell xps m1330 battery
    http://www.adapterlist.com/dell/inspiron-6400.htm dell inspiron 6400 battery
    http://www.adapterlist.com/dell/latitude-131l.htm dell latitude 131l battery
    http://www.adapterlist.com/dell/vostro-1000.htm dell vostro 1000 battery
    http://www.adapterlist.com/dell/1501.htm dell 1501 battery
    http://www.adapterlist.com/dell/e1505.htm dell e1505 battery
    http://www.adapterlist.com/dell/kd476.htm dell kd476 battery
    http://www.adapterlist.com/dell/gd761.htm dell gd761 battery
    http://www.adapterlist.com/dell/312-0273.htm dell 312-0273 battery
    http://www.adapterlist.com/dell/312-0417.htm dell 312-0417 battery
    http://www.adapterlist.com/dell/451-10180.htm dell 451-10180 battery
    http://www.adapterlist.com/dell/c2174.htm dell c2174 battery
    http://www.adapterlist.com/dell/f1244.htm dell f1244 battery
    http://www.adapterlist.com/dell/g1947.htm dell g1947 battery
    http://www.adapterlist.com/dell/h5559.htm dell h5559 battery
    http://www.adapterlist.com/dell/hj424.htm dell hj424 battery
    http://www.adapterlist.com/dell/inspiron-9100.htm dell inspiron 9100 battery
    http://www.adapterlist.com/dell/dell-inspiron-xps.htm dell dell inspiron xps battery
    http://www.adapterlist.com/dell/inspiron-2000.htm dell inspiron 2000 battery
    http://www.adapterlist.com/dell/inspiron-2100.htm dell inspiron 2100 battery
    http://www.adapterlist.com/dell/inspiron-2800.htm dell inspiron 2800 battery
    http://www.adapterlist.com/dell/latitude-ls-400.htm dell latitude ls 400 battery
    http://www.adapterlist.com/dell/d620.htm dell d620 battery
    http://www.adapterlist.com/dell/d630.htm dell d630 battery
    http://www.adapterlist.com/dell/latitude-d620.htm dell latitude d620 battery
    http://www.adapterlist.com/dell/latitude-d820.htm dell latitude d820 battery
    http://www.adapterlist.com/dell/latitude-d830.htm dell latitude d830 battery
    May 25

    Trackbacks

    The trackback URL for this entry is:
    http://devduck.spaces.live.com/blog/cns!15D0C43F1C8E7753!390.trak
    Weblogs that reference this entry
    • None