0

我尝试使用下面的脚本来创建 congif 文件,如果它已经存在以覆盖相同的文件,但即使没有收到任何错误,也没有得到任何结果,请建议。我希望在applescript中与下面的相同。

property usr : "abce"
property pswd : "pwd"
do shell script "echo 'hello world' > /users/usernamr/desktop/mms.cfg" user name usr password pswd with administrator privileges
4

2 回答 2

0

我看到一个拼写错误:

/users/usernamr/desktop/mms.cfg

尝试将其更改为:

/users/username/desktop/mms.cfg

?

于 2012-12-20T04:10:47.410 回答
0

试试这个...

property usr : "abce"
property pswd : "pwd"

set filePath to (path to desktop as text) & "mms.cfg"
set theText to "hello world"
do shell script "echo " & quoted form of theText & " > " & quoted form of POSIX path of filePath user name usr password pswd with administrator privileges

注意:我在您的另一篇文章中看到该文件位于您的应用程序支持文件夹中。如果您想要那里的文件,请使用此行...

set filePath to (path to application support folder from user domain as text) & "mms.cfg"
于 2012-12-20T04:32:15.867 回答