mercredi 8 janvier 2020

Batch keeps failing to run and im not sure why

long time lurker first time asker, but I've got an odd one that keeps bothering me. I have a batch that's suppose to check a few things then do a whole bunch of stuff. It keeps failing at the "check the things" stage. I added log lines to the code to see where but it's not helping narrow down the problem. It keeps showing only the first log line.

```
:INIT
ECHO CHECKING DIR >>C:\FOLDER\LOG.TXT
IF %CD%=="C:\TARGET DIR\" (
     ECHO IN THE RIGHT DIR, CHECKING FOR REQUIRED.ZIP >>C:\FOLDER\LOG
     CALL :ZIPCHK
     CALL :UNPACK
     GOTO CHKSTAGE
) ELSE (
     ECHO NOT IN THE RIGHT DIR! GOING TO MOVEME >>C:\FOLDER\LOG.TXT
     GOTO MOVEME
)
EXIT
```

label ZIPCHK checks if the required *.zip is present, tested by itself it works, setting a variable as 0, 1, or 0 where 0 for required files aren't present, unpacked or not 1 for required files are present in *.ZIP 2 for required files are present and unpacked

label UNPACK exits back to INIT if the zip is already unpacked, unpacks it if it is there, and displays an error for the user if ZIPCHK's output is 0.

I had been doing all the work in INIT but I had the same problem, figured it didn't like something about the whole IF ( IF () () ) ELSE ( IF () ( IF () () ) ) arrangement.

label MOVEME triggers a process to move the batch and the zip into the correct directory.

Aucun commentaire:

Enregistrer un commentaire