String AppleScript-如何使此字符串正确通过?

String AppleScript-如何使此字符串正确通过?,string,active-directory,applescript,String,Active Directory,Applescript,我的错误:应为“”,但找到标识符 因此,我试图在active directory中找到一个用户SMBHome,因为我们基于它映射驱动器。但该命令的问题是双字符串。“/Active Directory/YC/All Domains/”必须为字符串,否则无法正常排队 但要执行shell脚本(“此处的命令”)也必须是字符串 我该如何应对 还有更简单的方法吗 完整脚本: set UserName to do shell script "whoami" set AD to do shell script

我的错误:应为“”,但找到标识符

因此,我试图在active directory中找到一个用户SMBHome,因为我们基于它映射驱动器。但该命令的问题是双字符串。“/Active Directory/YC/All Domains/”必须为字符串,否则无法正常排队

但要执行shell脚本(“此处的命令”)也必须是字符串

我该如何应对

还有更简单的方法吗

完整脚本:

set UserName to do shell script "whoami"
set AD to do shell script ("dscl "/Active Directory/YC/All Domains/" read /Users/" & UserName)

没关系,我真的弄明白了。类似于Lua “dscl\”/activedirectory/YC/All Domains/\“read/Users/”&用户名


尽管我仍在等待,看看是否有人对此有更好的解决方案。:)

您可以使用单引号:

set UserName to do shell script "whoami"
set AD to do shell script ("dscl "/Active Directory/YC/All Domains/" read /Users/" & UserName)

if AD contains "StaffShare" then
    set SMBHome to "smb://domain/StaffShare"
else
    set SMBHome to "smb://domain/EmployeeShare"
end if

set mounted_disk to list disk

mount volume SMBHome as user name UserName
但是你这样做,通过逃避双引号,它是完全合法的

set AD to do shell script "dscl '/Active Directory/YC/All Domains/' read $HOME"