Welcome to FreeSoftwareServers Confluence Wiki

@ECHO OFF

::powershell.exe -c Get-ChildItem  -Path Cert:\CurrentUser\My
Set substringtofind=Username
FOR /F %%N IN ('powershell.exe -c Get-ChildItem  -Path Cert:\CurrentUser\My') DO (
 ECHO "%%N" | FIND /i "%substringtofind%" >nul
 IF %ERRORLEVEL% EQU 0 (
  Set result=%%N
 )
)

ECHO %result%

PAUSE
  • No labels