|
pinghu
中级用户
  
积分 307
发帖 130
注册 2008-2-1
状态 离线
|
『第 31 楼』:
使用 LLM 解释/回答一下
Originally posted by slore at 2008-2-6 12:54 PM:
上面的*我用的是 AllFileSystemObject
17楼说的正确,如果用*表示应用到文件,要想应用到文件夹要用或者folder,却不能同时用directory和folder。用AllFileSystemObject可以应用到文件和文件夹
注册表真是挑剔啊,既要保证功能全面又要保证键值的功能没有冗余和重叠!
call :sub1 “%%~dpnxi”这行中的“%%~dpnxi”是格式上是什么参数,起什么作用??
Originally posted by slore at 2008-2-6 12:54 PM:
I am using AllFileSystemObject above
What the 17th floor said is correct. If you use * to apply to files, to apply to folders you need to use or folder, but you cannot use directory and folder at the same time. Using AllFileSystemObject can apply to both files and folders.
The registry is really picky, it has to ensure both comprehensive functions and no redundancy and overlap in the key values!
What is the parameter format and function of "%%~dpnxi" in the line "call :sub1 "%%~dpnxi""?
|
|
2008-2-7 23:46 |
|
|
pinghu
中级用户
  
积分 307
发帖 130
注册 2008-2-1
状态 离线
|
『第 32 楼』:
使用 LLM 解释/回答一下
楼上说的日志功能我也完全不会弄,我太菜了,
我写出来的东西还有许多语法上的错误,对批处理的语法也不熟悉
比如在for 语句的作用范围内跳转标签能否被识别?
What the person upstairs said about the log function, I also completely don't know how to do it. I'm too inexperienced.
There are still many grammatical errors in what I write, and I'm not familiar with the syntax of batch processing.
For example, can the jump label within the scope of the for statement be recognized?
|
|
2008-2-7 23:51 |
|
|
pinghu
中级用户
  
积分 307
发帖 130
注册 2008-2-1
状态 离线
|
『第 33 楼』:
使用 LLM 解释/回答一下
为什么直接选中文件夹能实现上移,选中文件夹就不能实现呢,同样是盗用sub1啊,头疼
Why can directly selecting a folder achieve moving up, but selecting a folder cannot? It's also plagiarizing sub1, headache
|
|
2008-2-8 00:00 |
|
|
pinghu
中级用户
  
积分 307
发帖 130
注册 2008-2-1
状态 离线
|
『第 34 楼』:
使用 LLM 解释/回答一下
我用了楼上说的’dir /b ' 结果成功了,能脱壳文件和文件夹,大功告成,学到不少东西,再把完整的批处理贴一次,以供大家使用
安装程序
@echo off
call :%* 2>nul || goto setup
goto :eof
:Sub1
rem 移动到父目录
if not defined str set "str=%~nx1"
if not exist "..\%~nx1" (move "%str%" "..\%~nx1" && set "str=" && goto :eof)
call :Sub1 "%~n1_New%~x1"
goto :eof
:Sub2
rem 脱壳
cd "%~1"
for /f "delims=" %%i in ('dir /b') do call :Sub1 "%%~dpnxi"
goto :eof
:setup
reg add "hkcr\AllFilesystemObjects\shell\移至父目录\command" /f /t reg_sz /v "" /d "\"%~0\" Sub1 \"%%1\""
reg add "hkcr\directory\shell\脱壳\command" /f /t reg_sz /v "" /d "\"%~0\" Sub2 \"%%1\""
goto :eof
卸载程序
reg delete "hkcr\directory\shell\脱壳" /f
reg delete "hkcr\AllFilesystemObjects\shell\移至父目录" /f
I used the 'dir /b' mentioned by the person above, and it worked successfully. I can extract shelled files and folders, and it's a success. I've learned a lot. Now I'll post the complete batch again for everyone to use.
Installation program
@echo off
call :%* 2>nul || goto setup
goto :eof
:Sub1
rem Move to parent directory
if not defined str set "str=%~nx1"
if not exist "..\%~nx1" (move "%str%" "..\%~nx1" && set "str=" && goto :eof)
call :Sub1 "%~n1_New%~x1"
goto :eof
:Sub2
rem Unshell
cd "%~1"
for /f "delims=" %%i in ('dir /b') do call :Sub1 "%%~dpnxi"
goto :eof
:setup
reg add "hkcr\AllFilesystemObjects\shell\Move to Parent Directory\command" /f /t reg_sz /v "" /d "\"%~0\" Sub1 \"%%1\""
reg add "hkcr\directory\shell\Unshell\command" /f /t reg_sz /v "" /d "\"%~0\" Sub2 \"%%1\""
goto :eof
Uninstallation program
reg delete "hkcr\directory\shell\Unshell" /f
reg delete "hkcr\AllFilesystemObjects\shell\Move to Parent Directory" /f
|
|
2008-2-8 11:36 |
|
|
3742668
荣誉版主
      
