Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Palm2570Playz

How to run commands as all users in Batch?

Recommended Posts

Posted · Original PosterOP

So, I was trying to do a File Locker...

And I need this command to run as all users so no one can acess it

like if I have users names "P" and "W" I need to run it as P and W

------------------------------------------------------------------------------------------------

"cacls (path) /e /c /d (meant to be all users):f"

------------------------------------------------------------------------------------------------

Please help me

 

Link to post
Share on other sites

Not sure what you're asking. Do you want your batch to require two different user accounts to be signed in at the same time to run it? Or do you want your batch file to be able to impersonate different users?


Remember to quote or @mention others, so they are notified of your reply

Link to post
Share on other sites
4 minutes ago, Palm2570Playz said:

So, I was trying to do a File Locker...

And I need this command to run as all users so no one can acess it

like if I have users names "P" and "W" I need to run it as P and W

------------------------------------------------------------------------------------------------

"cacls (path) /e /c /d (meant to be all users):f"

------------------------------------------------------------------------------------------------

Please help me

 

This doesnt make much sense to me.
First of are you having ocular troubles, cus there is a HUGE GREEN BAR at that tops telling you TO USE THE CODE TAGS!! Its there for a reason!

 

2nd what do you mean run as all users, thats not really an option. Specially not if you want to lock out other users.


When i ask for more specs, don't expect me to know the answer!
I'm just helping YOU to help YOURSELF!
(The more info you give the easier it is for others to help you out!)

Link to post
Share on other sites
Posted · Original PosterOP

I meant like

You have 2 users and need the code to run for 2 users!

Like you want to create file in users desktop

 

echo hello world >> hi.txt but want it to be on other users that doesn't log on too!

Ok?

Link to post
Share on other sites
Posted · Original PosterOP

Again, You need to understand the command!

 

cacls                   (file/folder)                                                /e                                                          /c                        

  ^                                                                                          ^                                                            ^                       

Commands about permissions to edit or other to the file!  Edit Instead of replacing Permissions  Continue on errors 

/d

^

denied acess

 

(user):f

     ^

Revoke or add full control to the user

 

Imagine I have 2 accounts but I don't know their name! but I need to run this command for 2 accounts to revoke all permissions from all users so they can't acess it

Link to post
Share on other sites

If you need to run code as two different users.

 

You can have another batch file with runas command to call the icalcs.

 

Example.

    Icalcs.cmd

 

User_1.cmd

    Runas /user:Joe icalcs.cmd

 

User_2.cmd

    Runas /user:Joe icalcs.cmd

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×