[求助]Mac 通过命令修改 autoproxy 失败,报错 Error: The parameters were not valid。

2014-10-17 23:48:37 +08:00
 yxjxx

最近时常需要修改auto proxy url,找到了一个alfred workflow
但是好像在有线网下不能工作,便想尝试自己看看代码,写个脚本什么的,好在代码也不长,一会就知道了原理。这是apple官网了关于networksetup命令的手册。 https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man8/networksetup.8.html

-setautoproxyurl networkservice url
      Set proxy auto-config to url for <networkservice> and enable it.

但是奇怪的问题是设置on, off的时候都很正常,也能生效
networksetup -setautoproxystate “Thunderbolt Ethernet” off
networksetup -setautoproxystate “Thunderbolt Ethernet” on

但是一旦加上url参数就报错Error: The parameters were not valid.
networksetup -setautoproxystate “Thunderbolt Ethernet” “hehe”
networksetup -setautoproxystate “Thunderbolt Ethernet” “http://p.getxxxxxx.com/paths/xxxxxx.pac

是字符转义的原因?尝试过添加转义符,和先把url赋值给变量,再用变量做参数都不行。

求帮助!

2957 次点击
所在节点    macOS
3 条回复
kfll
2014-10-18 07:53:45 +08:00
我猜你很快就知道哪里错了
yxjxx
2014-10-18 11:08:20 +08:00
@kfll 恕我愚钝,还望明示。
yxjxx
2014-10-18 11:14:59 +08:00
@kfll 好吧 setautoproxystate-->setautoproxyurl

SX了,哈哈。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/139686

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX