[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[文本处理] 批处理如何正确保存含有特殊符号的程序返回值?

求教如何在不导出/写入到硬盘的情况下保存aes加密后具有特殊字符返回值到变量
还是说是不可能的

基础版_A
  1. mshta http://bathome.net/s/hta/index.html Tools.get('aes')
  2. ::设定基础aes编码变量内容
  3. set ID=Text_1234567890AaBbCc
  4. ::借助for命令保存编码结果值到变量//密码为test//编码问题导致存储不完全
  5. for /f %%i in ('echo %ID%^|aes.exe -e test -s -s') do (set "forgettempvar=%%i")
  6. ::解码//提示密码错误
  7. echo %forgettempvar%|aes.exe -d test -s -s
  8. pause
复制代码
  1. @echo off&::setlocal enabledelayedexpansion&::echo %0&pause>nul&::文本格式Ansi保持用
  2. set base_line_count=12
  3. mshta http://bathome.net/s/hta/index.html Tools.get('aes')
  4. goto:start_2
  5. :line_display
  6. echo.&echo.------
  7. (echo.&set /p="cmd  line%base_line_count%=  " <nul&call:displaylinetext)
  8. (echo.&set /p="echo line%base_line_count%=  " <nul)
  9. set /a base_line_count=%base_line_count%+1
  10. goto:eof
  11. :start_2
  12. (call:line_display)&echo.line 12
  13. (call:line_display)&set ID=Text_1234567890AaBbCc
  14. (call:line_display)&echo ID=%ID%
  15. (call:line_display)&for /f %%i in ('echo %ID%^|aes.exe -e test -s -s') do (set "forgettempvar=%%i"&echo.forgettempvar = %%i )
  16. (call:line_display)&for /f %%i in ('echo %forgettempvar%^|aes.exe -d test -s -s') do (set a=%%i&echo.a = %a%)
  17. (call:line_display)&echo %forgettempvar%|aes.exe -d test -s -s
  18. (call:line_display)&pause&cls
  19. (call:line_display)&echo %ID%|aes.exe -e test -s -s>3.txt
  20. (call:line_display)&for /f %%i in (3.txt) do (echo %%i)
  21. (call:line_display)&echo.type 3.txt
  22. (call:line_display)&@type 3.txt
  23. (call:line_display)&pause&cls
  24. (call:line_display)&del 4.txt
  25. (call:line_display)&echo %ID%|aes.exe -e test -s 4.txt
  26. (call:line_display)&
  27. (call:line_display)&echo.line 23
  28. (call:line_display)&echo.type 4.txt
  29. (call:line_display)&@type 4.txt
  30. (call:line_display)&for /f %%i in (4.txt) do (set "forgettempvar=%%i")
  31. (call:line_display)&echo %forgettempvar%
  32. (call:line_display)&pause&cls
  33. (call:line_display)&
  34. (call:line_display)&for /f %%i in ('echo %forgettempvar%^|aes.exe -d test -s -s') do (set a=%%i)
  35. (call:line_display)&pause&cls
  36. (call:line_display)&
  37. (call:line_display)&echo %forgettempvar%|aes.exe -d test -s -s
  38. (call:line_display)&pause&cls
  39. (call:line_display)&
  40. (call:line_display)&for /f %%i in ('aes.exe -d test 4.txt -s') do (set a=%%i)
  41. (call:line_display)&echo %a%
  42. (call:line_display)&aes.exe -d test 4.txt -s
  43. (call:line_display)&pause&cls
  44. (call:line_display)&echo.exit&pause
  45. :displaylinetext
  46. set /a skipline=%base_line_count%-1
  47. for /f "skip=%skipline% usebackq delims=" %%a in (%~dpnx0) do (
  48.    echo %%a
  49.    goto:eof
  50. )
  51. goto:eof
复制代码

返回列表