A quick note for anyone who is using bat
in the job and needs to access Workspace:
It won't work.
$WORKSPACE
https://issues.jenkins-ci.org/browse/JENKINS-33511 as mentioned here only works with PowerShell. So your code should have powershell
for execution
stage('Verifying Workspace') {
powershell label: '', script: 'dir $WORKSPACE'
}