I have to create a PowerShell script which does exactly same thing as my previous script, but this time I have to read a CSV file instead of an XML file. My plan is to create a PowerShell script which has common functions required for both scripts and re-use this common script file in both main files.
Suppose I create 2 main files in 2 directories in C:\ drive and keep my common file and other 3rd party libraries in a folder of D:\ drive, e.g. C:\script_1_folder\Script1.ps1, C:\script_2_folder\Script2.ps1 and common file and 3rd party libraries will be in D:\script_common.
How do I call\re-use common file in my main files (how to get the path, do I have to create an instance of common file and how do I use it)
What is the difference between
$script_path = $myinvocation.invocationname; $script_folder = split-path $script_path -parent; write-host $script_folder $script_name = split-path $script_path -leaf; $current_folder = [system.io.directory]::getcurrentdirectory() [system.io.directory]::setcurrentdirectory($script_folder) Set-Location $script_folder add-type -path ".\AlexFTPS-1.1.0\AlexPilotti.FTPS.Client.dll"and
$path = (split-path $MyInvocation.MyCommand.Path) $loggerPath = $path + "\Logger\release\Logger.ps1"; .$loggerPath; $logger = Logger; $logger.load($path + "\Logger\config\log4ps.xml","log.log");and what is the best way to do it with regard to my problem?
How do I create a temp folder in windows temp folder?