![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Scripts and Preprocessor Directives I stumbled across this feature by accident recently, when commenting a particular script. As some of you may already be aware, you can insert a '#requires' statement into a script, for example #requires -pssnapin MyCmdletsPSSnapIn which ensures that a particular required snapin is available, and #requires -version 1 specifies that a particular version of PowerShell is required. Which kinda begs the question... Are there any other such 'directives', and if so, are they documented (or discoverable) anywhere? (NB I've used the term 'Preprocessor Directive', but there may well be a better term for describing them). Any thoughts or insights appreciated. Thanks. -- Jon |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Scripts and Preprocessor Directives The "#requires" statement must be in one of the following formats: #requires -shellid <shellID> #requires -version <major.minor> #requires -pssnapin <psSnapInName> [-version <major.minor>] HTH ----- Shay Levi $cript Fanatic http://scriptolog.blogspot.com Hebrew weblog: http://blogs.microsoft.co.il/blogs/scriptfanatic Quote: > I stumbled across this feature by accident recently, when commenting a > particular script. As some of you may already be aware, you can insert > a '#requires' statement into a script, for example > > #requires -pssnapin MyCmdletsPSSnapIn > > which ensures that a particular required snapin is available, and > > #requires -version 1 > > specifies that a particular version of PowerShell is required. > > Which kinda begs the question... > > Are there any other such 'directives', and if so, are they documented > (or > discoverable) anywhere? > (NB I've used the term 'Preprocessor Directive', but there may well be > a > better term for describing them). > Any thoughts or insights appreciated. Thanks. > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| run .cmd scripts on remote machine (automating the MOSS install via scripts) | PowerShell | |||
| Re: Scripts and Preprocessor Directives | PowerShell | |||
| PS scripts -> VBS | PowerShell | |||
| run different scripts | PowerShell | |||
| UAC and scripts (.wsf) | Vista security | |||