Windows 7 Forums


Reply
Thread Tools

How to detect if its windows 7

 
 
eddiedd eddiedd is offline
New Member
Join Date: Jun 2010
Location: Aberkenfig Bridgend
Posts: 4
Thanked: 1
eddiedd's Twitter Pag
 
      06-26-2010
I have written a program that I want to be able to detect if its running on xp,vista,seven
with vista its easy there is a folder called Vista86(or something) is there some way
(easy) for windows 7
ps where does windows 7 store its cookies,is there only one place ?
Thankyou
 
Reply With Quote
 
 
 
 
clifford_cooley clifford_cooley is online now
(c_c)
clifford_cooley's Avatar
Join Date: Mar 2009
Location: Arkansas, USA
Posts: 4,509
Thanked: 930
 
      06-26-2010
Hi eddiedd - Welcome to w7forums

What about typing "ver" from command line?

This gives the Windows version of all Windows operating systems. You should be able to use the version number to do what you are wanting. Using the version number would be a much better approach than using a folder listing.


Windows OS Version Numbers
Quote:
Each version of Windows OS released by Microsoft has a particular version number and these version numbers are important for application developers while building application with compatibility.

And depending on your level of programming experience there are other ways such as "Determine Windows Version and Edition".
 
Reply With Quote
 
Nibiru2012 Nibiru2012 is offline
Quick Scotty, beam me up!
Nibiru2012's Avatar
Join Date: Oct 2009
Location: Planet X
Posts: 4,851
Thanked: 1073
 
      06-26-2010
Cliff - you can also type in "winver" without quotes in the Search bar on the Windows Start Orb.

Just another way to get there.
 
Reply With Quote
 
Fire cat Fire cat is offline
Established Member
Join Date: Mar 2010
Posts: 1,156
Thanked: 164
 
      06-26-2010
Quote:
Originally Posted by Nibiru2012 View Post
Cliff - you can also type in "winver" without quotes in the Search bar on the Windows Start Orb.

Just another way to get there.

Though, how are you supposed to do that with a software? A software that starts typing stuff in your search bar? Don't think so.

Clifford's suggestion could be implemented by running a batch file with the command, that then sends/stores the windows version for the software to continue working.

Last edited by Fire cat; 06-26-2010 at 07:57 PM..
 
Reply With Quote
 
Nibiru2012 Nibiru2012 is offline
Quick Scotty, beam me up!
Nibiru2012's Avatar
Join Date: Oct 2009
Location: Planet X
Posts: 4,851
Thanked: 1073
 
      06-26-2010
I stand corrected... I misunderstood the jist of the post.

Now, go do your homework!
 
Reply With Quote
 
Fire cat Fire cat is offline
Established Member
Join Date: Mar 2010
Posts: 1,156
Thanked: 164
 
      06-26-2010
Quote:
Originally Posted by Nibiru2012 View Post
I stand corrected... I misunderstood the jist of the post.

Now, go do your homework!
Hey! You're taking advantage of my position!
 
Reply With Quote
 
eddiedd eddiedd is offline
New Member
Join Date: Jun 2010
Location: Aberkenfig Bridgend
Posts: 4
Thanked: 1
eddiedd's Twitter Pag
 
      06-27-2010
Sorry I forgot to mention I am writing a Batch fileand wish to determine what the windows type is , as the location of files is different on xp/vista
example here
@TITLE AnyNew by HighlandElectrix(TV)
@echo off
@mode con:cols=90 lines=20
rem this program will find where your cookies are stored (xp/Vista) and then look at each one and let you choose
rem whether to Keep or Delete it, if you keep it, a copy will be stored in a folder c:\goodcookies, so that next
rem time its found it will be ignored, also any cookies you choose to delete will be moved to c:\badcookies
rem and if found again will be deleted autometically. Hope you like it (freeware (c) Eddie Duncan-Dunlop 2010)
rem if you accidentally delete a good cookie, the go to the badcookies folder and cut/paste to goodcookies, or reverse
rem if you make a mistake, you can open the c:\badcookies or c:\goodcookies and correct the error
rem only designed for Internet Explorer
set version=v1.23.bat

echo (c) Eddie Duncan-Dunlop 2010 Version %version%  
color E0
rem E=bright yellow 0=Black
rem set the path to where all cookies are stored (vista is different)
set thepath="%userprofile%\cookies\"


