We've Moved! Visit our NEW FORUM to join the latest discussions. This is an archive of our previous conversations...

You can find the login page for the old forum here.
CHATPRIVACYDONATELOGINREGISTER
DMT-Nexus
FAQWIKIHEALTH & SAFETYARTATTITUDEACTIVE TOPICS
writing batch (.bat) files Options
 
vovin
#1 Posted : 4/2/2012 9:25:42 PM

DMT-Nexus member

Senior Member | Skills: Prototype and Design Engineer amongst other things, Craftsman

Posts: 1072
Joined: 12-Feb-2009
Last visit: 18-Dec-2021
Location: Here with you but living in florida
I need to write a batch (.bat) file that will set read/write permissions and or passwords to certain executable programs on a windows system. Basically I want to be able to control who can edit things. Can any of you guys give me some tips on how to go about this or references so I can figure it out?
If you don't sin, Jesus died for nothing.
 

STS is a community for people interested in growing, preserving and researching botanical species, particularly those with remarkable therapeutic and/or psychoactive properties.
 
smokerx
#2 Posted : 4/2/2012 9:49:31 PM

ThGiL fO TiRipS


Posts: 2021
Joined: 26-Feb-2011
Last visit: 07-Feb-2023
Location: Earth
Would you need something like this or this ?
We are each of us angels with only one wing, and we can only fly by embracing one another.

*********

We are all living in our own feces.
 
vovin
#3 Posted : 4/2/2012 10:12:00 PM

DMT-Nexus member

Senior Member | Skills: Prototype and Design Engineer amongst other things, Craftsman

Posts: 1072
Joined: 12-Feb-2009
Last visit: 18-Dec-2021
Location: Here with you but living in florida
Yeah. I just dont understand programming all that well. I am trying to set up something that will allow people 'set up teks' access certain files, and maintenance teks to access those and other files and engineers to have global access. I have a crew of guys who arent supposed to be changing things doing so. I can't block them out completely but just need to figure a way of controlling who has access to what.
If you don't sin, Jesus died for nothing.
 
vovin
#4 Posted : 4/2/2012 10:30:22 PM

DMT-Nexus member

Senior Member | Skills: Prototype and Design Engineer amongst other things, Craftsman

Posts: 1072
Joined: 12-Feb-2009
Last visit: 18-Dec-2021
Location: Here with you but living in florida
Apparently it can be done in a bat file that accesses Cacls. Just figured that out

http://ss64.com/nt/cacls.html

Now how would one write such a batch file. I got this off the web but it might as well be in Chinese:

@echo off

set zLog=ResetHomePerms.log

cls
echo FIXHOME.BAT
echo This script will reset permissions for all subdirectories
echo in this folder. It is assumed that the subdirectories
echo are named the same as their respective username.
echo.
choice /C YN /M “Are you sure you want to proceed?”

if errorlevel 2 GOTO :Exit
if errorlevel 1 GOTO :MAIN

:MAIN
if exist %zLog% del %zlog% >NUL

choice /C CF /M “Do you want users to have (C)hange or (F)ull control permissions?”

if errorlevel 2 GOTO ResetF
if errorlevel 1 GOTO ResetC

:RESETF
echo Granting users FULL permissions
echo.
echo Granting users FULL permissions >>%zlog%
for /f %%i in (‘dir /b /ad’) do @echo %%i >>%zLog% && echo y|cacls %%i /T /g Administrators:F >NUL && cacls %%i /T /e /g %userdomain%\%%i:F >>%zLog% && echo **********>>%Zlog%
REM rem out or modify the following line if you do not want to give Domain Admins Full control
for /f %%i in (‘dir /b /ad’) do @echo %%i >>%zLog% && cacls %%i /T /e /g “%userdomain%\Domain Admins”:F >>%zLog% && echo **********>>%Zlog%
goto :CLOSE

:RESETC
echo Granting users CHANGE permissions
echo.
echo Granting users CHANGE permissions >>%zlog%
for /f %%i in (‘dir /b /ad’) do @echo %%i >>%zLog% && echo y|cacls %%i /T /g Administrators:F >NUL && cacls %%i /T /e /g %userdomain%\%%i:C >>%zLog% && echo **********>>%Zlog%
REM rem out or modify the following line if you do not want to give Domain Admins Full control
for /f %%i in (‘dir /b /ad’) do @echo %%i >>%zLog% && cacls %%i /T /e /g “%userdomain%\Domain Admins”:F >>%zLog% && echo **********>>%Zlog%

goto :CLOSE

:CLOSE
echo. >>%zLog%
date /t >>%zlog% && time /t >>%zLog%
echo.
echo See %zlog% for details

set zLog=
set zLogError=

:EXIT
echo Exiting script
If you don't sin, Jesus died for nothing.
 
smokerx
#5 Posted : 4/2/2012 11:53:36 PM

ThGiL fO TiRipS


Posts: 2021
Joined: 26-Feb-2011
Last visit: 07-Feb-2023
Location: Earth
Why dont you set accounts for each of them with specific permissions. Then they will have access only to a certain files or programs.

Take a look at this or google similar I am sure it will be enough for the job

We are each of us angels with only one wing, and we can only fly by embracing one another.

*********

We are all living in our own feces.
 
 
Users browsing this forum
Guest (2)

DMT-Nexus theme created by The Traveler
This page was generated in 0.015 seconds.