Ben*_*ack 3 windows powershell scripting
我发现我可以$env:Path在PowerShell中使用来查看我当前的系统路径.但是,一切都在一条线上运行.有没有办法将输出$env:Path传递给另一个命令,该命令将分别打印每个路径值(即在新行上打印由分号分隔的所有内容)?
目前它打印的内容如下:
C:\Some Test Directory\With\Some\Files\In\It;C:\Some Test Directory\With\Some\Files\In\It;C:\Some Test Directory\With\Some\Files\In\It;C:\Some Test Directory\With\Some\Files\In\It;C:\Some Test Directory\With\Some\Files\In\It;
Run Code Online (Sandbox Code Playgroud)
我宁愿有这样的事情:
C:\Some Test Directory\With\Some\Files\In\It
C:\Some Test Directory\With\Some\Files\In\It
C:\Some Test Directory\With\Some\Files\In\It
C:\Some Test Directory\With\Some\Files\In\It
C:\Some Test Directory\With\Some\Files\In\It
Run Code Online (Sandbox Code Playgroud)
Jac*_*cob 13
$env:Path.split(";")
PS C:\Users\user> $env:Path.split(";")
C:\Program Files (x86)\Haskell\bin
C:\Program Files (x86)\Haskell Platform\2011.2.0.1\lib\extralibs\bin
C:\Program Files (x86)\Haskell Platform\2011.2.0.1\bin
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
C:\Windows\system32
...
Run Code Online (Sandbox Code Playgroud)
适合我.