|
doshhwa
新手上路

积分 5
发帖 5
注册 2010-6-19
状态 离线
|
『楼 主』:
关于加密文档的批处理
使用 LLM 解释/回答一下
现在我想做一个批处理 用来加密文档。
工作方式是这样的:
1.有一个文本文档a.txt
2.经过批处理处理后 生成*.bat *即文件名 能够自定义。
3.用记事本打开此bat看不到里面内容 即看不到文本文档a.txt的内容
4.运行此bat 提示输入批处理时设置的密码。
5.密码通过后在cmd窗口显示文本文档a.txt的内容。
现在不知道如何把txt文件内容插入一个批处理之中。
求高人指教!
我的意图有不明白的地方可以问我。
Now I want to make a batch script to encrypt a document.
The working method is like this:
1. There is a text document a.txt
2. After processing by the batch script, generate *.bat * that is the file name and can be customized.
3. When opening this bat with Notepad, you can't see the content inside, that is, you can't see the content of the text document a.txt
4. Running this bat prompts to enter the password set when the batch script is set.
5. After the password is passed, the content of the text document a.txt is displayed in the cmd window.
Now I don't know how to insert the content of the txt file into a batch script.
Please ask me if there is anything unclear in my intention.
|
|
2010-6-19 23:39 |
|
|
HAT
版主
       
积分 9023
发帖 5017
注册 2007-5-31
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
你在什么地方看到过这样的批处理?
Where did you see such a batch file?
|

 |
|
2010-6-20 00:52 |
|
|
Hanyeguxing
银牌会员
     正在学习中的菜鸟...
