如何在applescript中编写带空格和斜杠的文件位置?

时间:2016-12-19 22:48:59

标签: applescript

以下是 applescript

do script ("aria2c -i /Users/mac/Downloads/aria2c\ \(1\).down") in currentTab

shell 中的预期结果是这样的:

~$ aria2c -i /Users/mac/Downloads/aria2c\ \(1\).down

但它不起作用......

1 个答案:

答案 0 :(得分:0)

在AppleScript中,必须使用第二个反斜杠转义反斜杠:

do script ("aria2c -i /Users/mac/Downloads/aria2c\\ \\(1\\).down") in currentTab

更聪明的方法是quoted form of,它会神奇地添加所有必要的反斜杠/引号字符

do script "aria2c -i " & quoted form of "/Users/mac/Downloads/aria2c (1).down" in currentTab