zoe*_*uff 5 powershell powershell-2.0
我正在尝试使用Tee-Object创建一个将变量放入文件(minedown.conf)的应用程序,但每次在文件中添加内容时都会覆盖它.我正在使用
$account = Read-Host "Enter your Account SID number"
"account = $account" | Tee-Object -FilePath c:\minedown\minedown.conf
$token = Read-Host "Enter your Authority Token"
"token = $token" | Tee-Object -FilePath c:\minedown\minedown.conf
$from = Read-Host "Enter your Twilio number"
"from - $from" | Tee-Object -FilePath c:\minedown\minedown.conf
Run Code Online (Sandbox Code Playgroud)
我试图让每一个成为一条单独的线.
Tee-Object不是您要找的 CmdLet,请尝试Set-content和Add-Content。
$account = Read-Host "Enter your Account SID number"
"account = $account" | Set-content -Path c:\minedown\minedown.conf
$token = Read-Host "Enter your Authority Token"
"token = $token" | Add-Content -Path c:\minedown\minedown.conf
$from = Read-Host "Enter your Twilio number"
"from - $from" | Add-Content -Path c:\minedown\minedown.conf
Run Code Online (Sandbox Code Playgroud)
的目的Tee-Object实际上是在管道序列中充当“T”,以便将数据从输入发送到输出以及文件或变量(例如,为了调试管道序列)。
| 归档时间: |
|
| 查看次数: |
9284 次 |
| 最近记录: |