Can I run a .BAT file with elevated permissions?

Paul Kraemer 266 Reputation points
2022-07-19T16:57:38.4+00:00

Hi,

I have a .BAT file that uses the xcopy command to copy some files and folders from one folder to another on a network.

Ideally, I'd like the user on the destination PC (which is running Windows 10 Pro) to have read-only access to the destination folder. If I change the permissions of this user to make her access to this folder read-only, then I am pretty certain the .BAT file will not be able to copy files into this folder.

This makes me wonder if there is a way that I can set the .BAT to run at a higher security level than that of the logged in user?

If anyone can tell me if this is possible, I would greatly appreciate it.

Thanks in advance,
Paul

Windows 10 Security
Windows 10 Security
Windows 10: A Microsoft operating system that runs on personal computers and tablets.Security: The precautions taken to guard against crime, attack, sabotage, espionage, or another threat.
2,747 questions
Windows Server Security
Windows Server Security
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.Security: The precautions taken to guard against crime, attack, sabotage, espionage, or another threat.
1,717 questions
0 comments No comments
{count} votes

Accepted answer
  1. Dillon Silzer 54,286 Reputation points
    2022-07-19T17:22:25.95+00:00

    Hello @Paul Kraemer

    No matter what the .bat file runs in it will still require permissions to the folder to copy files. You will need to give the user write access to the folder or they will not be able to copy files.

    A work around solution is that you could have her write to a proxy folder (with write access) and schedule a xcopy command to be ran on the server that moves the files from the proxy folder to the folder that she has read-only access to.

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

    If this is helpful please mark as correct answer.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Paul Kraemer 266 Reputation points
    2022-07-19T17:51:50.657+00:00

    Thanks DillonJS,

    My goal is to keep a local folder on a user workstation in synch with a folder on the server.

    We have a group of users with higher level permissions that is able to read and write files to the folder on the server. I'd like the user of the workstation to have no ability to change or delete the local files on the workstation.

    Considering it doesn't seem possible to have the workstation user (with limited permissions) launch a .BAT file with elevated permissions to "pull" the files from the server, this makes me think I might want to require someone from the higher level group to initiate the .BAT file to "push" the files onto the workstation.

    Procedurally, I don't think anyone in my organization will have a problem with this.

    This does make me think of one other question. Does windows support any means by which you can setup a folder to be a read-only mirror image of another folder without relying on a .BAT file and xcopy?

    Thanks again for your help.

    Paul

    0 comments No comments