{"id":1940,"date":"2015-12-24T23:32:44","date_gmt":"2015-12-24T22:32:44","guid":{"rendered":"http:\/\/www.yanael.com\/?p=1940"},"modified":"2015-12-27T10:36:24","modified_gmt":"2015-12-27T09:36:24","slug":"modifier-prompt-powershell-fonction-pour-ajouter-dossier-sous-dossier","status":"publish","type":"post","link":"https:\/\/www.yanael.com\/wp\/modifier-prompt-powershell-fonction-pour-ajouter-dossier-sous-dossier-1940\/","title":{"rendered":"Modifier Prompt Powershell – Fonction pour ajouter dossier \/ sous dossier"},"content":{"rendered":"
Un bout de code int\u00e9ressant, voir indispensable \ud83d\ude09<\/p>\n
[codesyntax lang=”powershell”]<\/p>\n
function prompt {\r\n $cwd = (get-location).Path<\/pre>\n[array]$cwdt=$()
\n$cwdi=-1
\ndo {
\n$cwdi=$cwd.indexofany(\u201d\\\\\u201d,$cwdi+1)
\n[array]$cwdt+=$cwdi} until($cwdi -eq -1)<\/p>\nif ($cwdt.count -gt 3) {
\n$cwd = $cwd.substring(0,$cwdt[0]) + \u201c\\..\u201d + $cwd.substring($cwdt[$cwdt.count-3])
\n}<\/p>\n\u201d $cwd>_ \u201d
\n}
\n# The above sets prompt to the current drive letter, immediate sub directory and current directory.
\n#\u00a0\u00a0\u00a0\u00a0 Example: C:\\..\\drivers\\etc>_<\/p>\nImport-Module Pscx #-arg ~\\Pscx.UserPreferences.ps1<\/p>\n
[\/codesyntax]<\/p>\n \n","protected":false},"excerpt":{"rendered":"
Un bout de code int\u00e9ressant, voir indispensable \ud83d\ude09 [codesyntax lang=”powershell”] function prompt { $cwd = (get-location).Path [array]$cwdt=$() $cwdi=-1 do { $cwdi=$cwd.indexofany(\u201d\\\\\u201d,$cwdi+1) [array]$cwdt+=$cwdi} until($cwdi -eq -1) if ($cwdt.count -gt 3) { $cwd = $cwd.substring(0,$cwdt[0]) + \u201c\\..\u201d + $cwd.substring($cwdt[$cwdt.count-3]) } \u201d $cwd>_ \u201d } # The above sets prompt to the current drive letter, immediate sub directory […]<\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0},"categories":[4,203,202],"tags":[144,310,309,206,308,240],"yoast_head":"\n
Modifier Prompt Powershell - Fonction pour ajouter dossier \/ sous dossier | Tranches de Veek<\/title>\n\n\n\n\n\n\n\n\n\n\t\n