积分 1039
发帖 897
注册 2009-3-1 来自 在地狱中仰望天堂
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
Originally posted by doshhwa at 2010-6-19 23:39:
现在我想做一个批处理 用来加密文档。
工作方式是这样的:
1.有一个文本文档a.txt
2.经过批处理处理后 生成*.bat *即文件名 能够自定义。
3.用记事本打开此bat看不到里面内容 即看不到文本文档a.txt的内容
4.运行此bat 提示输入批处理时设置的密码。
5.密码通过后在cmd窗口显示文本文档a.txt的内容。
现在不知道如何把txt文件内容插入一个批处理之中。
求高人指教!
我的意图有不明白的地方可以问我。
将a.txt拖到此批处理即开始运行,密码必须为1234567890ABCDEF的任意排列。生成新的批处理为原名加下划如a_bat。运行加密后的批处理生成新的文本为Hanye.txt
@echo off&setlocal ENABLEDELAYEDEXPANSION
cd/d "%~dp0">nul
if %~z1 gtr 65280 echo.文件大小超出范围而出错&pause&exit
copy/b "%~1" $tmp$>nul
set/a s=%~z1+255
set q=123456789ABCDEF0
set/p p=请设置密码:
for /l %%a in (0,1,15) do set "#!p:~%%a,1!=!q:~%%a,1!"
call:n %s%
(for /f "delims=" %%a in ('more +29^<%~fs0') do echo.%%a)>"%~n1_.bat"
(for /f "eol=- skip=1 delims=" %%a in ('^(echo d100,%s%^&echo q^)^|debug $tmp$^&^&del $tmp$') do (
set a=%%a&set a=!a:-= !
set/p=e!a:~5,6!<nul&set a=!a:~11,47!
for /l %%b in (0,1,46) do if "!a:~%%b,1!"==" " (set/p= <nul) else for %%c in (!a:~%%b^,1!) do set/p=!#%%c!<nul
echo.
))>>"%~n1_.bat"
graftabl 936 >nul
call:n %~z1
(for %%a in (rcx %s% nHanye.txt w q) do echo.%%a)>>"%~n1_.bat"
exit
:n
set n=%1&set s=
:m
set/a m=%n%%%16-1
set/a n/=16
set m=!q:~%m%,1!
set s=%m%%s%
if "%n%" neq "0" goto:m
goto:eof
@echo off&setlocal enabledelayedexpansion
set q=!q!
set/p p=请输入密码:
for /l %%a in (0,1,15) do set "#^!q:~%%a,1^!=^!p:~%%a,1^!"
(for /f "delims=" %%a in ('more +15^<%~fs0') do (
set k=%%a&if not "^!k:~0,1^!"=="e" (echo.%%a) else (
set/p=^!k:~0,7^!<nul&set k=^!k:~7^!
for /l %%b in (0,1,46) do if "^!k:~%%b,1^!"==" " (set/p= <nul) else for %%c in (^!k:~%%b^^,1^!) do set/p=^!#%%c^!<nul
echo.
)
))>$tmp$
debug<$tmp$>nul
del /q $tmp$
graftabl 936 >nul
start "" Hanye.txt&exit
例如,文本内容为“寒夜孤星”,密码为“A197D8E5F6C320B4”,生成的批处理如下: @echo off&setlocal enabledelayedexpansion
set q=123456789ABCDEF0
set/p p=请输入密码:
for /l %%a in (0,1,15) do set "#!q:~%%a,1!=!p:~%%a,1!"
(for /f "delims=" %%a in ('more +15^<%~fs0') do (
set k=%%a&if not "!k:~0,1!"=="e" (echo.%%a) else (
set/p=!k:~0,7!<nul&set k=!k:~7!
for /l %%b in (0,1,46) do if "!k:~%%b,1!"==" " (set/p= <nul) else for %%c in (!k:~%%b^,1!) do set/p=!#%%c!<nul
echo.
)
))>$tmp$
debug<$tmp$>nul
del /q $tmp$
graftabl 936 >nul
start "" Hanye.txt&exit
e0100 F1 17 5D F3 F3 BD 5E B4
rcx
8
nHanye.txt
w
q
Last edited by Hanyeguxing on 2010-6-20 at 02:02 ]
Originally posted by doshhwa at 2010-6-19 23:39:
Now I want to make a batch script to encrypt a document.
The working method is as follows:
1. There is a text document a.txt
2. After processing by the batch script, generate a *.bat * which is the file name and can be customized.
3. Opening this bat with Notepad cannot see the content inside, that is, cannot see the content of the text document a.txt
4. Running this bat prompts to enter the password set when the batch script is set.
5. After the password is passed, the content of the text document a.txt is displayed in the cmd window.
Now I don't know how to insert the content of the txt file into a batch script.
Please ask experts for advice!
If there is any unclear place in my intention, you can ask me.
Drag a.txt to this batch script to start running, and the password must be any permutation of 1234567890ABCDEF. The generated new batch script is the original name plus an underscore such as a_bat. Running the encrypted batch script generates a new text as Hanye.txt
@echo off&setlocal ENABLEDELAYEDEXPANSION
cd/d "%~dp0">nul
if %~z1 gtr 65280 echo. File size exceeds the range and an error occurs&pause&exit
copy/b "%~1" $tmp$>nul
set/a s=%~z1+255
set q=123456789ABCDEF0
set/p p=Please set the password:
for /l %%a in (0,1,15) do set "#!p:~%%a,1!=!q:~%%a,1!"
call:n %s%
(for /f "delims=" %%a in ('more +29^<%~fs0') do echo.%%a)>"%~n1_.bat"
(for /f "eol=- skip=1 delims=" %%a in ('^(echo d100,%s%^&echo q^)^|debug $tmp$^&^&del $tmp$') do (
set a=%%a&set a=!a:-= !
set/p=e!a:~5,6!<nul&set a=!a:~11,47!
for /l %%b in (0,1,46) do if "!a:~%%b,1!"==" " (set/p= <nul) else for %%c in (!a:~%%b^,1!) do set/p=!#%%c!<nul
echo.
))>>"%~n1_.bat"
graftabl 936 >nul
call:n %~z1
(for %%a in (rcx %s% nHanye.txt w q) do echo.%%a)>>"%~n1_.bat"
exit
:n
set n=%1&set s=
:m
set/a m=%n%%%16-1
set/a n/=16
set m=!q:~%m%,1!
set s=%m%%s%
if "%n%" neq "0" goto:m
goto:eof
@echo off&setlocal enabledelayedexpansion
set q=!q!
set/p p=Please enter the password:
for /l %%a in (0,1,15) do set "#^!q:~%%a,1^!=^!p:~%%a,1^!"
(for /f "delims=" %%a in ('more +15^<%~fs0') do (
set k=%%a&if not "^!k:~0,1^!"=="e" (echo.%%a) else (
set/p=^!k:~0,7^!<nul&set k=^!k:~7^!
for /l %%b in (0,1,46) do if "^!k:~%%b,1^!"==" " (set/p= <nul) else for %%c in (^!k:~%%b^^,1^!) do set/p=^!#%%c^!<nul
echo.
)
))>$tmp$
debug<$tmp$>nul
del /q $tmp$
graftabl 936 >nul
start "" Hanye.txt&exit
For example, the text content is "Cold Night Lone Star", the password is "A197D8E5F6C320B4", and the generated batch script is as follows: @echo off&setlocal enabledelayedexpansion
set q=123456789ABCDEF0
set/p p=Please enter the password:
for /l %%a in (0,1,15) do set "#!q:~%%a,1!=!p:~%%a,1!"
(for /f "delims=" %%a in ('more +15^<%~fs0') do (
set k=%%a&if not "!k:~0,1!"=="e" (echo.%%a) else (
set/p=!k:~0,7!<nul&set k=!k:~7!
for /l %%b in (0,1,46) do if "!k:~%%b,1!"==" " (set/p= <nul) else for %%c in (!k:~%%b^,1!) do set/p=!#%%c!<nul
echo.
)
))>$tmp$
debug<$tmp$>nul
del /q $tmp$
graftabl 936 >nul
start "" Hanye.txt&exit
e0100 F1 17 5D F3 F3 BD 5E B4
rcx
8
nHanye.txt
w
q
Last edited by Hanyeguxing on 2010-6-20 at 02:02 ]
|