rem -------------------- make sure its not Vista----------------------------------------------------------
if not exist %windir%\help\comexp.chm (
echo NOT WinodwsXP
pause)
if exist %windir%\system32\ndfetw.dll (
echo Vista this is the XP version
pause
set %thepath%="%AppData%\Microsoft\Windows\cookies\")

echo path is %thepath%

rem make a place to store the good/bad cookies if not already there--------------------------------
if not exist %systemdrive%\goodcookies (
md %systemdrive%\goodcookies
echo this is a list of good cookies that will left alone >%systemdrive%/goodcookies/AnyNew.inf
)

if not exist %systemdrive%\badcookies (
md %systemdrive%\badcookies
echo this is a list of bad cookies that will deleted automatically >%systemdrive%/badcookies/AnyNew.inf
)

rem --------------- make a small batch file to call for each cookie ---------------------------------------------
if exist %systemdrive%\%version% goto itsthere
echo if exist %%systemdrive%%\goodcookies\%%1 goto bye>%systemdrive%\%version%
if errorlevel 4 pause
echo if exist %%systemdrive%%\badcookies\%%1 set _what="d">>%systemdrive%\%version%
echo if exist %%systemdrive%%\badcookies\%%1 goto here>>%systemdrive%\%version%

echo set /P _what= %%1 Delete [D/enter] or Keep[K] .>>%systemdrive%\%version%
echo If /i "%%_what%%"=="" set _what="d">>%systemdrive%\%version%
echo If /i "%%_what%%"== "D" set _what="d">>%systemdrive%\%version%
echo If /i "%%_what%%"== "K" set _what="k">>%systemdrive%\%version%
echo If /i "%%_what%%" == ""k"" copy /y %%1 %systemdrive%\goodcookies\%%1^>nul >>%systemdrive%\%version%
echo If /i "%%_what%%" == "k" copy /y %%1 %systemdrive%\goodcookies\%%1^>nul >>%systemdrive%\%version%
echo :here >>%systemdrive%\%version%
echo If /i "%%_what%%" == ""d"" move /y %%1 %systemdrive%\badcookies\%%1^>nul >>%systemdrive%\%version%
echo :bye >>%systemdrive%\%version%

rem ----------------- its there -----------------------------
:itsthere

rem ---------- store the current path to folder and call the little bat file for each cookie found -------------
pushd %thepath%
for %%n in (*.txt) do (
call %systemdrive%\%version% %%n %thepath%
)
popd

rem ECHO

echo Closing in 6 Seconds
for /l %%A in (1,1,6) do (
<nul (set/p z=%%A )
>nul ping 127.0.0.1 -n 2
)

echo.

rem ----- delete all the bad cookies as listed in folder from the normal storage place -----------------------
pushd %systemdrive%\badcookies
for %%n in (*.txt) do if exist %thepath%\%%n del %thepath%\%%n
popd

rem only need to keep the filename(not the contents) so shorten them to "MT" to save room on Hdrive
for %%n in (%systemdrive%\badcookies\*.txt) do echo MT>%%n
for %%n in (%systemdrive%\goodcookies\*.txt) do echo MT>%%n

set thepath=
set _what=
exit
 
Reply With Quote
 
clifford_cooley clifford_cooley is online now
(c_c)
clifford_cooley's Avatar
Join Date: Mar 2009
Location: Arkansas, USA
Posts: 4,509
Thanked: 930
 
      06-27-2010
After seeing what you have posted, I know you will not have any trouble understanding this script.
Code:
REM operating system  : typing "ver" from commandline
REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
REM Windows XP        : Microsoft Windows XP [Version 5.1.2600]
REM Windows Vista     : Microsoft Windows [Version 6.0.6001]
REM Windows 7         : Microsoft Windows [Version 6.1.7600]
REM
REM WinXP, WinVista, Win7

 @ECHO OFF
 Color f0&CLS

 set WinVersion=""
 FOR /f "tokens=1,2* delims=[]" %%a in ('ver') DO (
   if "%%~b"=="Version 5.1.2600" set WinVersion=WinXP
   if "%%~b"=="Version 6.0.6001" set WinVersion=WinVista
   if "%%~b"=="Version 6.1.7600" set WinVersion=Win7
 )
 if "%WinVersion%"=="" Goto :Ver_not_found
 Echo %WinVersion%
 pause
Goto :EOF


:Ver_not_found
  Echo This script did not recognize the OS version in use.
  pause
Goto :EOF


:EOF
 
Reply With Quote
 
eddiedd eddiedd is offline
New Member
Join Date: Jun 2010
Location: Aberkenfig Bridgend
Posts: 4
Thanked: 1
eddiedd's Twitter Pag
 
      06-27-2010
Thanks Just what I needed
 
Reply With Quote
 
Nibiru2012 Nibiru2012 is offline
Quick Scotty, beam me up!
Nibiru2012's Avatar
Join Date: Oct 2009
Location: Planet X
Posts: 4,851
Thanked: 1073
 
      06-28-2010
It's all Greek to me! LOL!

Reminds me of my days on my old Atari 520ST writing programs in BASIC!
(Actually, attempting to write programs in BASIC.)

I really respect people who are able to do this type of thing as shown above.

Must be my ADD or whatever, gets confusing real quick, sort of like trying to drive through Dallas TX on the interstate during Friday PM rush hour!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Install Windows 7 davehc Software 0 08-16-2010 02:50 PM
Windows 7 Annoyances Nibiru2012 General Discussion 6 03-17-2010 06:17 PM
Clean Install Windows 7 with Upgrade Media Nibiru2012 Installation, Setup and Updates 0 12-22-2009 07:03 PM
Clean Install Windows 7 with Upgrade Media Nibiru2012 Installation, Setup and Updates 2 12-04-2009 06:30 PM
Important Issues in This Release Candidate of Windows 7 Ian News 0 05-05-2009 03:25 PM


All times are GMT +1. The time now is 06:55 AM.
W7Forums is an independent website and is not affiliated with Microsoft Corporation.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33