[Solved] Batch file appears not to run and shuts down immediately [closed]


Couple of things you need to understand. When we set variables, we typically enclose them in double quotes in case there are whitespace, which after the whitespace, the next field is seen by cmd as a new command and you will get some errors you would not want, such as the infamous “Is not recognised as an internal command on batch file` error, so we would therefore rather do this:

set "dirA=C:\SE_BulkUnzipTarGzipFiles\WinRarSamples\In"
set "dirE=C:\SE_BulkUnzipTarGzipFiles\WinRarSamples\OutPut"
set "dirC=C:\SE_BulkUnzipTarGzipFiles\WinRarSamples\Processed"

The code then does exactly what you told it to do and that is to simply set variables %dirA% %dirE% and %dirC% with the respected values.

Now to see a result, you need to do something with those variables, perhaps we echo them?

@echo off
set "dirA=C:\SE_BulkUnzipTarGzipFiles\WinRarSamples\In"
set "dirE=C:\SE_BulkUnzipTarGzipFiles\WinRarSamples\OutPut"
set "dirC=C:\SE_BulkUnzipTarGzipFiles\WinRarSamples\Processed"
echo %dirA%
echo %dirE%
echo %dirC%
pause

0

solved Batch file appears not to run and shuts down immediately [closed]