Files
MemRelay/projects/d5a7f581-c442-4554-87b9-ee723b8b0258/坑:PowerShell 常见陷阱(引号-乱码-代理).md
T

20 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: 坑:PowerShell 常见陷阱(引号/乱码/代理)
type: experience
permalink: main/projects/d5a7f581-c442-4554-87b9-ee723b8b0258/坑-power-shell-常见陷阱引号-乱码-代理
stable_id: 9f00df57-ec45-4d63-9da6-9b2fb16c2d6b
scope: project
project_id: d5a7f581-c442-4554-87b9-ee723b8b0258
memory_type: experience
status: active
revision: 1
restored_from_commit: 6a6a895eafcca6052e81a14fca103a42635dd1c2
created_at: '2026-09-23T15:09:59.408671+00:00'
updated_at: '2026-09-23T15:09:59.408731+00:00'
tags:
- pitfall
- powershell
- windows
---
1) curl.exe 传 JSON body:PowerShell 会吃掉双引号,最稳方法是先 Set-Content 写临时 json 文件再 --data-binary "@file"(用完删除)。2) rg 搜索含反斜杠/双引号的 pattern 易触发 PS 解析错误,用单引号包 pattern。3) 控制台中文输出常显乱码(GBK/UTF-8 混用),不影响实际执行,判断成败看 exit code 和关键英文/数字。4) && 不可用,用 ; 串联;重定向用 2>$null。5) 系统有全局代理(127.0.0.1:7897),访问内网地址要 --noproxy。