Thursday, August 28, 2003

 

Sample Batch program


Here are some of the batch commands for your arsenal


%0, %1, %2, %3, %4, %5, %6, %7, %8, %9 ... arguments to the batch file
|
%0 is the batch file itself

%variablename% ... the name of the variable; the variable name is set by
the SET variablename=string command
Note the extra '%' at the end.

ECHO [ON|OFF|message]
"echo blank" will produce a blank line on screen in DOS2.1
"echo blank" will show ON/OFF on screen in DOS3.0
"echo ASCII-255" to get a blank line in DOS3.1
"echo." to get a blank line in DOS3.1
@echo off ... even the "echo off" will not be echoed (DOS 3.3)
%@%echo off ... good for various versions of DOS (set @=@ for DOS 3.3
set @= for DOS 3.2)
CALL batchfile
set call=call for DOS 3.3
set call=%comspec% /C for DOS 3.2
%call% ... usage that is good for various version of DOS

FOR %%variable IN (set) DO command {set is a list of filename; * or ? can be
used.}
Note that two %% are used in a batch file, because one % is striped off when
given to the command line; only one % is needed when given directly from the
command line.}

GOTO label {%1 etc. can also be used for label; see example below}

If [NOT] condition command
|string1==string2 {upper & lower case letters matters}
|EXIST [d:][path]filename {path in DOS3.0}
| {path is not supported in DOS2.1}
|ERRORLEVEL number {true if the previous program exit
with number or higher; See ask}

example of looping 7 times (i.e., 7 "-" signs)
set count=
:loop
set count=%count%-
command 1
command 2
if not "%count%"=="-------" %then% goto loop
%else% set count=

example of looping 27 times (i.e., 2 "+" signs and 7 "-" signs)
set count1=| set count2= ... put two commands in one line with "|" redirection
:loop
set count1=%count1%-
command 1
command 2
if not "%count2%%count1%"=="+++-------" %then% goto end
%else% if not "%count1%"=="-------" %then% goto loop
%else% set count2=%count2%+| set count1=
goto loop

SHIFT

PAUSE [remark]

REM [remark]

Example: :label
:comments
.comments
.comments %1 %2
Command line parameters may be displayed on comment lines.
REM comments
echo  {bell}
goto label
Example: copy con: %1 {enter text to files within a batch environment}
Example: REM CTRL-H CTRL-H CTRL-H comments {not to show "REM" in echo mode}
Example: SET abc=\fortran\fortran.lib
link %1,,,%abc%
Example: SET mouse=1 {set the environment in one batch file}
IF %mouse%=="1" copy abc.txt com1:
Example: IF .%1==.abc dir {dots allow .BAT files to continue running when there
is no parameter passed.}
Example: IF dummy==dummy%1 GOTO label {test for nul parameter in a batch file}
{good for terminating SHIFT}
Example: IF ERRORLEVEL 1 IF x==%1 command ÚÄ
IF ERRORLEVEL 1 IF EXIST filename command ÀÄ{to nest IF statement}
Example: ECHO CTRL-H {to output a blank line to the console}
Example: ECHO A ... program1
ECHO B ... program2
ECHO Press the letter of your selection
PAUSE > select.bat
select
Example: FOR %%f IN (*.*) DO program %%f {good for a program that cannot handle
global chars * and ?}
FOR %%f IN (*.*) DO type %%f
FOR %%f IN (abc.hlp,command.hlp,batch.hlp) DO type %%f
FOR %%f IN (*.g) DO ren %%f %%for {ren all .g files to .gor}
FOR %%f IN (*.hlp) DO find "abc" %%f {find "abc" in all the .hlp files}
Example: rem print a number of files with the corresponding directories & with formfeed
echo off
cls
:loop
echo ... PRINTING FILE %1
dir %1|find "-" > prn:
echo
> prn: {line feed}
echo -------------------------------------------------------- > prn:
echo
> prn: {line feed}
copy %1 prn:
echo > prn: {form feed}
shift {handle the next argument}
if not dummy==dummy%1 goto loop
Example: GOTO f%1
:fA
echo the 1st argument was A
GOTO end
:fB
echo the 1st argument was B
GOTO end
:fC
echo the 1st argument was C
:end

See BAT for a set of enhanced batch file commands.

 

A simple good firewall program


Tiny Personal Firewall Download FREE Get the 2.0.15 version because I found it working!

 
Welcome to Bobby WorldWide

Wednesday, August 27, 2003

 
p2p.wrox.com Forums - how to run an exe application from ASP

Monday, August 25, 2003

 

Free Fonts


This is available at Fonts by Plucer Vision

Saturday, August 23, 2003

 
1001 Fonts .com | Download Free FontsLarabie Fonts

Tuesday, August 19, 2003

 

Calculating your Career


A very interesting article from Shawn's blog was posted lately. It uses some equations to explain how to manage your careers. Sometimes I also wonder how come the best minds have slow careers while the not-so-best people are seeming at the peak. Definitely worth reading.


 
Goldseal Studios - Downloads - Some quick free utilities

Monday, August 18, 2003

 
Merrion Computing Ltd - How to list the jobs in a printer queue from Visual Basic

 
Google Search: command to delete a print job

Sunday, August 17, 2003

 

Quotable Quotations


Sing my song
Life is not measured by the number of breaths we take, but by the moments that take our breath away


Access denied Error when uploading file in ASP.NET


This problem occurs because the ASPNET windows account does not have a write permission to the directory where you are saving the file. Use the security TAB under the file properties to add this permission.

Speaking of security running an SQL Command in Asp.net means you have to add ASPNET to the database users. If you are using integrated authentication in your connection string, make sure that the method of authenticaton for ASPNET is windows. In some public sites, the scheme is to use the impersonation via web.config entry. This name used in impersonation corresponds to the windows user that the process will run on and the same user must be in the list of valid db users. I did this all in the Enterprise manager as I do not know the sp's to do it.


 

Visual Source Safe 6d


I am changing some web applications and decided to install VSS in my computer. I chose the Shared Server version when installing the VSS and created a database under the Program Files. Then I wanted this folder to be as secure as possible and looking into the documentation I found the following:

  • Your database must be installed on an NT file system (NTFS)
  • Do not create a shared database in your system folders or in your Documents and Settings folders.
  • grant Full Control permissions to only those in the VSS Administrator Group

    Folder Tip for XP users


    Windows XP-2000-NT Tip #542: Missing Security Tab in Windows XP: "To reveal the Security tab, open Windows Explorer, and choose Folder Options from the Tools menu. On the View tab, scroll to the bottom of the Advanced Settings and clear (click) the check box next to 'Use Simple File Sharing.' Click OK to apply the change, and you should now have a Security tab when viewing the properties of a file on an NTFS volume."

  • Saturday, August 16, 2003

     

    Free tools from Microsoft


    I've been researching on tools to fine tune my development site and fortunately I found this from Microsoft: Visit the page now at Free Tool Downloads

    One particular tool is the XCalcs.exe which does a lot more than the calcs.exe. The Xcacls.exe utility is included in the Windows 2000 Resource Kit . You can download the Xcacls.exe utility from the following Microsoft Web site:
    Xcalcs.exe download

    Best E-mail Utility so far


    I have been looking for a one-stop program that will notify me of my e-mail from various sites and at last I found one. This program is from Eprompter.com You can download the program to see how it works. Truly recommended.

    Visual Studio Project File conversion


    Diego Gonzalez discusses a snippet on how to convert projects between Visual Studio 2003 and 2003 with this trick.

    This page is powered by Blogger. Isn't yours?