标题: [文本处理] 批处理如何正确保存含有特殊符号的程序返回值? [打印本页]
作者: WindCat 时间: 2022-10-4 19:35 标题: 批处理如何正确保存含有特殊符号的程序返回值?
求教如何在不导出/写入到硬盘的情况下保存aes加密后具有特殊字符返回值到变量
还是说是不可能的
基础版_A- mshta http://bathome.net/s/hta/index.html Tools.get('aes')
- ::设定基础aes编码变量内容
- set ID=Text_1234567890AaBbCc
- ::借助for命令保存编码结果值到变量//密码为test//编码问题导致存储不完全
- for /f %%i in ('echo %ID%^|aes.exe -e test -s -s') do (set "forgettempvar=%%i")
- ::解码//提示密码错误
- echo %forgettempvar%|aes.exe -d test -s -s
- pause
复制代码
- @echo off&::setlocal enabledelayedexpansion&::echo %0&pause>nul&::文本格式Ansi保持用
- set base_line_count=12
- mshta http://bathome.net/s/hta/index.html Tools.get('aes')
- goto:start_2
- :line_display
- echo.&echo.------
- (echo.&set /p="cmd line%base_line_count%= " <nul&call:displaylinetext)
- (echo.&set /p="echo line%base_line_count%= " <nul)
- set /a base_line_count=%base_line_count%+1
- goto:eof
- :start_2
- (call:line_display)&echo.line 12
- (call:line_display)&set ID=Text_1234567890AaBbCc
- (call:line_display)&echo ID=%ID%
- (call:line_display)&for /f %%i in ('echo %ID%^|aes.exe -e test -s -s') do (set "forgettempvar=%%i"&echo.forgettempvar = %%i )
- (call:line_display)&for /f %%i in ('echo %forgettempvar%^|aes.exe -d test -s -s') do (set a=%%i&echo.a = %a%)
- (call:line_display)&echo %forgettempvar%|aes.exe -d test -s -s
- (call:line_display)&pause&cls
- (call:line_display)&echo %ID%|aes.exe -e test -s -s>3.txt
- (call:line_display)&for /f %%i in (3.txt) do (echo %%i)
- (call:line_display)&echo.type 3.txt
- (call:line_display)&@type 3.txt
- (call:line_display)&pause&cls
- (call:line_display)&del 4.txt
- (call:line_display)&echo %ID%|aes.exe -e test -s 4.txt
- (call:line_display)&
- (call:line_display)&echo.line 23
- (call:line_display)&echo.type 4.txt
- (call:line_display)&@type 4.txt
- (call:line_display)&for /f %%i in (4.txt) do (set "forgettempvar=%%i")
- (call:line_display)&echo %forgettempvar%
- (call:line_display)&pause&cls
- (call:line_display)&
- (call:line_display)&for /f %%i in ('echo %forgettempvar%^|aes.exe -d test -s -s') do (set a=%%i)
- (call:line_display)&pause&cls
- (call:line_display)&
- (call:line_display)&echo %forgettempvar%|aes.exe -d test -s -s
- (call:line_display)&pause&cls
- (call:line_display)&
- (call:line_display)&for /f %%i in ('aes.exe -d test 4.txt -s') do (set a=%%i)
- (call:line_display)&echo %a%
- (call:line_display)&aes.exe -d test 4.txt -s
- (call:line_display)&pause&cls
- (call:line_display)&echo.exit&pause
-
- :displaylinetext
- set /a skipline=%base_line_count%-1
- for /f "skip=%skipline% usebackq delims=" %%a in (%~dpnx0) do (
- echo %%a
- goto:eof
- )
- goto:eof
复制代码
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |