07-23-2023, 09:18 AM
`CD` returns an `EXIT_FAILURE` when the specified directory does not exist. And you got [_conditional processing symbols_](
SET cd_backup=%cd%
(CD "%~1" && CD %cd_backup%) || GOTO Error
:Error
CD %cd_backup%
[To see links please register here]
), so you could do like the below for this.SET cd_backup=%cd%
(CD "%~1" && CD %cd_backup%) || GOTO Error
:Error
CD %cd_backup%