Windows 7系统,"C:\Program Files (x86)\WinRAR\WinRAR.exe"
运行下面代码批处理时,提示:“‘rar’不是内部或外部命令,也不是可运行的程序或批处理文件
求大神老师给修改一下。- @echo off
- REM ======================================================================
- REM
- REM Batch File -- Created with SAPIEN Technologies PrimalScript 4.0
- REM
- REM NAME: 批量加密打包单个文件
- REM
- REM AUTHOR: hitme ,
- REM DATE : 2006-12-16
- REM
- REM COMMENT: 密码由数字和小写英文字母随机组成,长度固定为10位
- REM
- REM ======================================================================
-
- :repare
- del pass.txt 2>nul
- md package 2>nul
-
- setlocal ENABLEDELAYEDEXPANSION
- :input
- echo.
- set /p input=加密打包文件还是文件夹^(F=文件,D=文件夹,A=全部^)
- echo.
- if /i "!input!"=="f" (set key=/aa) else (
- if /i "!input!"=="d" (set key=/ad) else (
- if /i "!input!"=="a" (set key=) else goto :input))
-
- :code
- for /f "delims=" %%i in ('dir !key!/b^|findstr /v "%~nx0 package"') do (
- set m=
- for /l %%l in (1 1 10) do (
- set/a var=!random!%%36
- set "str=0123456789abcdefghijklmnopqrstuvwxyz"
- call set str=%%str:~!var!,1%%
- set m=!m!!str!
- )
- echo %%i:!m!>>pass.txt
- )
-
- :package
- set path=!path!;c:\program files\winrar
- if exist pass.txt (
- for /f "tokens=1* delims=:" %%i in (pass.txt) do rar a -p%%j "package\%%~ni.rar" "%%i"
- move pass.txt package
- start "" package
- ) else echo...未能打包 & pause
- endlocal
复制代码
|