/build/static/layout/Breadcrumb_cap_w.png

WiseScript Command Line

Seems I forgot something about WiseScript.

[8D]

I remember that there was a way to get the command line passed to the EXE through a variable. I used to rely on this post but the example files are missing!

http://www.myitforum.com/articles/5/view.asp?id=2189

I'm not doing so well with Google so I thought I would ping the board and see if anyone knows this off the top of their head.

0 Comments   [ + ] Show comments

Answers (3)

Posted by: AngelD 15 years ago
Red Belt
0
WiseInitCmdLine?
Posted by: norexx 15 years ago
Orange Belt
0
I'm in the same boat as you, kkaminsk, and unfortunately, don't have much to offer except a link and specific page in the new WiseScript 7.0 Reference Guide: altiris.com/upload/wisescripteditor_005.pdf

Page 144 references "CMDLINE", defined as "The command line options passed to the installation .EXE." Unfortunately, they don't tell you precisely how to make good use this variable, much less provide any real-world examples.

It looks to me like anything past "<filename>.exe" gets parsed and vaiable-ized (automatically?) as "CMDLINE", which you can use in your Wisescript. Something like:

If "%CMDLINE%" = "/install" then Execute (something...)
If "%CMDLINE%" = "/uninstall" then Execute (something else...)

If this really works, great, but I haven't proven this through trial-and-error yet.
Posted by: norexx 15 years ago
Orange Belt
0
I tried out the "CMDLINE" automatic runtime variable, and it works like a charm! Example:

Set Variable INST_PARAM to %CMDLINE%
Display Message "Installation Parameter" (Message text = "%INST_PARAM%")

Running a compiled Wisescript EXE from the command line with no parameter ("Setup.exe") generates a dialog with empty quotes.
Running "Setup.exe /install" generates a dialog with "/install".
Running "Setup.exe /clean" generates a dialog with "/clean".*
(*see below on why I used "clean" vs. "remove" or "uninstall")

So... if you wanted to wrap an MSI inside your Wisescript EXE and run it, you'd need something like this:

Remark - Extract the package Installation Files to standad xMWS location...
Install File .\<msi filename>.msi to C:\<your target folder>\<msi filename>.msi
Install File .\<mst filename>.msi to C:\<your target folder>\<mst filename>.mst
Install File .\<cab filename>.cab to C:\<your target folder>\<msi filename>.cab

Remark - Parse, validate and execute Command Line with parameter
Set Variable INST_PARAM to %CMDLINE%

If INST_PARAM Equals (Ignore Case) "" then
Display Message "Missing or Invalid Command Line Parameter"
Exit Installation
End

If INST_PARAM Equals (Ignore Case) "/install" then
Execute %SYS32%\MSIEXEC.EXE /I "C:\<your target folder>\<msi filename>.msi" TRANSFORMS="C:\<your target folder>\<mst filename>.mst" REBOOT=ReallySuppress /l+*v "C:\<your target folder>appname.log" /qb- (wait)
Exit Installation

ElseIf INST_PARAM Equals (Ignore Case) "/clean" then
Execute %SYS32%\MSIEXEC.EXE /X "C:\<your target folder>\<msi filename>.msi" TRANSFORMS="C:\<your target folder>\<mst filename>.mst" REBOOT=ReallySuppress /l+*v "C:\<your target folder>appname.log" /qb- (wait)
Exit Installation

Else
Display Message "Missing or Invalid Command Line Parameter"
Exit Installation
End


Now... that said, there are a couple of things you ought to be aware of:

1) Some letters are reserved by WiseScript as built-in install/uninstall command-line parameters. This means that the first two characters of your custom "CMDLINE" parameter cannot be any of the following: /A, /M, /R, /S, /T, /U, /X, /Z

So, if for example, you use "/remove", or "/uninstall", your WiseScript EXE will only recognize the "/r" or "/u" and ignore the rest.

Sources:
http://forums.altiris.com/messageview.aspx?catid=19&threadid=53636&enterthread=y
http://www.altiris.com/upload/wisescripteditor_005.pdf (pages 154-155)


2) There appears to be a reported known bug with "Include Script" command, where a compiled WiseSript EXE only executes the first instance of an included script.

Source:
http://itninja.com/question/how-do-you-roll-out-new-machines?0125


Hope this helps.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