首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Applescript错误

Applescript错误
EN

Stack Overflow用户
提问于 2012-09-07 17:51:40
回答 1查看 1.1K关注 0票数 1

我们正在尝试使用下面提到的终端命令通过Applescript安装一个应用程序。首先,它将挂载dmg文件,然后将应用程序安装到app文件夹。安装app到App文件夹时要求输入密码,如何使用Applescript处理此密码??

代码语言:javascript
复制
hdiutil mount /Users/rajasekaranr/Downloads/install_flash_player_osx.dmg"
sudo cp -R "/Volumes/Flash Player 2/Install Adobe Flash Player.app" /Applications 

使用apple script执行上述命令时出错

代码语言:javascript
复制
error "sudo: no tty present and no askpass program specified" number 1
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-09-07 18:54:37

尝试:

代码语言:javascript
复制
property usr : "username"
property pswd : "password"

set fromPath to quoted form of "/Volumes/Flash Player 2/Install Adobe Flash Player.app"
set toPath to quoted form of "/Applications"
do shell script "cp -R " & fromPath & space & toPath user name usr password pswd with administrator privileges
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12315770

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档