本帖最后由 /zhqsystem/zhq 于 2015-11-9 03:56 编辑
- @echo off
- (echo,Windows Registry Editor Version 5.00
- echo/
- echo,[-HKEY_CURRENT_USER\Software\name]
- )>"%~dp0\执行完成后自动删除.reg"
- for /f "delims=" %%i in ('type "%~dp0\1.txt"') do (
- reg.exe add "hkcu\software\name\%%i" /f
- )
- for /f "delims=" %%i in ('reg.exe query "hkcu\software\name"') do (
- reg.exe query "%%i" >nul 2>nul&&(
- (echo=%%~nxi)>>"%~dp0\1_new.txt"
- reg.exe delete "%%i" /va /f
- )
- )
- timeout/t 1
- regedit.exe /s "%~dp0\执行完成后自动删除.reg"&&del/f/q "%~dp0\执行完成后自动删除.reg"
- pause
复制代码
上边的是不转换后边的内容,下边的转换并删除无用空格及其标点,各有不同之处,截取字符串也可以不过考虑最后的字符不稳定没有用到
-
- @echo off
- rd/s/q "%~dp0\name" 2>nul
- for /f "delims=" %%i in ('type "%~dp0\1.txt"') do (
- for /f "tokens=1,* delims=:" %%j in ("%%i") do (
- if "%%k"=="**" (
- md "%~dp0\name\%%~nxj.bathome"
- ) else (
- md "%~dp0\name\%%~nxj"
- )
- )
- )
- (for /f "delims=" %%i in ('dir/ad/b/l/on "%~dp0\name\"') do (
- if /i "%%~xi"==".bathome" (
- echo,%%~ni::**
- ) else (
- echo,%%~ni
- )
- )
- )>1_new.txt
- rd/s/q "%~dp0\name" 2>nul
- pause
复制代码
|