我需要使用(在7赢利时解释的)卡片对双胞胎给予充分的准入许可。 在我看来,我不得不使用地方化用户名称和团体名称。 例如:
cacls foldername /T /E /C /G Users:F
这给我留下了错误“没有在账户名称和安全身份证之间绘制地图”。 接下来的指挥工作是罚款(白俄罗斯的用户= П л а а т т т)。
cacls foldername /T /E /C /G Пользователи:F
无论使用何种系统语言,怎么能允许对文件夹进行充分许可?
我需要使用(在7赢利时解释的)卡片对双胞胎给予充分的准入许可。 在我看来,我不得不使用地方化用户名称和团体名称。 例如:
cacls foldername /T /E /C /G Users:F
这给我留下了错误“没有在账户名称和安全身份证之间绘制地图”。 接下来的指挥工作是罚款(白俄罗斯的用户= П л а а т т т)。
cacls foldername /T /E /C /G Пользователи:F
无论使用何种系统语言,怎么能允许对文件夹进行充分许可?
http://support.microsoft.com/kb/825751” rel=“nofollow”here,并且使用SIDs而不是名称(将发现众所周知的idshere)。
如果你出于某种原因被困于 ca子,那么google: cacls sid
就将给你带来一些工作,如何扭转从涂id到名称的绘制,然后向cl提供。
Edit: could not resist to learn some new tricks...
this simple script will give you actual name of Users (S-1-5-32-545)
group on a given PC:
Set objWMIService = GetObject("winmgmts:\.
ootcimv2")
Set objAccount = objWMIService.Get ("Win32_SID.SID= S-1-5-32-545 ")
Wscript.Echo objAccount.AccountName
将其编成一个文件,编号为usersName.vbs
。
现:
echo Y|for /f "delims=" %i in ( cscript -Nologo usersName.vbs ) do cacls foldername /G "%i":F
Done :-
Edit:更正为如果名称有空间的话(delims=
)。 并请指出,如果你使用这一工具的英文版本,请在开始时重复Y。
该法典将把Y/N和USERS(或任何SID)本地化,并在预期的目录中执行CACLS,解决原始问题。
@echo off
rem https://learn.microsoft.com/en-US/windows-server/identity/ad-ds/manage/understand-security-identifiers
rem SIDs: S-1-5-32-545 Users; S-1-1-0 Everybody; S-1-5-32-544 Administrators
rem S-1-5-7 no logon; S-1-5-11 Authenticated Users; S-1-5-18 System; S-1-5-10 Self
set userSID=S-1-5-32-545& rem USERS sid
set dirName=%TEMP%TEST
rem https://stackoverflow.com/questions/20892882/set-errorlevel-in-windows-batch-file/77643084#77643084
rem try setting errorlevel 1 doesn t work on win9x: verify other 2>nul
REM set errorlevel 1, to check next command
<nul find ""
REM enableExtensions/delayedExp to get !varNm! value on execution
setlocal enableextensions enabledelayedexpansion
if NOT ERRORLEVEL 1 goto :WinNew
echo *** OLD OS: Can t enableextensions ***
ver
goto :FIN
:WinNew
REM Get local language Yes/No/All letters {to answer prompts}
REM https://www.dostips.com/forum/viewtopic.php?p=63518#p63518
set PromptLine=
rem create dummy file [in w9x]: echo x >"%TEMP%yesnoall#.tmp" >nul
copy /y nul "%TEMP%yesnoall#.tmp" >nul
rem capture overwrite prompt after "#" ie: ".tmp? [Sí/No/Todos]:"
for /f "tokens=2* delims=#" %%A in ( ^<nul copy /-y nul "%TEMP%yesnoall#.tmp"
) do set PromptLine=%%A
rem remove dummy file
del "%TEMP%yesnoall#.tmp"
rem For testing complicated case [russian], uncomment next line
rem set PromptLine=.tmp [Yes (a?)/No (b??)/All (c??)]:
rem remove spaces for russian
set PromptLine=%PromptLine: =%
rem parse simple case get: A,B,C else complicated case with brackets and parenthesis: A,C,E
for /f "tokens=2-7 delims=[(/)]" %%A in ( "%PromptLine%"
) do if "%%~E" == "" ( set lang_yes=%%A& set lang_no=%%B& set lang_all=%%C
) else ( set lang_yes=%%A& set lang_no=%%C& set lang_all=%%E
)
rem Extract first char
set lang_y=%lang_yes:~0,1%& set lang_n=%lang_no:~0,1%& set lang_a=%lang_all:~0,1%
rem Display results
echo %lang_yes%, %lang_no%, %lang_all%
echo %lang_y%, %lang_n%, %lang_a%
rem https://stackoverflow.com/questions/9113206/cacls-windows-7-full-permissions-local-names
rem https://superuser.com/questions/1176622/regardless-of-windows-language-how-can-i-make-the-icacls-command-set-a-folder-t
rem generate temp sid2user.VBS script to get local language userSID name
( echoSet objWMIService = GetObject("winmgmts:\.
ootcimv2"^)
echoWscript.Echo objWMIService.Get("Win32_SID.SID= %userSID% " ^).AccountName
) > "%TEMP%sid2user.vbs"
rem set lang_user to userSID local language name
for /F "delims=" %%i in ( cscript -Nologo "%TEMP%sid2user.vbs" ) do set lang_user=%%i
rem remove temp vbs file
del "%TEMP%sid2user.vbs"
echo "%lang_user%":F
rem set permissions in local language
echo %lang_y%|cacls "%dirName%" /t /l /c /G "%lang_user%":F
:FIN
pause
I m trying to do some batch replacement for/with a fairly complex pattern So far I find the pattern as: find ( -name *.php -o -name *.html ) -exec grep -i -n hello {} + The string I want ...
I am trying to retrieve the environment variable to detect whether the system is 32 or 64 bit. But on 64 bit server the environment variable %processor_architecture% is returning x86 instead of AMD64. ...
IF %processor_architecture% == AMD64 (SET querypath=hklmsoftwarex) ELSE (SET dsetquerypath=hklmsoftwarey) FOR /F "tokens=* delims=" %%G IN ( REG QUERY "%querypath%" 2^>NUL ) DO ECHO %%G Let ...
I have a batch script that takes arguments from the command line. One of the arguments has a * in it. In spite of putting the argument in quotes, the * gets expanded before the argument gets used in ...
Suppose I have a string "AAA BBB CCC DDD EEE FFF". How can I split the string and retrieve the nth substring, in a batch file? The equivalent in C# would be "AAA BBB CCC DDD EEE FFF".Split()[n]
Binary files have a version embedded in them - easy to display in Windows Explorer. How can I retrieve that file version, from a batch file?
How can I check OS version in a batch file or through a vbs in an Windows 2k/2k3 environment ? You know ... Something like ... : "If winver Win2k then ... or if winver Win2k3 then ....
I don t know how to describe exactly what I m trying to do but here s an example batch file that demonstrates what I can t figure out.: I ve got a batch file. Inside that batch file I m trying to ...