Does anyone know how I can change file permissions in a windows command prompt? <--"Didn't your code work? You must have made a mistake when you pasted it." - Mark Hazen-->
If this post was useful to you, click the link below
Depends what you want to do? If you want to view or change the files attributes then use attrib this allows you to set read only hidden system and archive attributes.
If you want to change user rights to files then you can use CACLS which will allow you to set user permissions on group or user level. If you type either command followed by /? it will out put the syntax and parameters.
Hope this helps
Chris
Excellent, thanks.
One more question: How do you do a whoami in the command prompt? <--"Didn't your code work? You must have made a mistake when you pasted it." - Mark Hazen-->
If this post was useful to you, click the link below
CACLS filename [/T] [/E] [/C] [/G usererm] [/R user [...]]
[/P usererm [...]] [/D user [...]]
filename Displays ACLs.
/T Changes ACLs of specified files in
the current directory and all subdirectories.
/E Edit ACL instead of replacing it.
/C Continue on access denied errors.
/G usererm Grant specified user access rights.
Perm can be: R Read
W Write
C Change (write)
F Full control
/R user Revoke specified user's access rights (only valid with /E).
/P usererm Replace specified user's access rights.
Perm can be: N None
R Read
W Write
C Change (write)
F Full control
/D user Deny specified user access.
Wildcards can be used to specify more that one file in a command.
You can specify more than one user in a command.
you can use this command
NET SESSION
or
NET NAME
the only advantage to NET SESSION is if you run it on a machine with multiple users it will list the client type and show all machine accounts with a $ after them
If you want to get this information for a batch job or command line the use the %username% variable which will insert this for you. ie
mybatch.bat %username%
for me would be the same as typing
mybatch.bat cnorris517
Finally if you aren't bothered by the format of the output but just want a quick and dirty way to identify your current user just type %username% at a command prompt. The system will respond with
'user' is not recognized as an internal or external command, operable program or batch file
Another way to find out is to use the NBTSTAT command. Just type that with a /? and it'll give you all the help you'll need to find out who is logged on to a computer.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.