积分 2013
发帖 718
注册 2006-2-18
状态 离线
|
『第 35 楼』:
使用 LLM 解释/回答一下
Very Good!
不过,只是dir /b是无法拷贝隐藏文件的,另外卸载部分何不放在setup里面呢?在里面判断是否有相关的注册表项目,然后决定是安装还是卸载。
最重要的一点是在这个帖子里你收获到了多少?能否完全不看参考,仅凭思路来写有自己风格的代码?
例如你在前面12F提到过的问题究竟产生的原因是什么?注册表中的值的内容和批处理之间有什么联系?为什么有的地方要加引号,有的不用?
你可以自己尝试解决这些问题,如果有什么不明白的可以跟贴寻求提示。
Very Good!
However, just using dir /b cannot copy hidden files. Also, why not put the uninstall part in the setup? In it, judge whether there are relevant registry items and then decide whether to install or uninstall.
The most important thing is how much you have gained in this post? Can you write code with your own style based solely on the idea without looking at the reference?
For example, what is the actual reason for the problem mentioned in your previous 12F? What is the connection between the content of the value in the registry and the batch processing? Why are there quotes in some places and not in others?
You can try to solve these problems by yourself. If you don't understand something, you can post a reply to seek hints.
|
|
2008-2-8 12:16 |
|
|
pinghu
中级用户
  
积分 307
发帖 130
注册 2008-2-1
状态 离线
|
『第 36 楼』:
使用 LLM 解释/回答一下
@echo off
call :%* 2>nul || goto choice
goto :eof
:Sub1
rem 移动到父目录
if not defined str set "str=%~nx1"
if not exist "..\%~nx1" (move "%str%" "..\%~nx1" && set "str=" && goto :eof)
call :Sub1 "%~n1_New%~x1"
goto :eof
:Sub2
rem 脱壳
pushd "%~1"
for /f "delims=" %%i in ('dir /a /b') do call :Sub1 "%%~dpnxi"
popd
rd "%~1"
goto :eof
:choice
set /p dd=安装A,卸载X,退出T:
if "%dd%"=="a" goto setup
if "%dd%"=="A" goto setup
if "%dd%"=="x" goto unistall
if "%dd%"=="X" goto unistall
if "%dd%"=="t" goto :eof
if "%dd%"=="T" (goto :eof) else echo 重新输入 &goto choice
goto :eof
:setup
reg add "hkcr\AllFilesystemObjects\shell\移至父目录\command" /f /t reg_sz /v "" /d "\"%~0\" Sub1 \"%%1\""
reg add "hkcr\directory\shell\脱壳\command" /f /t reg_sz /v "" /d "\"%~0\" Sub2 \"%%1\""
goto :eof
:unistall
reg delete "hkcr\directory\shell\脱壳" /f
reg delete "hkcr\AllFilesystemObjects\shell\移至父目录" /f
goto :eof
这回把卸载也加进去了,还在dir 中加入了/a参数
我到现在也不知道本文中call 的用法,还有%1是如何在注册表和批处理中传递的
@echo off
call :%* 2>nul || goto choice
goto :eof
:Sub1
rem Move to parent directory
if not defined str set "str=%~nx1"
if not exist "..\%~nx1" (move "%str%" "..\%~nx1" && set "str=" && goto :eof)
call :Sub1 "%~n1_New%~x1"
goto :eof
:Sub2
rem Unpack
pushd "%~1"
for /f "delims=" %%i in ('dir /a /b') do call :Sub1 "%%~dpnxi"
popd
rd "%~1"
goto :eof
:choice
set /p dd=Install A, Uninstall X, Exit T:
if "%dd%"=="a" goto setup
if "%dd%"=="A" goto setup
if "%dd%"=="x" goto unistall
if "%dd%"=="X" goto unistall
if "%dd%"=="t" goto :eof
if "%dd%"=="T" (goto :eof) else echo Re-enter &goto choice
goto :eof
:setup
reg add "hkcr\AllFilesystemObjects\shell\Move to Parent Directory\command" /f /t reg_sz /v "" /d "\"%~0\" Sub1 \"%%1\""
reg add "hkcr\directory\shell\Unpack\command" /f /t reg_sz /v "" /d "\"%~0\" Sub2 \"%%1\""
goto :eof
:unistall
reg delete "hkcr\directory\shell\Unpack" /f
reg delete "hkcr\AllFilesystemObjects\shell\Move to Parent Directory" /f
goto :eof
Now the uninstall is also added, and the /a parameter is added to dir.
I still don't know the usage of call in this text, and how %1 is passed in the registry and batch processing.
|
|
2008-2-8 13:34 |
|
|
pinghu
中级用户
  
