China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-24 05:51
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Registry permissions issue View 833 Replies 7
Original Poster Posted 2007-03-27 08:24 ·  中国 广东 河源 电信
初级用户
Credits 26
Posts 10
Joined 2006-10-19 09:54
19-year member
UID 66853
Status Offline
Hello everyone, while testing registry permissions in a batch file, I found that when calling SETLOCAL to modify registry permissions,
@setacl machine\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /registry /grant everyone /read /p:no_dont_copy can prevent creating files under RUN, but likewise:
@setacl CLASSES_ROOT\exefile\shell\open\command /registry /grant
everyone /read /p:no_dont_copy has no effect,

I've already searched the forum for relevant materials and couldn't find anything. I hope some kind person can help me with how to set permissions on key values.

I'm waiting online
Floor 2 Posted 2007-03-27 08:39 ·  中国 广东 广州 电信
高级用户
★★★
潜水修练批处理
Credits 788
Posts 366
Joined 2006-12-31 02:43
19-year member
UID 75048
Gender Male
Status Offline
Typed it wrong?
CLASSES_ROOT should be HKEY_CLASSES_ROOT, right...
Haven't tested it, so I don't know whether it will work after entering it correctly
Floor 3 Posted 2007-03-27 09:07 ·  中国 广东 河源 电信
初级用户
Credits 26
Posts 10
Joined 2006-10-19 09:54
19-year member
UID 66853
Status Offline
No typo, there's also this before it: @rem HKLM
Floor 4 Posted 2007-03-30 22:48 ·  中国 广东 河源 电信
初级用户
Credits 26
Posts 10
Joined 2006-10-19 09:54
19-year member
UID 66853
Status Offline
So depressing, looks like the experts all can't be bothered to answer this question /. I've waited a long time, really disappointed. Let me be more specific. Here's the code. My question is, why does the first part work, but the second and third parts don't? Hope an expert can point it out:

:Selection
@rem User Choice
@echo.
@echo Please enter the number before the option below
@echo.
@echo 1: Install protection
@echo 2: Restore default settings
@echo.
@set /p UserSelection=Enter your choice (1,2,3,4)
@if "%UserSelection%"=="1" goto install
@if "%UserSelection%"=="2" goto uninstall
@if "%UserSelection%"=="3" goto information
@if "%UserSelection%"=="4" goto quit
@rem Any other input
@cls
@goto Selection

:information
@pause>nul 2>nul
@cls
@goto Selection
:install
@set OP=/grant everyone /read /p:no_dont_copy
@goto Doit
:uninstall
@set OP=/revoke everyone /read /p:yes
@goto Doit

:Doit
@echo.
@echo Operation in progress...
@rem HKLM (first part)
@setacl machine\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /registry %OP%>nul 2>nul
@setacl machine\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /registry %OP%>nul 2>nul
@setacl machine\SOFTWARE\Microsoft\Windows\CurrentVersion\RunServices /registry %OP%>nul 2>nul
@setacl machine\SOFTWARE\Microsoft\Windows\CurrentVersion\RunEX /registry %OP%>nul 2>nul
@setacl machine\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEX /registry %OP%>nul 2>nul
@setacl machine\SOFTWARE\Microsoft\Windows\CurrentVersion\RunServicesEx /registry %OP%>nul 2>nul

@rem HKCU (second part)
@setacl CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /registry %OP%>nul 2>nul
@setacl CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /registry %OP%>nul 2>nul
@setacl CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\RunServices /registry %OP%>nul 2>nul
@setacl CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\RunEX /registry %OP%>nul 2>nul
@setacl CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEX /registry %OP%>nul 2>nul
@setacl CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\RunServicesEx /registry %OP%>nul 2>nul
@setacl CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\RunServicesOnce /registry %OP%>nul 2>nul

@rem USERS (third part)
@setacl USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /registry %OP%>nul 2>nul
@setacl USER\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /registry %OP%>nul 2>nul
@setacl USER\SOFTWARE\Microsoft\Windows\CurrentVersion\RunServices /registry %OP%>nul 2>nul
@setacl USER\SOFTWARE\Microsoft\Windows\CurrentVersion\RunEX /registry %OP%>nul 2>nul
@setacl USER\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEX /registry %OP%>nul 2>nul
@setacl USER\SOFTWARE\Microsoft\Windows\CurrentVersion\RunServicesEx /registry %OP%>nul 2>nul
@setacl USER\SOFTWARE\Microsoft\Windows\CurrentVersion\RunServicesOnce /registry %OP%>nul 2>nul

[ Last edited by xmiou on 2007-3-30 at 10:54 PM ]
Floor 5 Posted 2007-03-31 03:15 ·  中国 陕西 西安 电信
铂金会员
★★★★
Credits 5,212
Posts 2,478
Joined 2007-02-08 23:39
19-year member
UID 79003
Gender Male
Status Offline
:@rem HKLM is only for comments.

I don't have setacl here, you'd better check carefully how its paths are supposed to be written.
Floor 6 Posted 2007-03-31 23:13 ·  中国 广东 河源 电信
初级用户
Credits 26
Posts 10
Joined 2006-10-19 09:54
19-year member
UID 66853
Status Offline
I have this setacl too. You only need to put it in the same directory. I just don't understand why the first part works, while the other parts don't.
Floor 7 Posted 2007-04-01 00:11 ·  中国 陕西 西安 电信
铂金会员
★★★★
Credits 5,212
Posts 2,478
Joined 2007-02-08 23:39
19-year member
UID 79003
Gender Male
Status Offline
Did you notice machine? It's a problem with how setacl is used
Floor 8 Posted 2007-04-04 11:10 ·  中国 广东 河源 电信
初级用户
Credits 26
Posts 10
Joined 2006-10-19 09:54
19-year member
UID 66853
Status Offline
Then why can machine be used, but CURRENT_USER and USER can't? What should they be changed to? Thanks for the tip
Forum Jump: