Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
If statement 如果程序文件(x86)不';你不能成批存在吗?_If Statement_Batch File_Path_X86_Winrar - Fatal编程技术网

If statement 如果程序文件(x86)不';你不能成批存在吗?

If statement 如果程序文件(x86)不';你不能成批存在吗?,if-statement,batch-file,path,x86,winrar,If Statement,Batch File,Path,X86,Winrar,这是脚本。目标是将文件夹中的Rar文件提取到特定文件夹中。问题是,如果系统上没有程序文件(x86),我需要WinRar的路径才能更改为程序文件。我该怎么做?谢谢大家! @echo off @set local set dirA=C:\Users\%username%\Desktop \SpearsCraftBox\Batches set dirE=C:\Users\%username%\AppData \Roaming\.minecraft set dirC=C:\Users\%use

这是脚本。目标是将文件夹中的Rar文件提取到特定文件夹中。问题是,如果系统上没有程序文件(x86),我需要WinRar的路径才能更改为程序文件。我该怎么做?谢谢大家!

@echo off
@set local

set dirA=C:\Users\%username%\Desktop

\SpearsCraftBox\Batches

set dirE=C:\Users\%username%\AppData

\Roaming\.minecraft

set dirC=C:\Users\%username%\Desktop

\SpearsCraftBox\Batches

cd %dirA%
set path=“C:\Program Files(x86)\WinRAR\”;%路径%

echo.
echo All files in %dirA% to be uncompressed
echo.


echo.

FOR %%i IN (*.rar) do (
unrar x "%%~ni.rar" "%dirE%"
move "%%~ni.rar" "%dirC%"
echo completed uncompressing "%%i" and moved 

archives or archive to "%dirC%"
)

goto eof


:eof

echo.
echo "Task Completed"
echo.

有为程序文件目录定义的环境变量:
%ProgramFiles%
%ProgramFiles(x86)%%


每次运行路径时都需要设置路径,这有什么原因吗?应该是一次性的,除非您将文件分发给其他人。在这种情况下,您如何知道他们是否安装了winrar以及他们是否安装了32位版本?嗯。。。stackoverflow不会让我恭维你,你正试图做一些关于Minecraft的事情
IF EXIST "%ProgramFiles(x86)%\WinRAR" (
  SET pth="%ProgramFiles(x86)%\WinRAR"
)
IF EXIST "%ProgramFiles%\WinRAR" (
  SET pth="%ProgramFiles%\WinRAR"
)


IF NOT EXIST %pth% (
    ECHO WinRar not found.
    GOTO :EOF
)
...
"%pth%unrar" x "%%~ni.rar" "%dirE%"
...