Jump to content

[Version 1] Os Detection


Recommended Posts

@echo off
for /f "tokens=2 delims=," %%a in ('systeminfo.exe /FO CSV') do (
set osver=%%a
)
if %osver% == "Microsoft Windows 7 Home Premium " goto ver_7
goto warnthenexit

:ver_7
:Run Windows 7 specific commands here.
echo It's Windows 7
goto exit

:ver_2008
:Run Windows Server 2008 specific commands here.
echo It's Windows Server 2008
goto exit

:ver_vista
:Run Windows Vista specific commands here.
echo It's Windows Vista
goto exit

:ver_2003
:Run Windows Server 2003 specific commands here.
echo Windows Server 2003
goto exit

:ver_xp
:Run Windows XP specific commands here.
echo It's Windows XP
goto exit

:ver_2000
:Run Windows 2000 specific commands here.
echo It's Windows 2000
goto exit

:ver_nt
:Run Windows NT specific commands here.
echo It's Windows NT
goto exit

:warnthenexit
echo Machine undetermined.

:exit

Some batch file code I'm working on (obviously not finished). To inspire.

Link to comment
Share on other sites

I just ran

'systeminfo.exe /FO CSV'

and it took longer than 20 seconds, so nice idea, but not that practical if you want to quickly plug it into a computer. If you know any programming language (C, C++, C# etc.) you could code it to detect it and run payloads alot easier than using batch :)

Just my two cents.

Edited by Sl45h3R
Link to comment
Share on other sites

  • 4 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...