[PS1] Create Commands with functions and alias
si chemin contient ":" alors fonction suivante et que le chemin n'existe pas, on le crée et on attribut ce chemin à la viariable:
If path contains ":" then next function and the path does not exist, we create it and we attribute this path to the variable:
function modulopath{param([Parameter(Position=0,Mandatory=$true,ValueFromPipelineByPropertyName=$true)][AllowEmptyString()][string]$a);if($a -match ‘:’){$path = [string]($a.split(":")[0]) + ":" + [string]($a.split(":")[1]);if(!(Test-Path $path)){New-Item -ItemType Directory -Force -Path $path | out-null;$a = $path;return $a}}}
Set-Alias -force usefolder modulopath -Option AllScope -ErrorAction SilentlyContinue
$toto = usefolder "C:\toto:"
write-host $toto => C:\toto
(
ça semble sans intérêt pour l'instant, mais ce petit module va s'avérer très utile pour le CompatibilityTool en cours de réflexion
It seems uninteresting at the moment, but this small module will prove very useful for the CompatibilityTool being considered
)
/image%2F0881799%2F20140610%2Fob_a8c7fe_logo2.jpg)
Commenter cet article