WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Miscellaneous

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Cute BAT file trick to embed WinBatch code in a DOS BAT file

In this unusual smaple code, the BAT code and WinBatch code is contained within a single file. This code is not compilable.
%param1%@goto exec

;This cute BAT file technique allows you to embed WinBatch code into a
;a BAT file.  It does require that the WinBatch.ee file be either
;hard coded into the script or on your path.

;It also requires the WinBatch program to be installed on your computer

; include your winbatch code here

;Sample code that displays a passed parameter, if any
message("Some Title","And Parameter one is %param1%") ; Naughty use of %substitution%

; end of winbatch code
exit


:exec
@echo off
if exist %0 goto suite
C:\Progra~1\WinBatch\System\WinBatch.exe %0.bat "param1='%1%' ;"
goto fin
:suite
C:\Progra~1\WinBatch\System\WinBatch.exe %0 "param1='%1%' ;"
:fin 

Article ID:   W16018
File Created: 2004:03:30:15:42:18
Last Updated: 2004:03:30:15:42:18