content

» Path Find - Sample Meta-Update Scripts

Output

c:\ >>> SthMupd.exe PathFind.ini Do -ptn SthMupd.exe

Meta-Update Version 5.77 (x64) for ARS lib 9.1.0
[Do] Lp: 9 of 45: Until= condition taken on iteration:
      9 at 110-PathFind.ini [Do] Until line: 60.
[Do] Lp: 9 of 45: Msg: .
[Do] Lp: 9 of 45: Msg: .
[Do] Lp: 9 of 45: Msg: file SthMupd.exe found in:
      d:\Apps\Sth\Mupd_577\bin
[Do] Lp: 9 of 45: Msg: .
[Do] Lp: 9 of 45: Msg: .

More Information

These scripts are in the Meta-Update distribution and may be run with a trial license. They are fully documented in the Meta-Update User's Guide

 
What It Does

Finds a file along the path (or any path-like) environment variable.

What It Shows

This is an enhancement of Path List script with the output file removed.

  • How to use a Loop = String
  • How to reference a value when that reference is itself a reference
  • How to use Output = to create a file

Details

Take the Path List script, delete the output file, and, in the AssignPre, when the individual path element is assigned, instead of a Message, see if the file exists with a simple "dir" process.

We still use Loop= String to iterate through the path elements but we add the Until= keyword to limit the Loop= once the file is found.

The AssignPre= simply issues a directory command with the file appended to the path element.

The @spawn command sets a few fields in the Tag "V":

@rc Pocess return. (like ERRORLEVEL)
stdout The process' stdout as a string.
stderr Actual file are deleted.
dir returns a zero if a file was found or 1 if not. We don't care what's in $V, stdout$ or $V, stderr$.