Getting Extended PDI

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Adrianvdh
Posts: 177
Joined: 16 May 2013 13:00

Getting Extended PDI

#1 Post by Adrianvdh » 01 Jul 2013 14:35

Hello everyone, can you help me, to get and store Windows Extended PDI into a varible, this is for my own custum encryption purposes :), not illegal in any way, you can trust me with that.

For example...

Code: Select all

set slmgr=%windir%\system32\slmgr.vbs
cscript //nologo %slmgr% -dlv|findstr /i "Extended PID: "


I would use this to contain the information, Thanks for your help :)

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: Getting Extended PDI

#2 Post by Squashman » 01 Jul 2013 15:50

Code: Select all

set slmgr=%windir%\system32\slmgr.vbs
for /f "tokens=3 delims=: " %%G in ('cscript //nologo %slmgr% -dlv|findstr /i "Extended PID: "') do SET EPID=%%G

Adrianvdh
Posts: 177
Joined: 16 May 2013 13:00

Re: Getting Extended PDI

#3 Post by Adrianvdh » 01 Jul 2013 17:15

Sorry that seems to not work?

I think I fixed it though...

Code: Select all

for /f "tokens=3 delims=: " %%G in ('cscript //nologo %slmgr% -dlv[color=#FF0000]^[/color]|findstr /i "Extended PID: "') do SET EPID=%%G

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: Getting Extended PDI

#4 Post by Squashman » 01 Jul 2013 19:34

Sorry, I missed escaping the pipe. Most of the time I am writing the code from my phone without testing it first.

Code: Select all

@echo off
set slmgr=%windir%\system32\slmgr.vbs
for /f "tokens=3 delims=: " %%G in ('cscript //nologo %slmgr% -dlv^|findstr /i "Extended PID: "') do SET EPID=%%G
echo %EPID%
pause

Post Reply