"Frequently Asked Questions about CMD.EXE Command Line Scripts" - Windows NT

This is a discussion on "Frequently Asked Questions about CMD.EXE Command Line Scripts" - Windows NT ; Dear Readers, Before posting a CMD.EXE command line script related question please be aware of the information and solutions material already available, such as 94268 Mar 31 2004 ftp://garbo.uwasa.fi/pc/link/tscmd.zip tscmd.zip Useful NT/2000/XP script tricks and tips, T.Salmi In case of ...

+ Reply to Thread
Results 1 to 9 of 9

Thread: "Frequently Asked Questions about CMD.EXE Command Line Scripts"

  1. "Frequently Asked Questions about CMD.EXE Command Line Scripts"

    Dear Readers,

    Before posting a CMD.EXE command line script related question please be
    aware of the information and solutions material already available, such
    as

    94268 Mar 31 2004 ftp://garbo.uwasa.fi/pc/link/tscmd.zip
    tscmd.zip Useful NT/2000/XP script tricks and tips, T.Salmi

    In case of grave difficulties in getting this file from Garbo archives
    see
    Sites with permission to mirror Garbo archives
    http://www.uwasa.fi/~ts/garbinfo/garbmirr.html

    The contents of the FAQ-like script tips collection is given below.
    For more command line script or near information sources please see

    http://www.uwasa.fi/~ts/http/http2.html#cmdscript

    This file TSCMDIDX.TXT lists the contents of

    1CMDFAQ.TXT NT/2000/XP CMD.EXE Script Tricks
    in ftp://garbo.uwasa.fi/pc/link/tscmd.zip
    Alternatively available with the version number as
    ftp://garbo.uwasa.fi/pc/ts/tscmd19.zip

    --------------------------------------------------------------------
    1} How get today's date elements into environment variables?
    2} On Windows XP how do you stop the script files from closing?
    3} How can I customize the Command Prompt Window with script commands?
    4} How can I test is it on MSDOS/Win3..9x/Me or NT/2000/XP?
    5} How do I get a fully qualified path name of my script?
    6} How does one get yesterday's date?
    7} How can I test if two files agree in size and datetime stamp?
    8} How do I find all the files made at of after YYYYMMDD HHMM?
    9} How can I suppress script error messages altogether?
    10} How can I change the environment variable values within a FOR loop?
    11} How do I retain my original code page in these scripts?
    12} How can I rename all my .JPG files sequentially in a folder?
    13} How do I get the current day of the week?
    14} Help! My old batch files won't work since there is no choice.
    15} Is it possible to echo without linefeed like the Unix echo -n?
    16} How can I get the time without having to press enter?
    17} How can I avoid the potential "ECHO is off." in echoing %myvar%
    18} How does one build re-usable script function modules?
    19} How can one build a delay / sleep / wait procedure for a script?
    20} Is is possible to right-justify numbers or words in a script?
    21} Do you have pointers to additional script material and tips?
    22} How do I capture the current folder name into a variable?
    23} How do I get the n:th, the first and the last line of a text file?
    24} How do I get the m:th item on the n:th line of a text file?
    25} How can I quote with e.g. "> " an entire message?
    26} How do I get the length of a string into a variable?
    27} How can I remove all the blank lines from a text file?
    28} How to convert a file written in IBM PC characters into LATIN1?
    29} How do I drop the first two characters of a string, and so on?
    30} Can one calculate the difference between two times in a script?
    31} How many days ago was 31.12.2003? What date it was a 100 days ago?
    32} How can I convert a decimal number to binary, octal, hexadecimal?
    33} How can I convert a binary, octal, hexadecimal into a decimal?
    34} How can I remove the quote characters from a line?
    35} How can I substitute the second field on each line of my file?
    36} I start a program from my script and it hogs my command window.
    37} How can I insert a line in the middle of a file with a script?
    38} How can I set and test the errorlevel within a script file?
    39} Is there a subroutine to convert a variable into uppercase?
    40} How do I get the number of arguments given to a script?
    41} How can I create a zero-byte file? How do I test for it?
    42} What is the subroutine for testing a filename for wildcards?
    43} Is there a way of counting the number of files in a folder?
    44} How do I get the first 68 columns from a text file?
    45} How can I find out how many days old a file is?
    46} Is a program available in the default folder or at path?
    47} Is it possible to echo the redirection symbol in a script?
    48} Why do some comment lines cause errors? What can I do about it?
    49} I need to reverse a text file. How do I do that fairly quickly?
    50} How do I get the position of a substring in a string?
    51} How can I echo lines in different colors in NT scripts?
    52} How can I enter a password into a variable without echoing it?
    53} How can I test if a disk device is ready or not?
    54} How can I get the type of a disk device?
    55} How to get the creation, last modified and last access of a file?
    56} How to find and move more recent files from one folder to another?
    57} How do I get a list of all my empty folders on c:\ ?
    58} How do I best combine two quoted arguments into one quoted string?
    59} How do I find if a folder exists? How about visible files in it?
    60} How do I delete all but most recent 20 files in a folder?
    61} How can one devise a command line calculator?
    62} How can I compare within a script if two files are identical?
    63} How to perform a command on each line of file as an argument?
    64} How to count the number of lines in a file, empty lines inclusive?
    65} How do I add text in front and after each line in a text file?
    --------------------------------------------------------------------

    All the best, Timo

    --
    Prof. Timo Salmi ftp & http://garbo.uwasa.fi/ archives 193.166.120.5
    Department of Accounting and Business Finance ; University of Vaasa
    mailto:ts@uwasa.fi ; FIN-65101, Finland
    Timo's FAQ materials at http://www.uwasa.fi/~ts/http/tsfaq.html

  2. Re: Two pieces of spam this week!!! But still SPAM ALERT



  3. Re: Two pieces of spam this week!!! But still SPAM ALERT

    "David Candy" wrote in message
    news:eAJduLdWEHA.212@TK2MSFTNGP12.phx.gbl...

    David has a valid point, at least in comp.os.ms-windows.programmer.misc
    (which is the only group out of these that I read).

    Timo titles his posts "Frequently Asked Questions", yet I've _never_ seen
    any questions on command scripts here in this newsgroup.

    --
    Tim Robinson (MVP, Windows SDK)
    http://mobius.sourceforge.net/



  4. Re: Two pieces of spam this week!!! But still SPAM ALERT

    Tim Robinson wrote:
    > "David Candy" wrote in message


    http://www.uwasa.fi/~ts/http/crackpot.html#troll

    > David has a valid point, at least in comp.os.ms-windows.programmer.misc
    > Timo titles his posts "Frequently Asked Questions", yet I've _never_ seen


    http://www.uwasa.fi/~ts/http/faqoff.html

    All the best, Timo

    --
    Prof. Timo Salmi ftp & http://garbo.uwasa.fi/ archives 193.166.120.5
    Department of Accounting and Business Finance ; University of Vaasa
    mailto:ts@uwasa.fi ; FIN-65101, Finland
    Timo's FAQ materials at http://www.uwasa.fi/~ts/http/tsfaq.html




  5. Re: Two pieces of spam this week!!! But still SPAM ALERT

    THANK YOU!

    --
    All the Best,
    Kelly

    Microsoft-MVP Windows® XP
    2004 Windows MVP "Winny" Award

    Troubleshooting Windows XP
    http://www.kellys-korner-xp.com

    Taskbar Repair Tool Plus!
    http://www.kellys-korner-xp.com/taskbarplus!.htm


    "Tim Robinson" wrote in message
    news:2k0kf8F15878mU1@uni-berlin.de...
    > "David Candy" wrote in message
    > news:eAJduLdWEHA.212@TK2MSFTNGP12.phx.gbl...
    >
    > David has a valid point, at least in comp.os.ms-windows.programmer.misc
    > (which is the only group out of these that I read).
    >
    > Timo titles his posts "Frequently Asked Questions", yet I've _never_ seen
    > any questions on command scripts here in this newsgroup.
    >
    > --
    > Tim Robinson (MVP, Windows SDK)
    > http://mobius.sourceforge.net/
    >
    >




  6. Re: Two pieces of spam this week!!! But still SPAM ALERT

    Kelly wrote in message :

    > THANK YOU!


    A simple unanswered question:

    Why don't you use the killfile?

  7. Re: Two pieces of spam this week!!! But still SPAM ALERT

    I don't as I think killfiles are stupid. It's about data integrity. And a professor one expects to have learnt ethics.

    --
    ----------------------------------------------------------
    http://www.counterpunch.org/bageant06132004.html
    "Marco Maier" wrote in message news:vkervntp8sqd.MRC@MIR.SID...
    > Kelly wrote in message :
    >
    > > THANK YOU!

    >
    > A simple unanswered question:
    >
    > Why don't you use the killfile?


  8. Re: Questionable SPAM alert, was: Re: Two pieces of spam (...)

    Bartosz Bielawski wrote:
    > On Fri, 25 Jun 2004, Kelly wrote:
    > > THANK YOU!


    > Dear Timo,


    Dear Bartosz,

    Since you very commendably are writing seriously with good,
    civilized manners you deserve a customized response in the same
    spirit.

    > Could I have kind request to remove from address list those groups where
    > you are not welcome with your faq as you are here?


    Sorry, absolutely not! That is overgeneralizing the alleged
    unwelcome-status. There are so many readers in newsgroups that each
    one will always have its dissidents, trolls, and charlatans who will
    object to regular information, or anything else not to their fancy
    for that matter. If their trouble-making antics bother you, consider
    killfiling them. Or, likewise, if my regular posting is not your, or
    someone else's liking, it is easily avoided by killfiling. The
    subject header is constant, partially for this very reason.

    > I strongly disagree with arguments of those posters who call you FAQ
    > spam, but still - they reply to this faq quite often and usually don't
    > snip, top post, and send a lot messages of questionable value to all
    > groups included in your FAQ posts.


    They can call it whatever they happen to imagine. I will not allow
    myself be overshouted nor intimidated by the antics like David and
    Kelly indulge in.

    > I'll however understand if you say that this is not solution. :-D
    > It's your faq and your decision. ;-D


    Yes, good point. It indeed is my decision to make. I am not
    succumbing.

    > Kind regards,


    I particularly appreciate the way your wrote. It is nice for a
    change to see a problem taken up with grace.

    > Bartek


    All the best, Timo

    --
    Prof. Timo Salmi ftp & http://garbo.uwasa.fi/ archives 193.166.120.5
    Department of Accounting and Business Finance ; University of Vaasa
    mailto:ts@uwasa.fi ; FIN-65101, Finland
    Useful script files and tricks ftp://garbo.uwasa.fi/pc/link/tscmd.zip

  9. Re: Two pieces of spam this week!!! But still SPAM ALERT

    On Thu, 24 Jun 2004 20:06:27 +1000, "David Candy"
    wrote:

    I just did a count of the groups that were posted to: 5

    alt.msdos.batch.nt,
    comp.os.ms-windows.nt.misc,
    comp.os.ms-windows.programmer.misc,
    microsoft.public.win2000.cmdprompt.admin,
    microsoft.public.windowsxp.general

    Now, I am not an NT,2000, or XP user, but it seems to me
    that if such groups don't have a FAQ already, then I should
    think it would be welcome. At least such information is
    usable and not porn, or viruses.

    As a result of this posting, I shall add these groups to my
    list to read. Not for my benefit, but for that of my brother
    an XP user bereft of 98/98SE, one of the "true" DOS systems.

    --
    Sincerely, | (©) (©)
    | ------ooo--(_)--ooo------
    Andrew H. Carter | /// \\\
    d(-_-)b |

+ Reply to Thread