2

スタッフが使用する Windows 共有ドライブをマウントするために「mount -t smbfs」コマンドを実行する AppleScript アプリを作成しました。

アプリは、今日まで何ヶ月も正常に使用されています。ユーザーのパスワードに @ 記号が含まれている場合、アプリケーションは失敗します。パスは拒否されます。

スクリプトは次のとおりです。

-- Teaching Drive Access

--Get The Shortname and PC Password of current user 
--set PCusername to (short user name of (system info))
set PCusername to "benstaff"
--set PCPassword to text returned of (display dialog "What's your PC Password?" default answer "" with title "T Drive" with icon stop with hidden answer)

--Create Sharepoint on Desktop
set FolderTarget to (path to desktop folder as text) & "DoNotUseTeachingDrive"

try
    FolderTarget as alias
on error
    do shell script "mkdir /Users/" & PCusername & "/Desktop/DoNotUseTeachingDrive/"
end try

set mountcommand to "mount -t smbfs "
set mountuser to "//" & PCusername & ":" & PCPassword
set mountuser to "//" & PCusername & ":" & PCPassword
set mountvolume to "@ncs-srv-fs3.ncs.local/Teaching"
set machomepath to "/Users/" & PCusername & "/Desktop/DoNotUseTeachingDrive/"

set mountwindowshome to mountcommand & mountuser & mountvolume & " " & machomepath as string
do shell script mountwindowshome

の完全な出力mountwindowshomeは次のとおりです。

mount -t smbfs //mystaff:PE91XA!!@@ncs-srv-fs3.ncs.local/Teaching /Users/mystaff/Desktop/DoNotUseTeachingDrive/

パスワードなしでターミナルでコマンドを実行すると、パスワードを求められ、共有が正しくマウントされます。

どんな助け/指針もありがたく受け取るでしょう。

4

1 に答える 1

2

このサイトによると、特殊文字には URL エスケープを使用する必要があります。@%40 になる文字の場合、マウント行は次のようになります。

mount -t smbfs //mystaff:PE91XA!!%40@ncs-srv-fs3.ncs.local/Teaching /Users/mystaff/Desktop/DoNotUseTeachingDrive/
于 2013-11-01T13:06:28.363 に答える