0

私は、以下を機能させようとしているコードのセクションで作業しています。

echo Date %dayCnt% day(s) before %DBName%_%CurDate% is %DBName%_%mm%_%dd%_%yyyy:~2,2%
rem ============================
If exist %Destination%%DBName%_%CurDate% (
  echo 1
  If exist %Destination%%DBName%_%mm%_%dd%_%yyyy:~2,2% (
  echo 2
    Echo %Destination%%DBName%_%mm%_%dd%_%yyyy:~2,2% exists!
    echo 3
  ) ELSE (
    echo 4
    Echo No %Destination%%DBName%_%mm%_%dd%_%yyyy:~2,2% here today. Maybe we make one?  
    echo 4
  ) ELSE (
    echo 5
    Echo No %Destination%%DBName%_%CurDate% here
    echo 6
))

私が得る出力は次のとおりです。

Date 3 day(s) before 31499DB_07_22_13 is 31499DB_07_19_13
ELSE was unexpected at this time.

( を次の行にドロップするELSEと、見たいものにより近いものが得られます。コードは次のようになります。

echo Date %dayCnt% day(s) before %DBName%_%CurDate% is %DBName%_%mm%_%dd%_%yyyy:~2,2%
rem ============================
rem dir %Destination%%DBName%_%CurDate%
If exist %Destination%%DBName%_%CurDate% (
echo 1
  If exist %Destination%%DBName%_%mm%_%dd%_%yyyy:~2,2% (
  echo 2
    Echo %Destination%%DBName%_%mm%_%dd%_%yyyy:~2,2% exists!
    echo 3
  ) 
  ELSE (
  echo 4
    Echo No %Destination%%DBName%_%mm%_%dd%_%yyyy:~2,2% here today. Maybe we make one?  
    echo 4
) 
ELSE (
echo 5
Echo No %Destination%%DBName%_%CurDate% here
echo 6
))

出力は次のようになります。

Date 3 day(s) before 31499DB_07_22_13 is 31499DB_07_19_13
1
2
x:31499DB_07_19_13 exists!
3
'ELSE' is not recognized as an internal or external command,
operable program or batch file.
4
No x:31499DB_07_19_13 here today. Maybe we make one?
4
'ELSE' is not recognized as an internal or external command,
operable program or batch file.
5
No x:31499DB_07_22_13 here
6
'))' is not recognized as an internal or external command,
operable program or batch file.

これらのエラーなしでこれを実行するにはどうすればよいですか?

どうもありがとう、サム

4

1 に答える 1