set 命令详解.docx

上传人:b****6 文档编号:8665950 上传时间:2023-02-01 格式:DOCX 页数:18 大小:20.18KB
下载 相关 举报
set 命令详解.docx_第1页
第1页 / 共18页
set 命令详解.docx_第2页
第2页 / 共18页
set 命令详解.docx_第3页
第3页 / 共18页
set 命令详解.docx_第4页
第4页 / 共18页
set 命令详解.docx_第5页
第5页 / 共18页
点击查看更多>>
下载资源
资源描述

set 命令详解.docx

《set 命令详解.docx》由会员分享,可在线阅读,更多相关《set 命令详解.docx(18页珍藏版)》请在冰豆网上搜索。

set 命令详解.docx

set命令详解

set命令详解

显示、设置或删除cmd.exe环境变量。

SET[variable=[string]]

variable指定环境变量名。

string指定要指派给变量的一系列字符串。

要显示当前环境变量,键入不带参数的SET。

如果命令扩展被启用,SET会如下改变:

可仅用一个变量激活SET命令,等号或值不显示所有前缀匹配SET命令已使用的名称的所有变量的值。

例:

SETP

会显示所有以字母P打头的变量

如果在当前环境中找不到该变量名称,SET命令将把ERRORLEVEL设置成1。

SET命令不允许变量名含有等号。

在SET命令中添加了两个新命令行开关:

SET/Aexpression

SET/Pvariable=[promptString]

/A命令行开关指定等号右边的字符串为被评估的数字表达式。

除十六进制有0x前缀,八进制有0前缀的,数字值为十进位数字。

因此,0x12与18和022相同。

请注意八进制公式可能很容易搞混:

08和09是无效的数字,因为8和9不是有效的八进制位数。

/P命令行开关允许将变量数值设成用户输入的一行输入。

读取输入行之前,显示指定的promptString。

promptString可以是空的。

%PATH:

~10,5%

会扩展PATH环境变量,然后只使用在扩展结果中从第11个(偏移量10)字符开始的五个字符。

如果没有指定长度,则采用默认值,即变量数值的余数。

如果两个数字(偏移量和长度)都是负数,使用的数字则是环境变量数值长度加上指定的偏移量或长度。

%PATH:

~-10%

会提取PATH变量的最后十个字符。

%PATH:

~0,-2%

会提取PATH变量的所有字符,除了最后两个。

如果命令扩展被启用,有几个动态环境变量可以被扩展,但不会出现在SET显示的变量列表中。

每次变量数值被扩展时,这些变量数值都会被动态计算。

如果用户用这些名称中任何一个定义变量,那个定义会替代下面描述的动态定义:

%CD%-扩展到当前目录字符串。

%DATE%-用跟DATE命令同样的格式扩展到当前日期。

%TIME%-用跟TIME命令同样的格式扩展到当前时间。

%RANDOM%-扩展到0和32767之间的任意十进制数字。

%ERRORLEVEL%-扩展到当前ERRORLEVEL数值。

%CMDEXTVERSION%-扩展到当前命令处理器扩展版本号。

%CMDCMDLINE%-扩展到调用命令处理器的原始命令行。

应用例子:

@echooff

titleWindowsXp优化文件!

:

start

cls

color0c

MODEcon:

COLS=50LINES=27

echoWindowsXp优化文件!

echoPoweredByThunderRay!

echo.

echo==============================

echo请选择要进行的操作,然后按回车

echo==============================

echo.

echo1.优化系统服务

echo.

echo2.进行端口操作

echo.

echo3.设置IP为192.168.1.2

echo.

echo(局域网上网者慎用此功能)

echo.

echo4.其它优化

echo.

echo5.设置OEM信息

echo.

echo6.清除根目录下的SXS病毒

echo.

echo7.清理系统垃圾

echo.

echo8.退出

echo.

:

cho

setchoice=

set/pchoice=请选择:

IFNOT"%Choice%"==""SETChoice=%Choice:

~0,1%

if/i"%choice%"=="1"gotostart2

if/i"%choice%"=="2"gotostart3

if/i"%choice%"=="3"gotoip

if/i"%choice%"=="4"gotoother

if/i"%choice%"=="5"gotooem

if/i"%choice%"=="6"gotovirus

if/i"%choice%"=="7"gotodel

if/i"%choice%"=="8"gotoend

echo选择无效,请重新输入

echo.

gotocho

:

start2

cls

echoWindowsXp优化文件!

echoPoweredByThunderRay!

echo.

echo==============================

echo请选择要进行的操作,然后按回车

echo==============================

echo.

echo1.优化XP系统服务

echo.

echo2.恢复XP原系统服务

echo.

echo3.返回主菜单

echo.

echo4.退出

echo.

:

Choice2

setchoice2=

set/pchoice2=请选择:

IFNOT"%Choice2%"==""SETChoice2=%Choice2:

~0,1%

if/i"%choice2%"=="1"gotooptimize

if/i"%choice2%"=="2"gotoRestore

