win7系统temp (win7系统temp文件夹)

这是大学过去在纸飞机社区做的事情。其实很简单,但是我把过程整理得很复杂得很复杂。因为我学习了批处理的知识,我记录了整个生产。在下面的网盘中共享文件。如果你想直接使用它们InstallTakeOwnership.reg注册表可以写在文件中。

下面记录的是把reg注册表文件,改成用bat再次使用批处理文件Bat_To_Exe_Converter.exe程序把bat将批处理文件打包成可执行程序的过程。

原代码如下

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\\*\\shell\\runas]

@="Take Ownership"

"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\\*\\shell\\runas\\command]

@="cmd.exe /c takeown /f \\"%1\\" && icacls \\"%1\\" /grant administrators:F"

"IsolatedCommand"="cmd.exe /c takeown /f \\"%1\\" && icacls \\"%1\\" /grant administrators:F"

[HKEY_CLASSES_ROOT\\Directory\\shell\\runas]

@="Take Ownership"

"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\\Directory\\shell\\runas\\command]

@="cmd.exe /c takeown /f \\"%1\\" /r /d y && icacls \\"%1\\" /grant administrators:F /t"

"IsolatedCommand"="cmd.exe /c takeown /f \\"%1\\" /r /d y && icacls \\"%1\\" /grant administrators:F /t"


第一步是把它变成BAT批处理文件

更改代码如下

> "%Temp%.\\DefOpen.reg" ECHO Windows Registry Editor Version 5.00

>>"%Temp%.\\DefOpen.reg" ECHO.

>>"%Temp%.\\DefOpen.reg" ECHO[HKEY_CLASSES_ROOT\\*\\shell\\runas]

>>"%Temp%.\\DefOpen.reg" ECHO @="Take Ownership"

>>"%Temp%.\\DefOpen.reg" ECHO "NoWorkingDirectory"=""

>>"%Temp%.\\DefOpen.reg" ECHO.

>>"%Temp%.\\DefOpen.reg" ECHO[HKEY_CLASSES_ROOT\\*\\shell\\runas\\command]

>>"%Temp%.\\DefOpen.reg" ECHO @="cmd.exe /c takeown /f \\"%1\\" && icacls \\"%1\\" /grant administrators:F"

>>"%Temp%.\\DefOpen.reg" ECHO "IsolatedCommand"="cmd.exe /c takeown /f \\"%1\\" && icacls \\"%1\\" /grant administrators:F"

>>"%Temp%.\\DefOpen.reg" ECHO.

>>"%Temp%.\\DefOpen.reg" ECHO[HKEY_CLASSES_ROOT\\Directory\\shell\\runas]

>>"%Temp%.\\DefOpen.reg" ECHO @="Take Ownership"

>>"%Temp%.\\DefOpen.reg" ECHO "NoWorkingDirectory"=""

>>"%Temp%.\\DefOpen.reg" ECHO.

>>"%Temp%.\\DefOpen.reg" ECHO[HKEY_CLASSES_ROOT\\Directory\\shell\\runas\\command]

>>"%Temp%.\\DefOpen.reg" ECHO @="cmd.exe /c takeown /f \\"%1\\" /r /d y && icacls \\"%1\\" /grant administrators:F /t"

>>"%Temp%.\\DefOpen.reg" ECHO "IsolatedCommand"="cmd.exe /c takeown /f \\"%1\\" /r /d y && icacls \\"%1\\" /grant administrators:F /t"

START /WAIT REGEDIT /S "%Temp%.\\DefOpen.reg"

DEL "%Temp%.\\DefOpen.reg"


再接下来,这批处理就是做一个漂亮的装饰

@echo off

cd\\

cls

color 4a

mode con cols=80 lines=40

echo ■───────────────────────────────────── ■

echo.■ ☆ ★ 纸飞机系统批处理工具 ★ ☆ ■

echo ■ ■

echo ※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※

echo ■ win7系统去权限工具,安装后,右键对话框将多一个take ownership的选 ■

echo ■ 点击右键,选择任何您想删除系统管理员权限的文件take ownership即可去 ■

echo ■ 除了文件的系统管理员权限外,不再需要担心没有管理员权限而删除文件,无法重命 ■

echo ■ 名文件等情况.按任何按钮开始安装 ■

pause

> "%Temp%.\\DefOpen.reg" ECHO Windows Registry Editor Version 5.00

>>"%Temp%.\\DefOpen.reg" ECHO.

>>"%Temp%.\\DefOpen.reg" ECHO[HKEY_CLASSES_ROOT\\*\\shell\\runas]

>>"%Temp%.\\DefOpen.reg" ECHO @="Take Ownership"

>>"%Temp%.\\DefOpen.reg" ECHO "NoWorkingDirectory"=""

>>"%Temp%.\\DefOpen.reg" ECHO.

>>"%Temp%.\\DefOpen.reg" ECHO[HKEY_CLASSES_ROOT\\*\\shell\\runas\\command]

>>"%Temp%.\\DefOpen.reg" ECHO @="cmd.exe /c takeown /f \\"%1\\" && icacls \\"%1\\" /grant administrators:F"

>>"%Temp%.\\DefOpen.reg" ECHO "IsolatedCommand"="cmd.exe /c takeown /f \\"%1\\" && icacls \\"%1\\" /grant administrators:F"

>>"%Temp%.\\DefOpen.reg" ECHO.

>>"%Temp%.\\DefOpen.reg" ECHO[HKEY_CLASSES_ROOT\\Directory\\shell\\runas]

>>"%Temp%.\\DefOpen.reg" ECHO @="Take Ownership"

>>"%Temp%.\\DefOpen.reg" ECHO "NoWorkingDirectory"=""

>>"%Temp%.\\DefOpen.reg" ECHO.

>>"%Temp%.\\DefOpen.reg" ECHO[HKEY_CLASSES_ROOT\\Directory\\shell\\runas\\command]

>>"%Temp%.\\DefOpen.reg" ECHO @="cmd.exe /c takeown /f \\"%1\\" /r /d y && icacls \\"%1\\" /grant administrators:F /t"

>>"%Temp%.\\DefOpen.reg" ECHO "IsolatedCommand"="cmd.exe /c takeown /f \\"%1\\" /r /d y && icacls \\"%1\\" /grant administrators:F /t"

START /WAIT REGEDIT /S " %T