PrimalScript lets you use meta-comments to determine how and where your scripts are run. You can run them in 32 or 64-bit mode, elevated or not, remotely or locally, and so on.
Meta-comments override your current platform settings.
Syntax for meta-comments
•%ForcePlatform%=32 | 64
# %ForcePlatform%=64 (runs the script in 64-bit mode)
•"%ForceElevation%"=true | false
# %ForceElevation%=yes (runs the script elevates)
•%ForceShell%=Name
# %ForceShell%=PowerShell 64 bit (runs the script in 64-bit Windows PowerShell)
# %ForceShell%=PowerShell Elevated (runs a Windows PowerShell script elevated)
•%ForceHost%=Hostname[,User[,password]]0
# %ForceHost%=JABBA (runs the script on a remote computer named JABBA)
•%ForceCodePage%=Codepage
•%ForceSTA%=true | false
You can combine meta-comments. For example, the following meta-comments run the script in 64-bit mode *and* elevated:
You can also use meta-comments to specify optional credentials. For example, the following meta-comments force the script to run on the JABBA computer and prompt for user name and password:
# %ForceHost%=JABBA,Prompt
The following meta-comments force the script to run on JABBA, but prompt for a password only when the user name is "Alex":
# %ForceHost%=JABBA,Alex,Prompt
See also:
Examing Variables and Object Properties