path

Add new directory in PATH user variable with Setx don't work

时光总嘲笑我的痴心妄想 提交于 2020-11-29 23:51:00
问题 In a .bat script, I want to add a specific list of directory in PATH user variable. Initially, path is like this : C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Novell\iPrint;C:\Program Files\WindowsPowerShell\Scripts\HP.ClientScriptLibrary;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\dotnet\;C:\Program Files (x86)\Yarn\bin\;C:\Program Files\Docker\Docker\resources\bin;C:

Add new directory in PATH user variable with Setx don't work

霸气de小男生 提交于 2020-11-29 23:47:03
问题 In a .bat script, I want to add a specific list of directory in PATH user variable. Initially, path is like this : C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Novell\iPrint;C:\Program Files\WindowsPowerShell\Scripts\HP.ClientScriptLibrary;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\dotnet\;C:\Program Files (x86)\Yarn\bin\;C:\Program Files\Docker\Docker\resources\bin;C:

How to get first N parts of a path?

烂漫一生 提交于 2020-11-29 10:15:54
问题 Imagine a path like this: /a/b/c/d/e/... Where ... could be any number of levels further deep, i.e., I don't know, ahead of time, whether there will be 2, 3, or 13 more level deep. How can I, using a FreeBSD shell, e.g., /bin/sh , extract the first "N" parts of this path? e.g., first 4 levels, so that I would get /a/b/c/d ? 回答1: You can use cut : s='/a/b/c/d/e/f/g/h/i/j/k' echo "$s" | cut -d/ -f1-5 /a/b/c/d Or if you are using BASH then you can use shell array: IFS=/ arr=($s) Then print

How to get first N parts of a path?

耗尽温柔 提交于 2020-11-29 10:14:04
问题 Imagine a path like this: /a/b/c/d/e/... Where ... could be any number of levels further deep, i.e., I don't know, ahead of time, whether there will be 2, 3, or 13 more level deep. How can I, using a FreeBSD shell, e.g., /bin/sh , extract the first "N" parts of this path? e.g., first 4 levels, so that I would get /a/b/c/d ? 回答1: You can use cut : s='/a/b/c/d/e/f/g/h/i/j/k' echo "$s" | cut -d/ -f1-5 /a/b/c/d Or if you are using BASH then you can use shell array: IFS=/ arr=($s) Then print