If you have a script that you require to be launched when the current directory is set to a specific path,
you can use the following technique to abort the script:
@echo off if /i "%CD%" NEQ "SpecificCurrentDirectory" @echo The %0 script was launched with the following current directory: %CD%&exit /b 1 :: ContinueExample
To only run if the current directory is the Windows folder: @echo off if /i "%CD%" NEQ "%SystemRoot%" @echo The %0 script was launched with the following current directory: %CD%&exit /b 1 :: Continue
0 comments
Hide comments