小编Sea*_*...的帖子

是否可以将写入命令的输出保存在文件中?(API 和 Powershell)

我刚刚开始使用 Powershell,已经遇到了问题。\n我正在使用 OpenWeathermap ( https://openweathermap.org/ ) 的 API 来创建类似天气机器人的东西。

\n

我正在使用 API 中的这个函数:

\n
Write-WeatherCurrent -City $place -ApiKey $ApiKey -Units metric\n
Run Code Online (Sandbox Code Playgroud)\n

输出是这样的(如果我填写变量):\n10.2\xc2\xb0C (\xe2\x98\x81\xef\xb8\x8f 几朵云) in london

\n

所以我希望这个输出保存在文件中。我已经尝试过使用命令输出文件和>>。但它仅在终端中输出并且文件为空。我不确定,但是是因为“Write”-WeatherCurrent吗?

\n

如果有人能帮助我,我会很高兴:D

\n

谢谢

\n

api powershell openweathermap

1
推荐指数
1
解决办法
75
查看次数

标签 统计

api ×1

openweathermap ×1

powershell ×1