什么是在Linux的tr
命令的Windows相当于?
例如, tr
可以用换行符replace所有的冒号。 这可以在Windows中完成吗?
$ echo $PATH | tr ':' '\n' /usr/local/bin /usr/bin
在PowerShell中我们分裂了
看到这个例子
$a=( echo $env:Path | Out-String ) $a -split ";"
之前:
%SystemRoot%\system32\WindowsPowerShell\v1.0\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System 32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Prog ram Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files\Micros oft SQL server\110\Tools\Binn\;C:\Program Files (x86)\010 Editor;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web P ages\v1.0\;C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Microsoft Visual Studio\Common\Tools\Win NT;C:\Program Files (x86)\Microsoft Visual Studio\Common\MSDev98\Bin;C:\Program Files (x86)\Microsoft Visual Studio\Com mon\Tools;C:\Program Files (x86)\Microsoft Visual Studio\VC98\bin;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Com mon Files\Intel\WirelessCommon\
后:
> %SystemRoot%\system32\WindowsPowerShell\v1.0\ C:\Windows\system32 > C:\Windows C:\Windows\System32\Wbem > C:\Windows\System32\WindowsPowerShell\v1.0\ C:\Program > Files\Intel\WiFi\bin\ C:\Program Files\Common > Files\Intel\WirelessCommon\ C:\Program Files (x86)\ATI > Technologies\ATI.ACE\Core-Static C:\Program Files > (x86)\QuickTime\QTSystem\ C:\Program Files\Microsoft SQL > server\110\Tools\Binn\ C:\Program Files (x86)\010 Editor C:\Program > Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\ C:\Program Files > (x86)\Windows Kits\8.0\Windows Performance Toolkit\ C:\Program > Files\Microsoft\Web Platform Installer\ > C:\Windows\System32\WindowsPowerShell\v1.0\ C:\Program Files > (x86)\Microsoft Visual Studio\Common\Tools\WinNT C:\Program Files > (x86)\Microsoft Visual Studio\Common\MSDev98\Bin C:\Program Files > (x86)\Microsoft Visual Studio\Common\Tools C:\Program Files > (x86)\Microsoft Visual Studio\VC98\bin C:\Program > Files\Intel\WiFi\bin\ C:\Program Files\Common > Files\Intel\WirelessCommon\
有一个丑陋的批次黑客:
echo "%path:;="&echo "%"