2013-05-15 4 views
1

C:\Program Files\AdobeC:\Program Files (x86)\Adobe을 모두 확인하려면 다음 배치 파일을 어떻게 수정할 수 있습니까?일괄 처리 파일 도움말 : C : Program Files Adobe 또는 C : Program Files (x86) Adobe

이 코드 만 보인다는 C:\Program Files\Adobe

@echo off 
if exist "C:\Program Files\Adobe" goto end 
echo %computername% > \\server001\share\%computername%.txt 
:end 

내가 시도 다음 그러나이 작동하지 않습니다

@echo off 
If exist "C:\Program Files\Adobe" If exist "C:\Program Files (x86)\Adobe" goto end 
echo %computername% > \\server001\share\%computername%.txt 
:end 
당신의 도움이 많이 이해할 수있을 것이다

, 감사합니다!

답변

2

왜 이렇게하지 않습니까?

@echo off 
If exist "C:\Program Files\Adobe"  goto end 
If exist "C:\Program Files (x86)\Adobe" goto end 
echo %computername% > \\server001\share\%computername%.txt 
:end 
+0

대단히 감사합니다. – bickyz

+0

"C : \ Program Files \ Adobe"또는 "C : \ Program Files (x86) \ Adobe"는 파일이라고 상상해보십시오. 그러면 TRUE가됩니다. – Endoro

1
@echo off 
if exist "C:\Program Files\Adobe" goto end 
if exist "C:\Program Files (x86)\Adobe" goto end 
echo %computername% > \\server001\share\%computername%.txt 
:end 

가장 간단한 방법입니다. 두 디렉터리 중 하나 또는 모두 존재하는 경우 goto end 것입니다.

당신은 항상 모두를 확인하려면

:

@echo off 
if exist "C:\Program Files\Adobe" (
    if exist "C:\Program Files (x86)\Adobe" (
    goto end 
) 
) 
echo %computername% > \\server001\share\%computername%.txt 
:end 

이 단지 goto end 두 디렉토리가 존재한다면.

0

두 명령 모두에서 작동하는 명령이 하나도 없습니다. 당신은 두 곳에서 확인할 수 있습니다

SET ProgFiles86Root=%ProgramFiles(x86)% 
IF NOT "%ProgFiles86Root%"=="" GOTO win64 
SET ProgFiles86Root=%ProgramFiles% 
:win64 

"%ProgFiles86Root%\name of program" "arguments, etc." 
1

이 시도 : 당신은 폴더를 테스트하는 경우

@echo off&setlocal 
If exist "C:\Program Files\Adobe\" (goto:end) else If exist "C:\Program Files (x86)\Adobe\" goto:end 

, 당신은 더 나은 끝에 백 슬래시를 넣어해야합니다. 그렇지 않으면이 이름을 가진 파일이있는 경우에도 마찬가지입니다.

관련 문제