V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
yxjxx
V2EX  ›  macOS

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

  •  
  •   yxjxx · 2014-10-17 23:48:37 +08:00 · 2955 次点击
    这是一个创建于 3540 天前的主题,其中的信息可能已经有所发展或是发生改变。

    最近时常需要修改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赋值给变量,再用变量做参数都不行。

    求帮助!

    kfll
        1
    kfll  
       2014-10-18 07:53:45 +08:00 via Android   ❤️ 1
    我猜你很快就知道哪里错了
    yxjxx
        2
    yxjxx  
    OP
       2014-10-18 11:08:20 +08:00
    @kfll 恕我愚钝,还望明示。
    yxjxx
        3
    yxjxx  
    OP
       2014-10-18 11:14:59 +08:00
    @kfll 好吧 setautoproxystate-->setautoproxyurl

    SX了,哈哈。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1435 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 23:53 · PVG 07:53 · LAX 16:53 · JFK 19:53
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.