Applescript:在上删除目录

Applescript:在上删除目录,applescript,directory,Applescript,Directory,我有一个包含以下内容的应用程序脚本: on open dir tell application "Finder" tell application "Terminal" activate tell application "Terminal" do script "cd " & dir end tell end tell end

我有一个包含以下内容的应用程序脚本:

on open dir
    tell application "Finder"
        tell application "Terminal"

            activate

            tell application "Terminal"

                do script "cd " & dir

            end tell
        end tell
    end tell    
end open
它可以工作,并获取放在它上面的目录,但它将cd放入cd Macintosh HD:Users:USER:Desktop:C文件:


有没有办法把:替换为/?在applescript?

中,我自己找到了答案!:

将dir设置为POSIX路径dir的引号形式

确保也使用“引号形式”。如果路径有空格,则需要它。因此,只要使用。。。使用命令“cd”执行脚本,并引用dir的POSIX路径形式