How can I use a batch file to directly call the system's WinRAR program, no matter which drive the compression program is installed on?!!!
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!
| Rater | Score | Time |
|---|---|---|
| kongzi | +1 | 2008-11-16 15:22 |
@echo off
if exist "C:\Program Files\WinRAR\WinRAR.exe" (
set WinRAR_Path=C:\Program Files\WinRAR\WinRAR.exe
) else (
reg export "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\WinRAR.exe" tmp.reg >nul
for /f "skip=3 delims== tokens=2" %%a in ('type tmp.reg') do (
set WinRAR_Path=%%~a
call set WinRAR_Path=%%WinRAR_Path:\\=\%%
del tmp.reg
goto next
)
)
:next
start "" "%WinRAR_Path%" d "archive filename" "filename to delete"| Rater | Score | Time |
|---|---|---|
| kongzi | +1 | 2008-11-16 16:00 |
Originally posted by tireless at 2008-11-16 04:01 PM:
What is the error message?
Originally posted by kongzi at 2008-11-16 04:05 PM:
---------------------------
C:\Program
---------------------------
Windows cannot find the file 'C:\Program'. Please make sure the filename is correct, and then click Start ...
@echo off
if exist "C:\Program Files\WinRAR\WinRAR.exe" (
set WinRAR_Path=C:\Program Files\WinRAR\WinRAR.exe
) else (
reg export "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\WinRAR.exe" tmp.reg >nul
for /f "skip=3 delims== tokens=2" %%a in ('type tmp.reg') do (
set WinRAR_Path=%%~a
call set WinRAR_Path=%%WinRAR_Path:\\=\%%
del tmp.reg
goto next
)
)
:next
for %%A in (c d e f g h i j k l m n o p q r s t u v w x y z) do (
if exist %%A: (
for %%a in (%%A:\*.rar) do (
start "" "%WinRAR_Path%" d -INUL "%%a" "1.exe"
)
)
)