gpt-4-1106-preview· OpenAI
WildChat-4.8M (AI2)
使用cURL请求一张图片是这样的命令: curl --location ‘http://127.0.0.1:18088/chart_/kline’ –header…
- User
使用cURL请求一张图片是这样的命令: curl --location ‘http://127.0.0.1:18088/chart_/kline’ –header ‘Content-Type: application/json’ –data ‘{ “historyParam”: { “code”: “SPY” } }’
现在无需要改成用powershell请求这张图片,下载到“下载文件夹”中,设置为桌面背景后,删除掉这种图片请提供给我完整的脚本命令
- Assistant
要使用 PowerShell 来完成这些步骤,您需要按照以下步骤操作:
- 使用 PowerShell 的
Invoke-WebRequest来发送请求并下载图片。 - 将图片保存到下载文件夹中。
- 设置图片为桌面背景。
- 删除下载的图片。
以下是一个完成这些步骤的 PowerShell 脚本示例:
# 定义请求URL和参数 $url = 'http://127.0.0.1:18088/chart_/kline' $body = @{ historyParam = @{ code = "SPY" } } | ConvertTo-Json # 定义保存图片的路径(替换为实际的下载文件夹路径) $downloadPath = "$HOME\Desktop\Image.jpg" # 发送请求并保存图片 $response = Invoke-WebRequest -Method Post -Uri $url -ContentType 'application/json' -Body $body -OutFile $downloadPath # 设置桌面背景 Add-Type -TypeDefinition @" using System; using System.Runtime.InteropServices; public class Wallpaper { [DllImport("user32.dll", CharSet = CharSet.Auto)] public static extern int SystemParametersInfo(int uAction, int uParam, string lpvParam, int fuWinIni); } "@ # SPI_SETDESKWALLPAPER 表示更改桌面背景 # 0 表示更新用户配置文件 $SPI_SETDESKWALLPAPER = 0x0014 $UPDATE_INI_FILE = 0x01 $SEND_CHANGE = 0x02 [Wallpaper]::SystemParametersInfo($SPI_SETDESKWALLPAPER, 0, $downloadPath, $UPDATE_INI_FILE -bor $SEND_CHANGE) # 等待简单的延迟,确保桌面背景设置完成 Start-Sleep -Seconds 3 # 删除下载的图片文件 Remove-Item -Path $downloadPath - 使用 PowerShell 的
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.