Clear-Host $global:varPath = "" function main() { write-host "Ce script powershell est dans le répertoire $varPath" } Function ParseCommand($oArgs){ #Parses the command line and fills the script variables #with the appropriate values. $ArgCount = 0 if (!$oArgs.length -gt 0){ write-host "No arguments specified." } While ($ArgCount -lt $oArgs.length){ switch ($oArgs[$ArgCount].ToLower()){ "-path"{ $global:varPath = $oArgs[($ArgCount+1)] $ArgCount = ($ArgCount + 2) write-host "-path : $varPath" break } default{ write-host "Invalid command." # Help exit } } } } #Parse commands ParseCommand($args) ## Run Main main