积分 307
发帖 130
注册 2008-2-1
状态 离线
|
『第 37 楼』:
使用 LLM 解释/回答一下
加了dir /a /b 还是不能移动隐藏文件
Adding dir /a /b still can't move hidden files
|
|
2008-2-8 13:41 |
|
|
pinghu
中级用户
  
积分 307
发帖 130
注册 2008-2-1
状态 离线
|
『第 38 楼』:
使用 LLM 解释/回答一下
if "%dd%"=="a" goto setup
if "%dd%"=="A" goto setup两句能否写成一句呢
Can the two sentences "if "%dd%"=="a" goto setup" and "if "%dd%"=="A" goto setup" be written as one sentence?
|
|
2008-2-8 13:50 |
|
|
slore
铂金会员
      
积分 5212
发帖 2478
注册 2007-2-8
状态 离线
|
|
2008-2-8 15:59 |
|
|
pinghu
中级用户
  
积分 307
发帖 130
注册 2008-2-1
状态 离线
|
『第 40 楼』:
使用 LLM 解释/回答一下
想通了一个问题
在运行批处理文件时可以加参数
在call 标签调用子程序时同样可以加参数
I've figured out a problem. When running a batch file, you can add parameters. When calling a subroutine with the call label, you can also add parameters.
|
|
2008-2-8 17:17 |
|
|
pinghu
中级用户
  
积分 307
发帖 130
注册 2008-2-1
状态 离线
|
『第 41 楼』:
使用 LLM 解释/回答一下
新手学习的一个重要问题
看来 /? 以后 对应用命令的格式不熟悉
比如
if "%dd%"=="a" goto setup
if "%dd%"=="A" goto setup两句能否写成一句呢
这个问题
我使用if "%dd%"=="a" ^| "%dd%"=="A" goto setup
语法不对啊
An important issue for beginners to learn
It seems that after /?, you are not familiar with the format of the application command
For example
if "%dd%"=="a" goto setup
Can the two sentences if "%dd%"=="A" goto setup be written as one sentence?
This problem
I used if "%dd%"=="a" ^| "%dd%"=="A" goto setup
The syntax is incorrect ah
|
|
2008-2-8 17:23 |
|
|
pinghu
中级用户
  
积分 307
发帖 130
注册 2008-2-1
状态 离线
|
『第 42 楼』:
使用 LLM 解释/回答一下
到底有没有不带赋值功能的逻辑运算符?楼上的问题可以用/i 参数解决
能不能用一个语句判断dd的值等于a b c其中之一就满足条件的
Is there really no logical operator without the assignment function? The previous question can be solved with the /i parameter. Can we use one statement to judge that the value of dd is equal to one of a, b, c to meet the condition?
|
|
2008-2-8 18:00 |
|
|
3742668
荣誉版主
      
积分 2013
发帖 718
注册 2006-2-18
状态 离线
|
『第 43 楼』:
使用 LLM 解释/回答一下
:choice
set /p dd=安装A,卸载X,退出T:
call :%dd% || (echo error! && goto choice)
goto :eof
:a
:A
reg .....
goto :eof
:x
:X
reg .....
goto :eof
为什么还要交互呢?
在setup里面先测试注册表里面是否有安装信息,若有则自动卸载,若无则自动安装,结构上应该更加清晰明了一些。
:choice
set /p dd=Install A, Uninstall X, Exit T:
call :%dd% || (echo error! && goto choice)
goto :eof
:a
:A
reg .....
goto :eof
:x
:X
reg .....
goto :eof
Why is there still interaction?
In the setup, first test if there is installation information in the registry. If there is, uninstall automatically; if not, install automatically. The structure should be clearer and more straightforward.
|
|
2008-2-8 18:22 |
|
|
pinghu
中级用户
  
积分 307
发帖 130
注册 2008-2-1
状态 离线
|
『第 44 楼』:
使用 LLM 解释/回答一下
感谢3742668
的大力支持,如果你不帮我写的话,我是写不出来的,总之大功告成!比我预期的效果还要好!!再次感谢3742668!!
Thanks to the great support of 3742668, if you hadn't helped me write it, I couldn't have done it. In short, it's a complete success! It's even better than I expected!! Thanks again to 3742668!!
|
|
2008-2-9 12:42 |
|