很多公司,会对员工使用电脑进行一些限制,限制他们安装某些软件。很多时候也会对添加打印机进行限制。限制后在控制面板上的设备和打印机中添加打印机将是灰色不可用状态…… 若要突破限制可用以下代码试试,交下述代码存为一个后缀为bat的文件。 @ECHO OFF REM.let's make a choice SETLOCAL ENABLEEXTENSIONS SETLOCAL ENABLEDELAYEDEXPANSION :menuLOOP echo. echo.= Menu ================================================= echo. for /f "tokens=1,2,* delims=_ " %%A in ('"findstr /b /c:":menu_" "%~f0""') do echo. %%B %%C set choice= echo.&set /p choice=Make a choice or hit ENTER to quit: ||GOTO:EOF echo.&call:menu_%choice% GOTO:menuLOOP ::----------------------------------------------------------- :: Please select one of the following choices. ::----------------------------------------------------------- :menu_1 Allow to add printer permission under GPO CLS ECHO Allow to add printer REG add "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v NoAddPrinter /t REG_DWORD /d 0 /f GOTO:EOF :menu_2 Restrict to add printer w/o GPO CLS ECHO Restrict to add printer REG add "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v NoAddPrinter /t REG_DWORD /d 1 /f GOTO:EOF :menu_3 If site under GPO restriction, enter "3" to Remove registry , Delete file itself REG DELETE "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v NoAddPrinter /f (goto) 2>nul & del "%~f0" GOTO:EOF 如小子将其存为了 Printer add.bat ,如下图中所示。 存好后重启或登出后再登陆(一定要如此,否则添加无效 ),然后找到Printer add.bat,右键,打开(打开不行的话,选择以管理员身份运行),如下。 然后在下图中,输入 1 再点击Enter 随后即可进行打印机的添加,控制面板中设备和打印机如下,添加打印机已经为可用状态。 随后点击添加打印机,即可正常添加打印机。 |
|