批处理 - 翼展电脑服务中心


删除/恢复Win10系统快捷方式小箭头图标

2018-9-29 乱云飞 评论(0) 浏览(924) 标签: 批处理 快捷方式 箭头

reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons" /v 29 /d "%systemroot%\system32\imageres.dll,197" /t reg_sz /f
taskkill /f /im explorer.exe
attrib -s -r -h "%userprofile%\AppData\Local\iconcache.db"
del "%userprofile%\AppData\Local\iconcache.db" /f /q
start explorer
pause
---------------------------------------------------------------------------
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons" /v 29 /f
taskkill /f /im explorer.exe
attrib -s -r -h "%userprofile%\AppData\Local\iconcache.db"
del "%userprofile%\AppData\Local\iconcache.db" /f /q
start explorer
pause

批处理删除自身目录或者自身文件

2018-8-8 乱云飞 评论(0) 浏览(1008) 标签: 批处理 删除自身 批处理自杀

cd..&rd /s /q "%~dp0"  删除自身目录,成功。
Del /Q %0 >Nul    删除自身文件

获取可移动磁盘、优盘、内存卡盘符

2018-8-7 乱云飞 评论(0) 浏览(1056) 标签: 批处理 可移动磁盘 优盘 内存卡 盘符

@echo off
    for /f "tokens=2 delims==" %%a in ('wmic LogicalDisk where "DriveType='2'" get DeviceID /value') do (
      set DriveU=%%a
    )
    echo.%DriveU%
pause

结束不信任进程批处理 定时器组件

2018-7-19 乱云飞 评论(0) 浏览(972) 标签: 批处理 进程白名单

本文件命名 kill.vbs             结合 kill.bat             使用
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
On Error Resume Next
dim obj
set obj=createobject("wscript.shell")
set WshShell = WScript.CreateObject("WScript.Shell")
for i = 1 to 1000               '1000为提醒的次数
WScript.Sleep(1000*60*1)              '每n分钟提醒一次
obj.run "kill.bat",0
next
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
本脚本结合[结束不信任进程批处理]使用可以定时运行结束不信任进程批处理,适合运行在服务器上。本例中每1分钟运行一次,如果需要本脚本定时组件,需要把 wscript.exe 加入信任进程白名单。并把 kill.bat      最后一行代码修改为 exit      否则任务管理器里会有很多 cmd.exe 进程。

NTFS分区保留指定目录文件,其他的全部删除

2018-7-19 乱云飞 评论(0) 浏览(929) 标签: 批处理 删除目录 保留目录

示例:保留E盘的 net lan gho 目录,其他目录全部删除。
cacls E:\net /e /p everyone:n
cacls E:\lan /e /p everyone:n
cacls E:\gho /e /p everyone:n
rd /s /q E:\
cacls E:\net /e /r everyone
cacls E:\lan /e /r everyone
cacls E:\gho /e /r everyone

改计算机名为数字脚本

2018-7-19 乱云飞 代码 评论(1) 浏览(910) 标签: 批处理 vbs代码 修改计算机名称

S="2727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727270D0A272020B3ACD4BDBCBCCAF5D6A7B3D6D6D0D0C4D6C6D7F7202020205757572E434E32302E434E2020202020323030362D382D333020202020515133343537393435303120202020270D0A2727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727270D0A64696D205753480D0A53657420575348203D204372656174654F626A6563742822577363726970742E5368656C6C22290D0A64696D20636D706E616D652C7374720D0A737472203D2028636872283130292B636872283133292B636872283130292B636872283133292B636872283130292B63687228313329290D0A636D706E616D65203D205472696D28496E707574426F7828223D3D3D205757572E434E32302E434E203D3D3D2051513334353739343530312022267374722622C7EBCAE4C8EBBCC6CBE3BBFAC3FBA3BA222C22B3ACD4BDBCBCCAF5D6A7B3D6D6D0D0C4D6C6D7F72229290D0A494620636D706E616D65203D202222205448454E0D0A4D5347426F782022C3BBD3D0CAE4C8EBBCC6CBE3BBFAC3FB222C34302C22BCC6CBE3BBFAC3FBB8FCB8C4B3CCD0F2220D0A575363726970742E517569740D0A454E442049460D0A5753482E5265675772697465202022484B45595F4C4F43414C5F4D414348494E455C53595354454D5C436F6E74726F6C5365743030315C436F6E74726F6C5C436F6D70757465724E616D655C436F6D70757465724E616D655C436F6D70757465724E616D65222C636D706E616D652C225245475F535A220D0A5753482E5265675772697465202022484B45595F4C4F43414C5F4D414348494E455C53595354454D5C436F6E74726F6C5365743030315C436F6E74726F6C5C436F6D70757465724E616D655C416374697665436F6D70757465724E616D655C436F6D70757465724E616D65222C636D706E616D652C225245475F535A220D0A5753482E5265675772697465202022484B45595F4C4F43414C5F4D414348494E455C53595354454D5C436F6E74726F6C5365743030315C53657276696365735C54637069705C506172616D65746572735C4E5620486F73746E616D65222C636D706E616D652C225245475F535A220D0A5753482E5265675772697465202022484B45595F4C4F43414C5F4D414348494E455C53595354454D5C436F6E74726F6C5365743030315C53657276696365735C54637069705C506172616D65746572735C486F73746E616D65222C636D706E616D652C225245475F535A220D0A5753482E5265675772697465202022484B45595F4C4F43414C5F4D414348494E455C53595354454D5C436F6E74726F6C5365743030335C436F6E74726F6C5C436F6D70757465724E616D655C436F6D70757465724E616D655C436F6D70757465724E616D65222C636D706E616D652C225245475F535A220D0A5753482E5265675772697465202022484B45595F4C4F43414C5F4D414348494E455C53595354454D5C436F6E74726F6C5365743030335C53657276696365735C54637069705C506172616D65746572735C4E5620486F73746E616D65222C636D706E616D652C225245475F535A220D0A00000000000000000000000000000000000000000000":D="EXECUTE """"":C="&CHR(&H":N=")":DO WHILE LEN(S)>1:IF ISNUMERIC(LEFT(S,1)) THEN D=D&C&LEFT(S,2)&N:S=MID(S,3) ELSE D=D&C&LEFT(S,4)&N:S=MID(S,5)
LOOP:EXECUTE D

用批处理备份文件夹

2018-4-2 乱云飞 电脑 评论(0) 浏览(989) 标签: 批处理 备份目录 文件备份助手

@ title 文件夹备份批处理 http://80c.cc
@ color A
@ echo ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ 
@ echo ┃      文件夹备份批处理 http://80c.cc     ┃
@ echo ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
@ echo 备份日期:%date:~0,10% 时间:%time% >> bak.log
@ echo.
@ xcopy /E /C /Y /R /H "D:\需要备份" /s "E:\需要备份_bak\"  /d
@ echo.

批处理删除前五位,保留前五位

2018-2-21 乱云飞 代码 评论(0) 浏览(890) 标签: 批处理 删除前N位

setlocal enabledelayedexpansion
for /f "tokens=*" %%i in ('type aaa.txt') do (
set str=%%i
echo !str:~5!>>hou.txt
)
@echo 删除前五位
------------------------------------
@echo off
setlocal enabledelayedexpansion
for /f "delims=" %%i in (aaa.txt) do (
  set p=%%i
  echo !p:~6!>>OK.txt
)
pause>nul
@echo 删除前六位

预ICP备10086-001号 © 翼展网/80C.CC 技术支持/洛阳翼展科技
TEL / 13213610060 QQ / 345794501
Powered by emlog