if/i"%choice2%"=="3"gotostart

if/i"%choice2%"=="4"gotoend

echo选择无效,请重新输入

echo.

gotoChoice2

:

optimize

cls

echo开始进行优化系统服务...

scconfigAlerterstart=DISABLED

scconfigALGstart=DISABLED

scconfigAppMgmtstart=DEMAND

scconfigAudioSrvstart=AUTO

scconfigBITSstart=DEMAND

scconfigBrowserstart=DISABLED

scconfigCiSvcstart=DISABLED

scconfigClipSrvstart=DISABLED

scconfigCOMSysAppstart=DEMAND

scconfigCryptSvcstart=DEMAND

scconfigDcomLaunchstart=AUTO

scconfigDhcpstart=DISABLED

scconfigdmadminstart=DEMAND

scconfigdmserverstart=DISABLED

scconfigDnscachestart=DISABLED

scconfigERSvcstart=DISABLED

scconfigEventlogstart=AUTO

scconfigEventSystemstart=DISABLED

scconfigFastUserSwitchingCompatibilitystart=DISABLED

scconfighelpsvcstart=DISABLED

scconfigHidServstart=DISABLED

scconfigHTTPFilterstart=DEMAND

scconfigImapiServicestart=DISABLED

scconfiglanmanserverstart=DISABLED

scconfiglanmanworkstationstart=AUTO

scconfigLmHostsstart=DISABLED

scconfigMessengerstart=DISABLED

scconfigmnmsrvcstart=DISABLED

scconfigMSDTCstart=DISABLED

scconfigMSIServerstart=DEMAND

scconfigNetDDEstart=DISABLED

scconfigNetDDEdsdmstart=DISABLED

scconfigNetlogonstart=DISABLED

scconfigNetmanstart=DEMAND

scconfigNlastart=DISABLED

scconfigNtLmSspstart=DISABLED

scconfigNtmsSvcstart=DEMAND

scconfigNvsvcstart=DISABLED

scconfigOsestart=DEMAND

scconfigPlugPlaystart=AUTO

scconfigPolicyAgentstart=DISABLED

scconfigProtectedStoragestart=DISABLED

scconfigRasAutostart=DEMAND

scconfigRasManstart=DEMAND

scconfigRDSessMgrstart=DISABLED

scconfigRemoteAccessstart=DISABLED

scconfigRemoteRegistrystart=DISABLED

scconfigRpcLocatorstart=DEMAND

scconfigRpcSsstart=AUTO

scconfigSamSsstart=DISABLED

scconfigSCardSvrstart=DISABLED

scconfigSchedulestart=DISABLED

scconfigseclogonstart=DISABLED

scconfigSENSstart=DISABLED

scconfigSharedAccessstart=DISABLED

scconfigShellHWDetectionstart=DISABLED

scconfigSpoolerstart=DEMAND

scconfigsrservicestart=DISABLED

scconfigSSDPSRVstart=DISABLED

scconfigStisvcstart=DISABLED

scconfigSwprvstart=DISABLED

scconfigSysmonLogstart=DISABLED

scconfigTapiSrvstart=DEMAND

scconfigTermServicestart=DISABLED

scconfigThemesstart=AUTO

scconfigTlntSvrstart=DISABLED

scconfigTrkWksstart=DISABLED

scconfigUMWdfstart=DISABLED

scconfigupnphoststart=DEMAND

scconfigUPSstart=DISABLED

scconfigVSSstart=DISABLED

scconfigW32Timestart=DISABLED

scconfigWebClientstart=DISABLED

scconfigwinmgmtstart=AUTO

scconfigWmdmPmSNstart=DISABLED

scconfigWmistart=DEMAND

scconfigWmiApSrvstart=DISABLED

scconfigwuauservstart=DISABLED

scconfigWZCSVCstart=DISABLED

scconfigwscsvcstart=DISABLED

scconfigxmlprovstart=DEMAND

echo优化XP系统服务结束,按任意键返回!

pause>nul

gotostart2

:

Restore

cls

echo开始恢复XP原系统服务...

scconfigAlerterstart=DISABLED

scconfigALGstart=DEMAND

scconfigAppMgmtstart=DEMAND

scconfigAudioSrvstart=AUTO

scconfigBITSstart=DEMAND

scconfigBrowserstart=AUTO

scconfigCiSvcstart=DEMAND

scconfigClipSrvstart=DISABLED

scconfigCOMSysAppstart=DEMAND

scconfigCryptSvcstart=AUTO

scconfigDcomLaunchstart=AUTO

scconfigDhcpstart=AUTO

scconfigdmadminstart=DEMAND

scconfigdmserverstart=AUTO

scconfigDnscachestart=AUTO

scconfigERSvcstart=AUTO

scconfigEventlogstart=AUTO

scconfigEventSystemstart=DEMAND

scconfigFastUserSwitchingCompatibilitystart=DEMAND

scconfighelpsvcstart=AUTO

scconfigHidServstart=DISABLED

scconfigHTTPFilterstart=DEMAND

