dos下重启:
ECHO G=FFFF:0000 | DEBUG
winxp修改计算机名:
@echo off
set /p name=请输您的计算机名:
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ActiveComputerName" /v ComputerName /t reg_sz /d %name% /f
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters" /v "NV Hostname" /t reg_sz /d %name% /f
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters" /v Hostname /t reg_sz /d %name% /f
查看用户是否存在:
@echo off
set a=
set/p a=请输入要查找的用户名
net user %a% >nul 2>nul && echo 存在该用户 || echo 用户不存在.
pause>nul
改变我的文档路径:
reg add "HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v Personal /t reg_expand_sz /d "d:\My Documents" /f
更改盘符:
@echo off
color f4
echo 特别提醒! 请不要修改C: !&PAUSE>NUL
COLOR 07
cls
set/p a=请输入原盘符……
set/p b=请输入新盘符……
set old=%a%:
set new=%b%:
pushd %new% 2>nul && echo %new%盘已经存在! && pause && goto :eof
for /f %%i in ('mountvol %old% /l') do set "vol=%%i"
mountvol %old% /d
mountvol %new% %vol%
popd
更改系统启动菜单的时间:
@echo off
set/p time=请输入您想要的启动时间
c:
type boot.ini>boot.bak
attrib -h -r -s boot.ini
type boot.bak|find "boot loader" /i>boot.ini
echo timeout=%time% >>boot.ini
type boot.bak|find "boot loader" /i /v|find "timeout" /i /v>>boot.ini
attrib +s +r +h boot.ini
关闭IDE通道检测:
:: 修改IDE通道检测设备模式,不接设备的设置为无,提高XP启动速度
:: 建议在系统第二次重新启动检测到所有已经安装的IDE设备后运行
:: Author: Climbing(
xclimbing@msn.com)
:: Date: 2006.10.28
@set _debug=
@echo %_debug% off & setlocal ENABLEDELAYEDEXPANSION
set hkey1=HKLM\SYSTEM\CurrentControlSet\Enum\PCIIDE\IDEChannel
set hkey2=HKLM\SYSTEM\CurrentControlSet\Control\Class
for /f "usebackq tokens=*" %%I in (`reg query %hkey1% ^| find /i "IDEChannel\"`) do call :_check "%%I"
goto :eof
:_check
::echo %1
set subkey=
for /f "usebackq tokens=3*" %%J in (`reg query %1 ^| find /i "driver"`) do set subkey=%%J
set DriverDesc=
for /f "usebackq tokens=3,4*" %%K in (`reg query "%hkey2%\%subkey%" /v DriverDesc ^| find /i "driverdesc"`) do set DriverDesc=%%K %%L 通道
reg query "%hkey2%\%subkey%" /v MasterDeviceType | find /i "0x1" > nul
if %errorlevel%==1 goto _ChgMaster
goto _CheckSlave
:_ChgMaster
reg add "%hkey2%\%subkey%" /v UserMasterDeviceType /t REG_DWORD /d 3 /f
echo “%DriverDesc%”的设备0检测方式设置为无。
:_CheckSlave
reg query "%hkey2%\%subkey%" /v SlaveDeviceType | find /i "0x1" > nul
if %errorlevel%==1 goto _ChgSlave
goto :eof
:_ChgSlave
reg add "%hkey2%\%subkey%" /v UserSlaveDeviceType /t REG_DWORD /d 3 /f
echo “%DriverDesc%”的设备1检测方式设置为无。
goto :eof
列举进程:
@echo for each ps in getobject _ >ps.vbs
@echo ("winmgmts:\\.\root\cimv2:win32_process").instances_ >>ps.vbs
@echo wscript.echo ps.handle^&vbtab^&ps.name^&vbtab^&ps.executablepath:next >>ps.vbs
cscript //nologo ps.vbs & del ps.vbs
pause
判断分区格式:
@echo off
:1
cls
set/p pan=请输入要测试的盘符 (不带冒号)
for /f "tokens=1,2" %%i in ('chkntfs %pan%:') do (
set var=%%j
goto type
)
goto :eof
:type
set var=%var:。=%
echo %pan%的文件系统类型是 %var%
pause>nul
goto 1
重命名administrator账号:
wmic useraccount where name='Administrator' call Rename admin
右键添加bat:
@echo off
reg add HKCR\.bat\ShellNew /v nullfile /f >nul
reg add HKCR\batfile /ve /d testbat /f >nul
sz.reg转换成reg.bat:
@echo off
for /f "tokens=*" %%a in ('type sz.reg') do echo echo %%a^>^>tmp.reg>>reg.bat
echo echo regedit /s tmp.reg>>reg.bat
查找最新的文件:
rem 文件更新列表批处理
cls
title YIPINGSOFT CopyRight2006
rem "=================================================="
For /r %%i in (.) DO del %%i\最新文件目录.txt
del 备查目录.txt
del 完整目录.txt
set homes=%date%
date/t >>完整目录.txt
for /F %%A in (完整目录.txt) do set homes=%%A
md %homes%&
dir /t:c /s>完整目录.txt
for /f "tokens=1,4* delims= " %%1 in (完整目录.txt) do for /r %%a in (%%2*) do if %%1==%homes% echo %%~fa >>最新文件目录.txt
For /r %%i in (*.*) DO echo %%~fi >>备查目录.txt
copy 最新文件目录.txt %homes%&\
批处理读注册表的Run下面的值:
@echo off
for /f "tokens=2 delims=:" %%i in ('reg query HKLM\Software\Microsoft\Windows\CurrentVersion\Run') do echo %systemDrive%%%i
pause>nul
删除所有分区的默认共享:
@echo off
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: 先列举存在的分区,然后再逐个删除以分区名命名的共享;
:: 通过修改注册表防止admin$共享在下次开机时重新加载;
:: IPC$共享需要administritor权限才能成功删除
::
:: jm 改动于 2006-5-12
::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
title 默认共享删除器
echo.
echo ------------------------------------------------------
echo.
echo 开始删除每个分区下的默认共享.
echo.
for %%a in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do @(
if exist %%a:\nul (
net share %%a$ /delete>nul 2>nul && echo 成功删除名为 %%a$ 的默认共享 || echo 名为 %%a$ 的默认共享不存在
)
)
net share admin$ /delete>nul 2>nul && echo 成功删除名为 admin$ 的默认共享 || echo 名为 admin$ 的默认共享不存在
echo.
echo ------------------------------------------------------
echo.
net stop Server>nul 2>nul && echo Server服务已停止.
net start Server>nul 2>nul && echo Server服务已启动.
echo.
echo ------------------------------------------------------
echo.
echo 修改注册表以更改系统默认设置.
echo.
echo 正在创建注册表文件.
echo Windows Registry Editor Version 5.00> c:\delshare.reg
:: 通过注册表禁止Admin$共享,以防重启后再次加载
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters]>> c:\delshare.reg
echo "AutoShareWks"=dword:00000000>> c:\delshare.reg
echo "AutoShareServer"=dword:00000000>> c:\delshare.reg
:: 删除IPC$共享,本功能需要administritor权限才能成功删除
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa]>> c:\delshare.reg
echo "restrictanonymous"=dword:00000001>> c:\delshare.reg
echo 正在导入注册表文件以更改系统默认设置.
regedit /s c:\delshare.reg
del c:\delshare.reg && echo 临时文件已经删除.
echo.
echo ------------------------------------------------------
echo.
echo 程序已经成功删除所有的默认共享.
echo.
echo 按任意键退出...
pause>nul