1

I have file sharing enabled on my computer and I was wondering, is there a batch code that can turn off all file sharing?

I would prefer if I could disable it via a batch script but any way works besides manually disabling it yourself in the settings.

2 Answers 2

1

Copy and paste the following into a text file, then save the file with .bat as the extension.
Enable file sharing:

echo off
netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes  

Disable file sharing:

echo off
netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=No
0

net stop server

from batch or command line should work for you.

net start server to start again.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .