Windows Scripting

From Andreida
Revision as of 16:42, 19 September 2020 by Andreas (talk | contribs)

directory of current script

change to the directory of the executed script:

chdir /D %~dp0

The /D allows to change drives too.

functions

@echo off
echo 1
call :func_1 2
call :func_1 3
echo 4
exit /B

:func_1
echo %1 (called in a function)
exit /B 0

Output:

>test
1
2 (called in a function)
3 (called in a function)
4