Hey guys,
I have a batch script that currently works to pull the name of a folder on a system that meets criteria, as follows:
What I am trying to do is get the %DIR% to ONLY be the name of the directory and not the full path of C
<DIRECTORY>. I am rusty as hell with batch file logic but have to use it due to a load of ancient servers I will be running this against. Can anyone point me in the right direction here?
I have a batch script that currently works to pull the name of a folder on a system that meets criteria, as follows:
Code:
@echo off
SET DIR=---
FOR /D %%d IN ("C:\BEW-*") DO (
SET DIR=%%d
)
IF EXIST "%DIR%" (GOTO WINDIR) ELSE (GOTO NOWINDIR)
:WINDIR
ECHO Yes
ECHO %DIR%
GOTO END
:NOWINDIR
ECHO No
:END
What I am trying to do is get the %DIR% to ONLY be the name of the directory and not the full path of C
<DIRECTORY>. I am rusty as hell with batch file logic but have to use it due to a load of ancient servers I will be running this against. Can anyone point me in the right direction here?