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

From: martie (anonymous_at_discussions.microsoft.com)
Date: 02/26/04


Date: Thu, 26 Feb 2004 02:20:39 -0800

hey thank a lot for the awesome links..d/loaded the zip &
added the url to favourites...thank a lot ;-)
>-----Original Message-----
>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
>
> 73123 Feb 2 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/tscmd16.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
directory?
>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 directory 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 directory 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?
>----------------------------------------------------------
----------
>
> 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 <http://www.uwasa.fi/~ts/> ; FIN-
65101, Finland
>Timo's FAQ materials at
http://www.uwasa.fi/~ts/http/tsfaq.html
>.
>



Relevant Pages


Quantcast