Differences
This shows you the differences between the selected revisions of the page.
2014-10-01 | 2014-12-05 | ||
&win9x (martin) | deriving path to assembly from script path (martin) | ||
Line 44: | Line 44: | ||
Add-Type -Path "WinSCPnet.dll" | Add-Type -Path "WinSCPnet.dll" | ||
</code> | </code> | ||
+ | |||
+ | Had you need to run the script from other directory, you need to specify a full path to the assembly. You can derive the path from the script file path using ''[[http://technet.microsoft.com/en-us/library/hh847768.aspx|$PSScriptRoot]]'' automatic variable:((In PowerShell 1.0 and 2.0, use ''%%Add-Type -Path (Join-Path (Split-Path $script:MyInvocation.MyCommand.Path) "WinSCPnet.dll")%%'')) | ||
+ | |||
+ | <code powershell> | ||
+ | Add-Type -Path (Join-Path $PSScriptRoot "WinSCPnet.dll") | ||
+ | </code> | ||
+ | |||
+ | |||
==== [[enums]] Accessing Enumeration Values ==== | ==== [[enums]] Accessing Enumeration Values ==== |