Office hacks: different ways to quickly switch file and printer sharing

For users who use laptops to move between offices and public places, it is not unusual to switch between turning on and off file and printer sharing, which is a tedious process if set step by step through the Control Panel or System Settings window. So, how can you quickly turn on or off file and printer sharing settings? Here are a few ways to make it easier and more efficient.

1. Easier Quick operation in the graphical interface

For those who are used to using the Settings or Control Panel menus, you don’t need to click through the Settings window to get to them.

Search for “Advanced Sharing Settings” in the search box in the taskbar, and then click “Manage Advanced Sharing Settings” to see the file and printer sharing settings switch options (Figure 1).


You can also search for “Ethernet Settings”, then select “Network and Sharing Center”, and in the “Properties” window on the existing Ethernet network, check or uncheck the You can also control file and printer sharing by checking or unchecking the “File and printer sharing for Microsoft networks” option in the Properties window on the existing Ethernet network (Figure 2).


2. faster Operation by command

In addition to using the graphical interface, it is actually more efficient to operate and run using the command method called as a batch file. Simply prepare a simple batch program with the appropriate command, place it on the desktop, right-click on it and select Run as Administrator. The specific command usage is described below.

File and printer shares can be opened by executing the following command in the Administrator Command Prompt window (Figure 3).


netsh advfirewall firewall set rule group=”文件和打印机共享” new enable=Yes

Instead, change “Yes” to “No” in the command to turn off sharing.

The command to open file and printer shares, if done from an administrator PowerShell window, is (Figure 4)


Set-NetFirewallRule -DisplayGroup “File and Printer Sharing” -Enabled True -Profile Any

The command to turn off file and print sharing is to change “True” to “False” in the above command.

The above settings are for all networks. If you replace “Any” with “Domain” in the command, the shared settings are configured for the domain network; if you replace it with “Private”, the shared settings are configured for the private If “Private” is replaced with “Private”, the settings are configured for private networks; if “Public” is replaced with “Public”, the settings are configured for public networks. The command “Ture” means turn on sharing, and “False” means turn off sharing.

Finally, according to the above commands, you can make a batch file for each of the on and off commands you need. BAT file with the extension .BAT, add the content of one of the above commands you need, and copy it as it is, paying attention to spaces and double quotes. One switch file each, two files together, once created, forever used.

Leave a Comment