批处理之家 http://bbs.bathome.net/forum-5-1.html |
|
2010-6-20 01:53 |
|
|
doshhwa
新手上路

积分 5
发帖 5
注册 2010-6-19
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
大致的我写出来了。
现在有个问题 :
:jm
type "%nfile%.bat" | echo @echo off>>"%nfile%.bat"
type "%nfile%.bat" | echo title 正在打开加密文档:"file"...>>"%nfile%.bat"
type "%nfile%.bat" | echo color a2>>"%nfile%.bat"
type "%nfile%.bat" | echo cls>>"%nfile%.bat"
type "%nfile%.bat" | echo :begin>>"%nfile%.bat"
type "%nfile%.bat" | echo echo ┏ ┓>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo 请输入密码。 >>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo 输入密码后您才能看到文本文档的内容。 >>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo ┗ ┛>>"%nfile%.bat"
type "%nfile%.bat" | echo set /p mm= 输入密码:>>"%nfile%.bat"
type "%nfile%.bat" | echo if not "%mm%"=="%password%" goto mmcw>>"%nfile%.bat"
type "%nfile%.bat" | echo goto xuanzefangshi>>"%nfile%.bat"
type "%nfile%.bat" | echo :mmcw>>"%nfile%.bat"
type "%nfile%.bat" | echo cls>>"%nfile%.bat"
type "%nfile%.bat" | echo echo ┏ ┓>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo 密码错误!!! 请重新输入! >>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo 输入密码后您才能看到文本文档的内容。 >>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo ┗ ┛>>"%nfile%.bat"
type "%nfile%.bat" | echo set /p mm1= 重新输入密码:>>"%nfile%.bat"
type "%nfile%.bat" | echo if not "%mm1%"=="%password%" goto mmcw>>"%nfile%.bat"
type "%nfile%.bat" | echo :xuanzefangshi
type "%nfile%.bat" | echo cls
type "%nfile%.bat" | echo echo ┏ ┓>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo 请选择文本的打开方式: >>"%nfile%.bat"
type "%nfile%.bat" | echo echo 在本窗口中打开。>>"%nfile%.bat"
type "%nfile%.bat" | echo echo 生成另一个新文件%nfile%.txt>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo ┗ ┛>>"%nfile%.bat"
type "%nfile%.bat" | echo set /p way= 选择方式:>>"%nfile%.bat"
type "%nfile%.bat" | echo if "%way%"=="1" goto zhijiedakai>>"%nfile%.bat"
type "%nfile%.bat" | echo if "%way%"=="2" goto newtxt>>"%nfile%.bat"
type "%nfile%.bat" | echo :zhijiedakai>>"%nfile%.bat"
type "%nfile%.bat" | echo cls>>"%nfile%.bat"
type %file%>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.
type "%nfile%.bat" | echo echo =======================end================================>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo 如果要复制,请点击右键-标记>>"%nfile%.bat"
type "%nfile%.bat" | echo echo 选中所要复制的内容-右键 >>"%nfile%.bat"
type "%nfile%.bat" | echo echo 即可复制完成。>>"%nfile%.bat"
type "%nfile%.bat" | echo :newtxt>>"%nfile%.bat"
type "%nfile%.bat" | echo cls>>"%nfile%.bat"
type "%nfile%.bat" | echo echo ┏ ┓>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo 文件解密完成!!>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo 请查看新生成的文件%nfile%.txt>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo ┗ ┛>>"%nfile%.bat"
type "%nfile%.bat" | echo echo 任意键关闭。。。>>"%nfile%.bat"
type "%nfile%.bat" | echo pause>nul>>"%nfile%.bat"
上面一段中想要把%file%嵌入%nfile%.bat中
然后运行%nfile%.bat
输入预先设置的密码 选择方式后
%nfile%.bat就能生成一个新的 %file% 或者是在cmd窗口中直接显示%file%的内容
但不知道要怎么做
type "%nfile%.bat" | echo :zhijiedakai>>"%nfile%.bat"
type "%nfile%.bat" | echo cls>>"%nfile%.bat"
type %file%>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.
type "%nfile%.bat" | echo echo =======================end================================>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo 如果要复制,请点击右键-标记>>"%nfile%.bat"
type "%nfile%.bat" | echo echo 选中所要复制的内容-右键 >>"%nfile%.bat"
type "%nfile%.bat" | echo echo 即可复制完成。>>"%nfile%.bat"
这一段中 type %file%>>"%nfile%.bat"好像不怎么管用。
Last edited by doshhwa on 2010-6-20 at 13:08 ]
I roughly wrote it out.
Now there's a problem:
:jm
type "%nfile%.bat" | echo @echo off>>"%nfile%.bat"
type "%nfile%.bat" | echo title Opening Encrypted Document: "file"...>>"%nfile%.bat"
type "%nfile%.bat" | echo color a2>>"%nfile%.bat"
type "%nfile%.bat" | echo cls>>"%nfile%.bat"
type "%nfile%.bat" | echo :begin>>"%nfile%.bat"
type "%nfile%.bat" | echo echo ┏ ┓>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo Please enter the password. >>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo You can see the content of the text document after entering the password. >>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo ┗ ┛>>"%nfile%.bat"
type "%nfile%.bat" | echo set /p mm= Enter password:>>"%nfile%.bat"
type "%nfile%.bat" | echo if not "%mm%"=="%password%" goto mmcw>>"%nfile%.bat"
type "%nfile%.bat" | echo goto xuanzefangshi>>"%nfile%.bat"
type "%nfile%.bat" | echo :mmcw>>"%nfile%.bat"
type "%nfile%.bat" | echo cls>>"%nfile%.bat"
type "%nfile%.bat" | echo echo ┏ ┓>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo Password incorrect!!! Please enter again! >>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo You can see the content of the text document after entering the password. >>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo ┗ ┛>>"%nfile%.bat"
type "%nfile%.bat" | echo set /p mm1= Re-enter password:>>"%nfile%.bat"
type "%nfile%.bat" | echo if not "%mm1%"=="%password%" goto mmcw>>"%nfile%.bat"
type "%nfile%.bat" | echo :xuanzefangshi
type "%nfile%.bat" | echo cls
type "%nfile%.bat" | echo echo ┏ ┓>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo Please select the way to open the text: >>"%nfile%.bat"
type "%nfile%.bat" | echo echo Open in this window.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo Generate another new file %nfile%.txt>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo ┗ ┛>>"%nfile%.bat"
type "%nfile%.bat" | echo set /p way= Select way:>>"%nfile%.bat"
type "%nfile%.bat" | echo if "%way%"=="1" goto zhijiedakai>>"%nfile%.bat"
type "%nfile%.bat" | echo if "%way%"=="2" goto newtxt>>"%nfile%.bat"
type "%nfile%.bat" | echo :zhijiedakai>>"%nfile%.bat"
type "%nfile%.bat" | echo cls>>"%nfile%.bat"
type %file%>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.
type "%nfile%.bat" | echo echo =======================end================================>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo If you want to copy, click right mouse button - Mark>>"%nfile%.bat"
type "%nfile%.bat" | echo echo Select the content to be copied - right mouse button >>"%nfile%.bat"
type "%nfile%.bat" | echo echo You can complete the copy.>>"%nfile%.bat"
type "%nfile%.bat" | echo :newtxt>>"%nfile%.bat"
type "%nfile%.bat" | echo cls>>"%nfile%.bat"
type "%nfile%.bat" | echo echo ┏ ┓>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo File decryption completed!!>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo Please view the newly generated file %nfile%.txt>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo ┗ ┛>>"%nfile%.bat"
type "%nfile%.bat" | echo echo Press any key to close...>>"%nfile%.bat"
type "%nfile%.bat" | echo pause>nul>>"%nfile%.bat"
In the above part, I want to embed %file% into %nfile%.bat
Then run %nfile%.bat
After entering the pre-set password and selecting the way,
%nfile%.bat can generate a new %file% or directly display the content of %file% in the cmd window
But I don't know how to do it
type "%nfile%.bat" | echo :zhijiedakai>>"%nfile%.bat"
type "%nfile%.bat" | echo cls>>"%nfile%.bat"
type %file%>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.
type "%nfile%.bat" | echo echo =======================end================================>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo If you want to copy, click right mouse button - Mark>>"%nfile%.bat"
type "%nfile%.bat" | echo echo Select the content to be copied - right mouse button >>"%nfile%.bat"
type "%nfile%.bat" | echo echo You can complete the copy.>>"%nfile%.bat"
This part of type %file%>>"%nfile%.bat" doesn't seem to work well.
Last edited by doshhwa on 2010-6-20 at 13:08 ]
|
|
2010-6-20 13:03 |
|
|
doshhwa
新手上路

