以下工作:
$ New-SMBShare -name "xyz$" -Path "C:\TEMP\smbshare4" -FullAccess "NT AUTHORITY\Authenticated Users"
但不是我将-path
作为变量$dirPath="C:\TEMP\\smbshare4"
$ New-SMBShare -name "xyz$" -Path $dirPath -FullAccess "NT AUTHORITY\Authenticated Users"
New-SMBShare : The filename, directory name, or volume label syntax is incorrect.
At line:1 char:1
+ New-SMBShare -name "xyz$" -Path $dirPath -FullAccess "NT AUTHORITY\Authentica ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified (MSFT_SMBShare:ROOT/Microsoft/Windows/SMB/MSFT_SMBShare) [New-SmbShare], CimException
+ FullyQualifiedErrorId : Windows System Error 123,New-SmbShare
答案 0 :(得分:0)
双向反斜杠“\”是问题所在。
$ dirPath =“C:\ TEMP \ smbshare4”工作。