Jump to content











Photo

HowTo use WinBuilder command line


  • Please log in to reply
3 replies to this topic

#1 pscEx

pscEx

    Platinum Member

  • Team Reboot
  • 12707 posts
  • Location:Korschenbroich, Germany
  • Interests:What somebody else cannot do.
  •  
    European Union

Posted 15 May 2007 - 03:57 PM

For people not familar with command line batch files, I should have to explain a lot on XP cmd statements and features. This would exceed the frame of this forum.
For people familar with command line batch files, here a batch wich works:

REM ******* The next 4 lines must be defined individually
SET PrjName=nativeEx_barebone
SET BaseDir=C:\Dokumente und Einstellungen\Peter\Desktop\WB Archiv\Beta8
SET setOpt=%BaseDir%\pscProgs\setOptions\setOptions.exe
SET WB=%BaseDir%\WinBuilder071B1.exe

REM ******* The next 5 lines can remain unchanged
SET Project=%BaseDir%\Projects\%PrjName%
SET WBConst=/run="%Project%" /title="My Project" /x=10 /y=50
SET tg=%BaseDir%\Target\%PrjName%
SET iso=%BaseDir%\ISO\%PrjName%
SET log=%BaseDir%\Support\Log\%PrjName%

REM ******* If the directory for your log files does not exist, you must create it here.
REM ******* WinBuilder does not (yet) create it.
MD "%BaseDir%\Support\Log"
MD "%BaseDir%\Support\Log\%PrjName%"

REM ******* The next lines call Main with my individual OS / language combination
REM ******* Maybe four you different statements are better suited
REM ******* Last line MUST be: "GOTO :EOF"
FOR /D %%s IN (V:\BCD\cds\XPP_*SP2) DO CALL :Main %%~ns %%s
FOR /D %%s IN (V:\BCD\cds\W2003_*) DO CALL :Main %%~ns %%s
GOTO :EOF


:Main
REM ******* Here you can build different sets of your project to produce
REM ******* In the first set you have to define everything what is important
REM ******* and may be different from the actual project
REM ******* In the following sets you only need to define what is changed
REM ******* The setOpt program and this sample batch can be download from:
REM ******* http://nativeex.boot.../setOptions.zip

REM ******* index must be individual for each set and should contain a hint to OS, service pack and language

SET index=_%1_STD_R_R
REM Standard ISO, RAMDisk
"%setOpt%" "-O:!Fundamentals.script:Interface.pScrollBox1=B:" "-P:%Project%"
"%setOpt%" "-O:!Fundamentals.script:Interface.pScrollBox3=RAM Drive" "-P:%Project%"
"%setOpt%" "-O:RAMDisk.script:Main.Selected=True" "-P:%Project%"
"%setOpt%" "-O:CreateISO.script:Main.Selected=True" "-P:%Project%"
"%setOpt%" "-O:BootSDI.script:Main.Selected=False" "-P:%Project%"
"%WB%" %WBConst% /target="%tg%%index%" /ISO="%iso%%index%.iso" /log="%log%%index%.html" /source="%2"

SET index=_%1_SDI_R_R
REM BootSDI, RAMDisk, SettingsDrive = RAM Drive
"%setOpt%" "-O:!Fundamentals.script:Interface.pScrollBox3=RAM Drive" "-P:%Project%"
"%setOpt%" "-O:CreateISO.script:Main.Selected=False" "-P:%Project%"
"%setOpt%" "-O:BootSDI.script:Main.Selected=True" "-P:%Project%"
"%WB%" %WBConst% /target="%tg%%index%" /ISO="%iso%%index%.iso" /log="%log%%index%.html" /source="%2"

SET index=_%1_SDI_R_S
REM BootSDI, RAMDisk, SettingsDrive = System Drive
"%setOpt%" "-O:!Fundamentals.script:Interface.pScrollBox3=System Drive" "-P:%Project%"
"%WB%" %WBConst% /target="%tg%%index%" /ISO="%iso%%index%.iso" /log="%log%%index%.html" /source="%2"

SET index=_%1_SDI_N_N
REM BootSDI, no RAMDisk
"%setOpt%" "-O:!Fundamentals.script:Interface.pScrollBox1=--" "-P:%Project%"
"%setOpt%" "-O:RAMDisk.script:Main.Selected=False" "-P:%Project%"
"%WB%" %WBConst% /target="%tg%%index%" /ISO="%iso%%index%.iso" /log="%log%%index%.html" /source="%2"

On my system it generates persistent log files:http://www.boot-land.net/forums/index.php?showtopic=2200&st=0#
Complete Edit
Attached File  Logs.gif   29.92KB   181 downloads
and persistant target directories
Attached File  TargetDir.gif   14.76KB   165 downloads
and persistant ISOs
Attached File  ISODir.gif   15.42KB   161 downloads
which is the base of a 'universal' test.

For this batch I wrote a small program setOptions which changes single scripts.
This program and the sample batch can be download here.

BTW: You should always refer to this URL. The script above is an sample written when creating this post.
There may be some actual changes, but only on my server.

Peter
  • devdevadev likes this

#2 Alexei

Alexei

    Silver Member

  • .script developer
  • 664 posts

Posted 16 May 2007 - 08:32 AM

@Peter,
Some things has to be changed in your batch.
We have two ways of doing this:
- I post my version here
- I post what needs changes any why.
Which way would you prefer?
:confused1:
Alexei