积分 5
发帖 5
注册 2010-6-19
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
现在问题更简单化:
如何把if not "%mm%"=="%password%" goto mmcw 这段
输入%nfile%.bat中。
如果用type "%nfile%.bat" | echo if not "%mm%"=="%password%" goto mmcw>>"%nfile%.bat"的话
输出的东西就是:
if not ""=="asdf" goto mmcw (password已在前面定义为asdf所以会显示asdf)
完全的代码是:
@echo off
set /p file= 文件:
set /p nfile= 新文件:
set /p password= 密码:
:jm
type "%nfile%.bat" | echo @echo off>>"%nfile%.bat"
type "%nfile%.bat" | echo title 正在打开加密文档:"file"...>>"%nfile%.bat"
type "%nfile%.bat" | echo color a2>>"%nfile%.bat"
type "%nfile%.bat" | echo cls>>"%nfile%.bat"
type "%nfile%.bat" | echo :begin>>"%nfile%.bat"
type "%nfile%.bat" | echo echo ┏ ┓>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo 请输入密码。 >>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo 输入密码后您才能看到文本文档的内容。 >>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo ┗ ┛>>"%nfile%.bat"
type "%nfile%.bat" | echo set /p mm= 输入密码:>>"%nfile%.bat"
type "%nfile%.bat" | echo if not "%mm%"=="%password%" goto mmcw>>"%nfile%.bat"
type "%nfile%.bat" | echo goto xuanzefangshi>>"%nfile%.bat"
type "%nfile%.bat" | echo :mmcw>>"%nfile%.bat"
type "%nfile%.bat" | echo cls>>"%nfile%.bat"
type "%nfile%.bat" | echo echo ┏ ┓>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo 密码错误!!! 请重新输入! >>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo 输入密码后您才能看到文本文档的内容。 >>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo ┗ ┛>>"%nfile%.bat"
type "%nfile%.bat" | echo set /p mm= 重新输入密码:>>"%nfile%.bat"
type "%nfile%.bat" | echo if not "%mm%"=="%password%" goto mmcw>>"%nfile%.bat"
type "%nfile%.bat" | echo :xuanzefangshi
type "%nfile%.bat" | echo cls
type "%nfile%.bat" | echo echo ┏ ┓>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo 请选择文本的打开方式: >>"%nfile%.bat"
type "%nfile%.bat" | echo echo [1]在本窗口中打开。>>"%nfile%.bat"
type "%nfile%.bat" | echo echo [2]生成另一个新文件%nfile%.txt>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo ┗ ┛>>"%nfile%.bat"
type "%nfile%.bat" | echo set /p way= 选择方式:>>"%nfile%.bat"
type "%nfile%.bat" | echo if "%way%"=="1" goto zhijiedakai>>"%nfile%.bat"
type "%nfile%.bat" | echo if "%way%"=="2" goto newtxt>>"%nfile%.bat"
type "%nfile%.bat" | echo :zhijiedakai>>"%nfile%.bat"
type "%nfile%.bat" | echo cls>>"%nfile%.bat"
type "%nfile%.bat" | type %file%>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo =======================end================================>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo 如果要复制,请点击右键-标记>>"%nfile%.bat"
type "%nfile%.bat" | echo echo 选中所要复制的内容-右键 >>"%nfile%.bat"
type "%nfile%.bat" | echo echo 即可复制完成。>>"%nfile%.bat"
type "%nfile%.bat" | echo :newtxt>>"%nfile%.bat"
type "%nfile%.bat" | echo cls>>"%nfile%.bat"
type "%nfile%.bat" | echo echo ┏ ┓>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo 文件解密完成!!>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo 请查看新生成的文件%nfile%.txt>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo ┗ ┛>>"%nfile%.bat"
type "%nfile%.bat" | echo echo 任意键关闭。。。>>"%nfile%.bat"
type "%nfile%.bat" | echo pause>nul>>"%nfile%.bat"
其中
type "%nfile%.bat" | echo if "%way%"=="1" goto zhijiedakai>>"%nfile%.bat"
type "%nfile%.bat" | echo if "%way%"=="2" goto newtxt>>"%nfile%.bat"
也有同样的问题 新生成的文件中没有 %way%...
Now the problem is simplified:
How to put the line if not "%mm%"=="%password%" goto mmcw into %nfile%.bat.
If you use type "%nfile%.bat" | echo if not "%mm%"=="%password%" goto mmcw>>"%nfile%.bat", the output will be:
if not ""=="asdf" goto mmcw (because password was defined as asdf earlier, so asdf will be displayed)
The complete code is:
@echo off
set /p file= File:
set /p nfile= New file:
set /p password= Password:
:jm
type "%nfile%.bat" | echo @echo off>>"%nfile%.bat"
type "%nfile%.bat" | echo title Opening encrypted document: "file"...>>"%nfile%.bat"
type "%nfile%.bat" | echo color a2>>"%nfile%.bat"
type "%nfile%.bat" | echo cls>>"%nfile%.bat"
type "%nfile%.bat" | echo :begin>>"%nfile%.bat"
type "%nfile%.bat" | echo echo ┏ ┓>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo Please enter the password. >>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo You can see the content of the text document after entering the password. >>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo ┗ ┛>>"%nfile%.bat"
type "%nfile%.bat" | echo set /p mm= Enter password:>>"%nfile%.bat"
type "%nfile%.bat" | echo if not "%mm%"=="%password%" goto mmcw>>"%nfile%.bat"
type "%nfile%.bat" | echo goto xuanzefangshi>>"%nfile%.bat"
type "%nfile%.bat" | echo :mmcw>>"%nfile%.bat"
type "%nfile%.bat" | echo cls>>"%nfile%.bat"
type "%nfile%.bat" | echo echo ┏ ┓>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo Password error!!! Please re-enter! >>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo You can see the content of the text document after entering the password. >>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo ┗ ┛>>"%nfile%.bat"
type "%nfile%.bat" | echo set /p mm= Re-enter password:>>"%nfile%.bat"
type "%nfile%.bat" | echo if not "%mm%"=="%password%" goto mmcw>>"%nfile%.bat"
type "%nfile%.bat" | echo :xuanzefangshi
type "%nfile%.bat" | echo cls
type "%nfile%.bat" | echo echo ┏ ┓>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo Please choose the way to open the text: >>"%nfile%.bat"
type "%nfile%.bat" | echo Open in this window.>>"%nfile%.bat"
type "%nfile%.bat" | echo Generate another new file %nfile%.txt>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo ┗ ┛>>"%nfile%.bat"
type "%nfile%.bat" | echo set /p way= Choose the way:>>"%nfile%.bat"
type "%nfile%.bat" | echo if "%way%"=="1" goto zhijiedakai>>"%nfile%.bat"
type "%nfile%.bat" | echo if "%way%"=="2" goto newtxt>>"%nfile%.bat"
type "%nfile%.bat" | echo :zhijiedakai>>"%nfile%.bat"
type "%nfile%.bat" | echo cls>>"%nfile%.bat"
type "%nfile%.bat" | type %file%>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo =======================end================================>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo If you want to copy, click right mouse button - Mark>>"%nfile%.bat"
type "%nfile%.bat" | echo echo Select the content to be copied - right mouse button >>"%nfile%.bat"
type "%nfile%.bat" | echo echo You can complete the copy.>>"%nfile%.bat"
type "%nfile%.bat" | echo :newtxt>>"%nfile%.bat"
type "%nfile%.bat" | echo cls>>"%nfile%.bat"
type "%nfile%.bat" | echo echo ┏ ┓>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo File decryption completed!!>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo Please check the newly generated file %nfile%.txt>>"%nfile%.bat"
type "%nfile%.bat" | echo echo.>>"%nfile%.bat"
type "%nfile%.bat" | echo echo ┗ ┛>>"%nfile%.bat"
type "%nfile%.bat" | echo echo Any key to close...>>"%nfile%.bat"
type "%nfile%.bat" | echo pause>nul>>"%nfile%.bat"
Among them
type "%nfile%.bat" | echo if "%way%"=="1" goto zhijiedakai>>"%nfile%.bat"
type "%nfile%.bat" | echo if "%way%"=="2" goto newtxt>>"%nfile%.bat"
also has the same problem, there is no %way%... in the newly generated file
|
|
2010-6-20 13:34 |
|
|
Hanyeguxing
银牌会员
     正在学习中的菜鸟...
积分 1039
发帖 897
注册 2009-3-1 来自 在地狱中仰望天堂
状态 离线
|
|
2010-6-20 14:32 |
|
|
doshhwa
新手上路

积分 5
发帖 5
注册 2010-6-19
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
不是 加密解密的段还没加进去 。
不知道怎么把
if not "%mm%"=="%password%" goto mmcw
这段输入%nfile%.bat中。
如果用type "%nfile%.bat" | echo if not "%mm%"=="%password%" goto mmcw>>"%nfile%.bat"的话
输出的东西就是:
if not ""=="asdf" goto mmcw (password已在前面定义为asdf所以会显示asdf)
No, the encryption and decryption segments haven't been added yet.
I don't know how to input the line `if not "%mm%"=="%password%" goto mmcw` into `%nfile%.bat`.
If I use `type "%nfile%.bat" | echo if not "%mm%"=="%password%" goto mmcw>>"%nfile%.bat"`, the output will be:
if not ""=="asdf" goto mmcw (since password was defined as asdf earlier, so it will display asdf)
|
|
2010-6-20 14:54 |
|
|
acaigg
初级用户
 
积分 115
发帖 92
注册 2010-12-24
状态 离线
|
|
2010-12-28 10:32 |
|
|