Kurt,

please note that there is a fundamental difference between running a batch file from a command line interpreter and executing it from a Windows application through, say, CreateProcess or ShellExecuteEx Windows APIs. To launch external programs from a Windows application, you have to use CreateProcess or ShellShecute(Ex). In your case, SetupBuilder executes Powershell (gives *complete* control to it) and waits until Powershell returns. If your script fails when executed from a CreateProcess or ShellExecute Windows APIs then there is a problem with the script (this has nothing to do with SetupBuilder). Remember: Powershell executes your script, not SB. For example, your script expects a specific current folder or access to a specific registry branch. To check what the problem in your script is, simply write your own small 32-bit program with Visual C or Delphi or Clarion and call your script with the exact same command line parameters your are currently using in SB (call PS/your script and wait for its termination). I am sure you'll get the very same error.

But if it works from the command line interpreter, why don't you simply call your batch file from the installer in an interpreter? From a Windows program, you do it via CMD.EXE. Just calling the batch without CMD /C is not correct and might fail.

For example:

cmd /C c:\mydir\MyBatch.bat

in a "Run Command Line..." or "Run Program..." SB function.

As a side note: perhaps this is a x64 operating system and your script tries to read a 64-bit registry value, but the value is stored in the 32-bit branch (or vice-versa!). And that's why it fails when running Powershell in 32-bit mode. Maybe it's looking in the wrong registry branch?

32-bit programs and 64-bit programs that are running on a x64-based version of Windows operate in different modes and use the following sections in the registry:

1. Native mode 64-bit programs run in Native mode and access keys and values that are stored in the following registry sub key:

HKEY_LOCAL_MACHINE\Software

2. 32-bit programs run in WOW64 mode and access keys and values that are stored in the following registry sub key:

HKEY_LOCAL_MACHINE\Software\WOW6432node

Does this help a bit?

Friedrich