#3 pscEx

pscEx

    Platinum Member

  • Team Reboot
  • 12707 posts
  • Location:Korschenbroich, Germany
  • Interests:What somebody else cannot do.
  •  
    European Union

Posted 16 May 2007 - 09:12 AM

@Peter,
Some things has to be changed in your batch.
We have two ways of doing this:
- I post my version here
- I post what needs changes any why.
Which way would you prefer?
:confused1:
Alexei

I prefer if you explain what and why.

Peter

#4 Alexei

Alexei

    Silver Member

  • .script developer
  • 664 posts

Posted 16 May 2007 - 11:43 AM

I prefer if you explain what and why.

Peter


@Peter,

In general I like your batch. It just needs some changes to be useful to everybody.
How to arrange programs (including batches) highly depends on personal preferences.
However, regardless of how it actually constructed it should include several parts:

1. environment settings (path to WB, path to setOptions.exe, etc.)
Reasonable defaults would be nice: winbuilder.exe and setOptions.exe are in the %base dir%, which is current dir and may be omitted - extracted from %0, default wb name set to winbuilder.exe, etc.

2. list of builds to make (BuildAll.bat?)
I believe it should be several lines like that
call Build.bat name settings source
, where name is a Build identification ("index" in your batch),
settings is a name of a setting set (see 3.)
source is a path to the MS files, by default may be defined in "environment settings"

3. settings for each build (in a separate file?)
set of "%setOpt%" "-O:!Fundamentals.script... lines

Now we have to find a way to make it convenient to both sides :confused1:

First, I highly dislike editing downloaded batch files (getting messy with updates for sure).
There are two solutions to that:
- have a separate batch that passes parameters to downloaded batch (directly or by setting env variables).
- have a batch that modifies downloaded batch (I wrote it a while ago).

Having all sets of settings together in a one file has some advantages, but we'd like to support user's sets.

To clarify what I meant, here is kind of sample:
- BaseBuild - batch file, when run directly executes with Peter's defaults
("Peter's" instead of "your" used for clarity because "your" is often used to refer "you, who reads it").
- UserBuild - batch file, defines user environment and calls BaseBuild or BuildAll
- BuildAll - optional batch with a set of user-defined builds
- UserSets - optional batch file with additional sets of settings, called from BaseBuild or BuildAll
The "proposal" above requires BaseBuild to be rather complex, but allows Peter still use just one batch.

Another approach is cleaner, but requires Peter to handle more then one batch:
- UserBuild - defines user environment (Peter has to have his own UserBuild).
- BuildAll - defines what to build (Peter may want to generate it from contents of his V: drive)
- DefaultSets - Peter's sets of settings
- UserSets - User's sets of settings (optional)
- Build - performer of one build, called from BuildAll

Anyway, you should agree that "FOR /D %%s IN (V:\BCD\cds\XPP_*SP2)" in the middle is just :confused1:
Of course, you meant: "Here is the batch that works for me. You can modify it for your own needs."
However, this is way different from "Here is the batch you can use. To use it you just..."

WB rollout:
Let's suppose
- new directory created
- WB downloaded
- WB started, scripts downloaded via download center
- setOptions downloaded and unzipped
- batch downloaded
- source location is defined
At this point running the batch should produce a set of valid builds.

In fact, the minimal fix is to specify "FOR /D %%s IN (V:\BCD\cds\XPP_*SP2)" in a set command, also make missuing directories (Target, etc.).

BTW, why not to have all logs in the %BaseDir% to look at without browsing the tree? Though, it's personal preference :confused1:

My batch to modify sets in another batch.
You have to pass %x% as %%%%x%%%%, otherwise current value of %x% be substituted.
@ECHO OFF

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: This batch changes values of SET commands in specified files

:: Parameters: file-name set-var-name "set-var-value"

:: Notes:

:: - Leading and trailing quotation marks are always stripped

::   from "set-var-value" (should be always present)

:: - Set names are case insensitive (original case is preserved)

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: rename source file

if (%1) == () echo Missing parameter & goto :EOF

setlocal

:: dequote, etc.

  set oldname=%~nx1

  set newname=_%~nx1

  set wpath=%~dp1

:: dequote value

  set newval=%3

  call set newval=%%newval:^~1,-1%%

  call echo File "%oldname%"  set %%2=%%newval%%

:: rename source file

  pushd %wpath%

  if exist "%newname%" erase "%newname%"

  rename "%oldname%" "%newname%"

:: copy file, changing set=var

for /F "tokens=1,* skip=2 delims=[]" %%A in ('find /N /V "" "%newname%"') do (

  if "%%B" == "" (echo.>>"%oldname%") else (

	call set p=?

	for /F "tokens=1,2 delims=^= " %%T in (" %%B " ) do (

	  if /I "%%T"=="set" if /I "%%U"=="%2" (

		for /F "tokens=1 delims=^=" %%K in ("%%B") do call set p=%%K

	  )

	)

	for /F %%T in ('call echo %%p%%') do (

	  if "%%T"=="?" (echo %%B>>"%oldname%") else (

		call echo %%p%%^=%%newval%%>>"%oldname%"

		echo Replaced - OK

	  )

	)

  )

)

:: erase renamed source file

erase "%newname%"

popd

endlocal





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users