Page 1 of 1

How do I get the script version in code please?

Posted: Tue Mar 11, 2014 9:12 am
by grathal
Hello,

Is there a way please to get the version of my script in my code? I'm trying to put a small "v1.0" in the corner of a form.

Does PS 2012 also do auto-incrementing of the version?

I saw the %AppVersion% variable can be used in templates but I don't think that's the same.

Thx.

Re: How do I get the script version in code please?

Posted: Tue Mar 11, 2014 11:40 am
by davidc
There are two way of doing this depending on what you do with the script:

1. If you package the script into an EXE you can use the following:

[System.Windows.Forms.Application]::ProductVersion

This will pull the version number from the running executable if you are using a GUI Form.

2. If you are not using a package exe, you can use a variable to store your version number (which you define in the script) and display it.

David