scconfigImapiServicestart=DEMAND

scconfiglanmanserverstart=AUTO

scconfiglanmanworkstationstart=AUTO

scconfigLmHostsstart=AUTO

scconfigMessengerstart=DISABLED

scconfigmnmsrvcstart=DEMAND

scconfigMSDTCstart=DEMAND

scconfigMSIServerstart=DEMAND

scconfigNetDDEstart=DISABLED

scconfigNetDDEdsdmstart=DISABLED

scconfigNetlogonstart=DEMAND

scconfigNetmanstart=DEMAND

scconfigNlastart=DEMAND

scconfigNtLmSspstart=DEMAND

scconfigNtmsSvcstart=DEMAND

scconfigPlugPlaystart=AUTO

scconfigPolicyAgentstart=AUTO

scconfigProtectedStoragestart=AUTO

scconfigRasAutostart=DEMAND

scconfigRasManstart=DEMAND

scconfigRDSessMgrstart=DEMAND

scconfigRemoteAccessstart=DISABLED

scconfigRemoteRegistrystart=AUTO

scconfigRpcLocatorstart=DEMAND

scconfigRpcSsstart=AUTO

scconfigRSVPstart=DEMAND

scconfigSamSsstart=AUTO

scconfigSCardSvrstart=DEMAND

scconfigSchedulestart=AUTO

scconfigseclogonstart=AUTO

scconfigSENSstart=AUTO

scconfigSharedAccessstart=AUTO

scconfigShellHWDetectionstart=AUTO

scconfigSpoolerstart=AUTO

scconfigsrservicestart=DISABLED

scconfigSSDPSRVstart=DEMAND

scconfigstisvcstart=DEMAND

scconfigSwPrvstart=DEMAND

scconfigSysmonLogstart=DEMAND

scconfigTapiSrvstart=DEMAND

scconfigTermServicestart=DEMAND

scconfigThemesstart=AUTO

scconfigTlntSvrstart=DISABLED

scconfigTrkWksstart=AUTO

scconfigUMWdfstart=DEMAND

scconfigupnphoststart=DEMAND

scconfigUPSstart=DEMAND

scconfigVSSstart=DEMAND

scconfigW32Timestart=AUTO

scconfigWebClientstart=AUTO

scconfigwinmgmtstart=AUTO

scconfigWmdmPmSNstart=DEMAND

scconfigWmistart=DEMAND

scconfigWmiApSrvstart=DEMAND

scconfigwscsvcstart=AUTO

scconfigwuauservstart=AUTO

scconfigWZCSVCstart=AUTO

scconfigxmlprovstart=DEMAND

echo恢复XP原系统服务结束,按任意键返回!

pause>nul

gotostart2

:

start3

cls

echoWindowsXp优化文件!

echoPoweredByThunderRay!

echo.

echo==============================

echo请选择要进行的操作,然后按回车

echo==============================

echo.

echo1.封杀135,445端口

echo.

echo2.恢复135,445端口

echo.

echo3.返回主菜单

echo.

echo4.退出

echo.

:

Choice3

setchoice3=

set/pchoice3=请选择:

IFNOT"%Choice3%"==""SETChoice2=%Choice2:

~0,1%

if/i"%choice3%"=="1"gotokillport

if/i"%choice3%"=="2"gotoopenport

if/i"%choice3%"=="3"gotostart

if/i"%choice3%"=="4"gotoend

echo选择无效,请重新输入

echo.

gotoChoice3

:

killport

cls

echo开始封杀135,445端口...

regaddHKLM\SOFTWARE\Microsoft\Ole/vEnableDCOM/dN/f

regaddHKLM\SOFTWARE\Microsoft\Rpc/v"DCOMProtocols"/tREG_MULTI_SZ/dncacn_spx\0ncacn_nb_nb\0ncacn_nb_ipx\0/f

scconfigMSDTCstart=DISABLED

regaddHKLM\SYSTEM\CurrentControlSet\Services\NetBT\Parameters/vSMBDeviceEnabled/tREG_DWORD/d0/f

echo封杀135,445端口结束,按任意键返回!

pause>nul

gotostart3

:

openport

cls

echo开始恢复135,445端口...

regaddHKLM\SOFTWARE\Microsoft\Ole/vEnableDCOM/dY/f

regaddHKLM\SOFTWARE\Microsoft\Rpc/v"DCOMProtocols"/tREG_MULTI_SZ/dncacn_spx\0ncacn_nb_nb\0ncacn_nb_ipx\0ncacn_ip_tcp\0/f

scconfigMSDTCstart=AUTO

regaddHKLM\SYSTEM\CurrentControlSet\Services\NetBT\Parameters/vSMBDeviceEnabled/tREG_DWORD/d1/f

echo恢复135,445端口结束,按任意键返回!

pause>nul

gotostart3

:

ip

cls

echo开始设置IP地址...

netshinterfaceipsetaddressname="本地连接"static192.168.1.2255.255.255.0

echo设置I

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > PPT模板 > 其它模板

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1