S
S
S10LI2020-04-15 15:35:41
cmd/bat
S10LI, 2020-04-15 15:35:41

How to make a program to interact with CMD Windows?

I need to make a simple program that will execute commands in cmd. How can it be implemented?

Specifically, the scheme is as follows:
I have prepared .cmd files, with the help of which I issue folder rights to users through the Cacls utility

Example:
cacls D:\Folder /E /G Domain\User1:C Domain\User2:R

That is, the program must there will be
input for folder "D\Folder"
input or checkbox/radio for arguments "/E /G"
input for users "Domain\User1:C Domain\User2:R" button
"Run"

command line was displayed in some additional mini-window of this program

From my coding skills - I reworked JS crutches into a web page for myself, customized the feedback form in PHP to my needs

. How can all this be implemented?
There are a lot of folders, just like users. Everyone has their own rights. Something changes regularly.
To do this through Folder Options - Security, is extremely long. Through group policies, it also turned out to be not fast

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
wisgest, 2020-04-15
@S10LI

To create a graphical interface, you can use, for example, https://ru.wikipedia.org/wiki/HTML_Application

<textarea id=output></textarea>
<script language=JScript>
var WshShell = new ActiveXObject('WScript.Shell');
var WshExec = WshShell.Exec("cmd /c 2>&1  cacls D:\Folder /E /G Domain\User1:C Domain\User2:R");
document.getElementById('output').value = WshExec.StdOut.ReadAll();
</script>

R
res2001, 2020-04-15
@res2001

You can do the same input in the batch file using
set /p
See: set /?
By the way, when cmd hangs on the input in set / p, you can drag directories / files from the explorer with the mouse, it can be quite convenient.
But, given that there are many directories, it makes sense to simply create a text file in which, in a certain format, fill in the user and rights parameters for each desired folder, read the file in the batch file and execute cacls.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question