L
L
loligayz2020-02-04 04:38:53
Command line
loligayz, 2020-02-04 04:38:53

How to add several commands to the registry via .reg at once?

Wrote a script that changes the registry branch in

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\exefile\shell]
[HKEY_CLASSES_ROOT\exefile\shell\Add To Firewall]
[HKEY_CLASSES_ROOT\exefile\shell\Add To Firewall\command]
@="netsh advfirewall firewall add rule name=\"%1\" dir=in action=allow program=\"%1\""

I need to not only execute a command on clicking a button in the context menu
(netsh advfirewall firewall add rule name=\"% 1\" dir=in action=allow program=\"%1\") but also
netsh advfirewall firewall add rule name=\"%1\" dir=out action=allow program=\"%1\"and
NetSh Advfirewall set allprofiles state off

tried so

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\exefile\shell]
[HKEY_CLASSES_ROOT\exefile\shell\Add To Firewall]
[HKEY_CLASSES_ROOT\exefile\shell\Add To Firewall\command]
@="NetSh Advfirewall set allprofiles state off & netsh advfirewall firewall add rule name=\" %1\" dir=in action=allow program=\"%1\" & netsh advfirewall firewall add rule name=\"%1\" dir=out action=allow program=\"%1\""

doesn't work!

The script should, as is clear from the commands, delete all entries in the firewall, then add one button to the context, by clicking the program is added to the permissions for incoming and outgoing,
Thus I plan to protect myself from stealers and warriors.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
Radjah, 2020-02-04
@Radjah

As an option, call a cmd script in the script, in which to place all the commands.

A
AUser0, 2020-02-04
@AUser0

Well, look, both commands work quite well:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\exefile\shell\test\command]
@="cmd.exe /c \"echo %1 >xxx.lst && echo %1 >yyy.lst\""

R
res2001, 2020-02-04
@res2001

netsh can be passed for execution a script file containing its commands

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question