diff --git a/miniupnpc/msvc/genminiupnpcstrings.vbs b/miniupnpc/msvc/genminiupnpcstrings.vbs
new file mode 100644
index 0000000..c1f4a58
--- /dev/null
+++ b/miniupnpc/msvc/genminiupnpcstrings.vbs
@@ -0,0 +1,53 @@
+' VBScript to generate miniupnpcstrings.h
+' Copyright 2018 Thomas Bernard
+'Set WshShell = CreateObject("WScript.Shell")
+Set FSO = CreateObject("Scripting.FileSystemObject")
+versionfile = "..\version"
+infile = "..\miniupnpcstrings.h.in"
+outfile = "..\miniupnpcstrings.h"
+
+On Error Resume Next
+
+'Wscript.Echo revision
+
+Err.Clear
+Set f = FSO.OpenTextFile(versionfile, 1, False) ' 1 = Read
+If Err.Number = 0 Then
+ version = f.ReadLine
+ f.Close
+Else
+ ' Exit error
+ WScript.Quit 1
+End If
+
+os_version = "0.0.0"
+strComputer = "."
+Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
+Set colOperatingSystems = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem")
+For Each objOperatingSystem in colOperatingSystems
+ 'Wscript.Echo objOperatingSystem.Caption & " -- "
+ os_version = objOperatingSystem.Version
+Next
+
+Dim array
+
+Set f_in = FSO.OpenTextFile(infile, 1, False)
+If Err.Number = 0 Then
+ Set f_out = FSO.OpenTextFile(outfile, 2, True) ' 2 = Write
+ Do Until f_in.AtEndOfStream
+ line = f_in.ReadLine
+ If Len(line) > 0 Then
+ array = Split(line, " ")
+ If UBound(array) >= 2 And array(0) = "#define" Then
+ If array(1) = "OS_STRING" Then
+ line = "#define OS_STRING " & Chr(34) & "MSWindows/" & os_version & Chr(34)
+ ElseIf array(1) = "MINIUPNPC_VERSION_STRING" Then
+ line = "#define MINIUPNPC_VERSION_STRING " & Chr(34) & version & Chr(34)
+ End if
+ End if
+ End If
+ f_out.WriteLine line
+ Loop
+ f_in.Close
+ f_out.Close
+End If
diff --git a/miniupnpc/msvc/miniupnpc.vcxproj b/miniupnpc/msvc/miniupnpc.vcxproj
index 2725136..a1569bf 100644
--- a/miniupnpc/msvc/miniupnpc.vcxproj
+++ b/miniupnpc/msvc/miniupnpc.vcxproj
@@ -59,6 +59,9 @@
Level3
EditAndContinue
+
+ genminiupnpcstrings.vbs
+
@@ -71,6 +74,9 @@
Level3
ProgramDatabase
+
+ genminiupnpcstrings.vbs
+
diff --git a/miniupnpc/msvc/miniupnpc_vs2010.vcxproj b/miniupnpc/msvc/miniupnpc_vs2010.vcxproj
index 3d7bf83..7f83cab 100644
--- a/miniupnpc/msvc/miniupnpc_vs2010.vcxproj
+++ b/miniupnpc/msvc/miniupnpc_vs2010.vcxproj
@@ -56,6 +56,9 @@
Level3
EditAndContinue
+
+ genminiupnpcstrings.vbs
+
@@ -69,6 +72,9 @@
Level3
ProgramDatabase
+
+ genminiupnpcstrings.vbs
+