#214270 - 2023-10-19 10:02 AM
Re: VBSCRIPT end of the Road ahead.
[Re: Allen]
|
Arend_
MM club member
   
Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
|
Wow, I wonder how they will replace slmgr.vbs then, amongst others. I did a quick scan of *.vbs on a Windows 11 machine and there are quite a few results from Microsoft itself.
C:\Program Files\Microsoft Office\Office16\OSPP.VBS
C:\Windows\System32\gatherNetworkInfo.vbs
C:\Windows\System32\slmgr.vbs
C:\Windows\System32\SyncAppvPublishingServer.vbs
C:\Windows\System32\winrm.vbs
C:\Windows\System32\Printing_Admin_Scripts\en-US\prncnfg.vbs
C:\Windows\System32\Printing_Admin_Scripts\en-US\prndrvr.vbs
C:\Windows\System32\Printing_Admin_Scripts\en-US\prnjobs.vbs
C:\Windows\System32\Printing_Admin_Scripts\en-US\prnmngr.vbs
C:\Windows\System32\Printing_Admin_Scripts\en-US\prnport.vbs
C:\Windows\System32\Printing_Admin_Scripts\en-US\prnqctl.vbs
C:\Windows\System32\Printing_Admin_Scripts\en-US\pubprn.vbs
C:\Windows\SysWOW64\slmgr.vbs
C:\Windows\SysWOW64\winrm.vbs
C:\Windows\SysWOW64\Printing_Admin_Scripts\en-US\prncnfg.vbs
C:\Windows\SysWOW64\Printing_Admin_Scripts\en-US\prndrvr.vbs
C:\Windows\SysWOW64\Printing_Admin_Scripts\en-US\prnjobs.vbs
C:\Windows\SysWOW64\Printing_Admin_Scripts\en-US\prnmngr.vbs
C:\Windows\SysWOW64\Printing_Admin_Scripts\en-US\prnport.vbs
C:\Windows\SysWOW64\Printing_Admin_Scripts\en-US\prnqctl.vbs
C:\Windows\SysWOW64\Printing_Admin_Scripts\en-US\pubprn.vbs
C:\Windows\WinSxS\amd64_microsoft-windows-a..nagement-appvclient_31bf3856ad364e35_10.0.22621.2070_none_ac8a770443970ffe\SyncAppvPublishingServer.vbs
C:\Windows\WinSxS\amd64_microsoft-windows-a..nagement-appvclient_31bf3856ad364e35_10.0.22621.2283_none_ac75931e43a6ae1a\SyncAppvPublishingServer.vbs
C:\Windows\WinSxS\amd64_microsoft-windows-iis-legacyscripts_31bf3856ad364e35_10.0.22621.1_none_dfdc389d6af52efc\adsutil.vbs
C:\Windows\WinSxS\amd64_microsoft-windows-iis-legacyscripts_31bf3856ad364e35_10.0.22621.1_none_dfdc389d6af52efc\IIsExt.vbs
C:\Windows\WinSxS\amd64_microsoft-windows-nettrace-netsh-helper_31bf3856ad364e35_10.0.22621.1_none_fcc32c0b64120b7d\gatherNetworkInfo.vbs
C:\Windows\WinSxS\amd64_microsoft-windows-p..inscripts.resources_31bf3856ad364e35_10.0.22621.1_en-us_70432baa400e82bb\prncnfg.vbs
C:\Windows\WinSxS\amd64_microsoft-windows-p..inscripts.resources_31bf3856ad364e35_10.0.22621.1_en-us_70432baa400e82bb\prndrvr.vbs
C:\Windows\WinSxS\amd64_microsoft-windows-p..inscripts.resources_31bf3856ad364e35_10.0.22621.1_en-us_70432baa400e82bb\prnjobs.vbs
C:\Windows\WinSxS\amd64_microsoft-windows-p..inscripts.resources_31bf3856ad364e35_10.0.22621.1_en-us_70432baa400e82bb\prnmngr.vbs
C:\Windows\WinSxS\amd64_microsoft-windows-p..inscripts.resources_31bf3856ad364e35_10.0.22621.1_en-us_70432baa400e82bb\prnport.vbs
C:\Windows\WinSxS\amd64_microsoft-windows-p..inscripts.resources_31bf3856ad364e35_10.0.22621.1_en-us_70432baa400e82bb\prnqctl.vbs
C:\Windows\WinSxS\amd64_microsoft-windows-p..inscripts.resources_31bf3856ad364e35_10.0.22621.1_en-us_70432baa400e82bb\pubprn.vbs
C:\Windows\WinSxS\amd64_microsoft-windows-security-spp-tools_31bf3856ad364e35_10.0.22621.1_none_a72f11d2b2de8e85\slmgr.vbs
C:\Windows\WinSxS\amd64_microsoft-windows-w..for-management-core_31bf3856ad364e35_10.0.22621.2070_none_aa7d75492877e03c\winrm.vbs
C:\Windows\WinSxS\wow64_microsoft-windows-iis-legacyscripts_31bf3856ad364e35_10.0.22621.1_none_ea30e2ef9f55f0f7\IIsExt.vbs
C:\Windows\WinSxS\wow64_microsoft-windows-p..inscripts.resources_31bf3856ad364e35_10.0.22621.1_en-us_7a97d5fc746f44b6\prncnfg.vbs
C:\Windows\WinSxS\wow64_microsoft-windows-p..inscripts.resources_31bf3856ad364e35_10.0.22621.1_en-us_7a97d5fc746f44b6\prndrvr.vbs
C:\Windows\WinSxS\wow64_microsoft-windows-p..inscripts.resources_31bf3856ad364e35_10.0.22621.1_en-us_7a97d5fc746f44b6\prnjobs.vbs
C:\Windows\WinSxS\wow64_microsoft-windows-p..inscripts.resources_31bf3856ad364e35_10.0.22621.1_en-us_7a97d5fc746f44b6\prnmngr.vbs
C:\Windows\WinSxS\wow64_microsoft-windows-p..inscripts.resources_31bf3856ad364e35_10.0.22621.1_en-us_7a97d5fc746f44b6\prnport.vbs
C:\Windows\WinSxS\wow64_microsoft-windows-p..inscripts.resources_31bf3856ad364e35_10.0.22621.1_en-us_7a97d5fc746f44b6\prnqctl.vbs
C:\Windows\WinSxS\wow64_microsoft-windows-p..inscripts.resources_31bf3856ad364e35_10.0.22621.1_en-us_7a97d5fc746f44b6\pubprn.vbs
C:\Windows\WinSxS\wow64_microsoft-windows-security-spp-tools_31bf3856ad364e35_10.0.22621.1_none_b183bc24e73f5080\slmgr.vbs
C:\Windows\WinSxS\wow64_microsoft-windows-w..for-management-core_31bf3856ad364e35_10.0.22621.2070_none_b4d21f9b5cd8a237\winrm.vbs
|
|
Top
|
|
|
|
#214316 - 2025-09-10 10:43 PM
Re: VBSCRIPT end of the Road ahead.
[Re: Arend_]
|
Allen
KiX Supporter
   
Registered: 2003-04-19
Posts: 4574
Loc: USA
|
https://www.neowin.net/news/vbscript-on-...y-vba-projects/
Since Microsoft was in the news again today reminding everyone that VBScript is being depreciated, I finally sat down and started trying to figure where I might feel this.
Inputbox(), WSHPipe(), and WSHShortCut() are the ones I immediately noticed.
Rarely, I need Inputbox, which was so slickly covered by scriptcontrol. After a ton of work (no thanks to Microsoft Copilot) here is a version using Powershell.
Function InputBox($sPrompt, Optional $sTitle, Optional $sDefault)
dim $PSCommand, $FH, $RC, $TempFile
If Not $sTitle
$sTitle = "Input Prompt"
EndIf
$TempFile = "%TEMP%\ps_inputbox.txt"
if exist($TempFile)
DEL $TempFile
endif
$PSCommand = 'powershell -Command "Add-Type -AssemblyName Microsoft.VisualBasic; '
$PSCommand = $PSCommand + "$input = [Microsoft.VisualBasic.Interaction]::InputBox('" + $sPrompt + "','" + $sTitle + "','" + $sDefault + "'); "
$PSCommand = $PSCommand + "$input | Out-File -FilePath '" + $TempFile + "' -Encoding ASCII"
;$PSCommand = "%COMSPEC% /c " + $PSCommand
SHELL $PSCommand
$fh = FreeFileHandle()
If Open($fh, $TempFile) = 0
$InputBox = ReadLine($fh)
$RC=Close($fh)
EndIf
EndFunction
Would someone mind checking this out and see if you can find issues with it and or report back if works for you?
I'm digging into details about the other two functions.
_________________________
(... better days ahead)
|
|
Top
|
|
|
|
#214322 - 2025-09-21 03:23 PM
Re: VBSCRIPT end of the Road ahead.
[Re: Allen]
|
ChristopheM
Hey THIS is FUN
   
Registered: 2002-05-13
Posts: 311
Loc: STRASBOURG, France
|
Like glenn, we use our own version of InputBox, based on kixforms (version 2.47.6), which is deployed on each workstation and servers. Here is the code of the function :/*------------------------------------------------------------------------------
;function:
; InputBox
;
;Author:
; Christophe MELIN (christophe.melin68@outlook.fr)
;
;Action:
; show a dialog box to get an input from a user
;
;Syntax:
; InputBox( $strtitle, $strprompt, $strDefault, $PasswordChar )
;
;Parameters:
; StrTitle : REQUIRED. String value indicating the title of the window
; StrPrompt : REQUIRED. prompt before the input box
; StrDefault : REQUIRED. default value in the input box
;
; PasswordChar : OPTIONAL char to display if masked input
;
;returns:
; string in the the inputbox if OK Button clicked empty string if Cancel buton clicked
;
;Dependencies:
; KiXFormsv 2.47
;-----------------------------------------------------------------------------*/
Function InputBox( $strtitle, $strprompt, $strDefault, optional $PasswordChar )
dim $, $strInput, $rc, $oldVars, $oldMacros
$oldVars = SetOption( "NoVarsInStrings", "ON" )
$oldMacros = SetOption( "NoMacrosInStrings", "ON" )
dim $InputBoxForm
$Inputboxform = CreateObject("Kixtart.Form")
$Inputboxform.FontName = "Tahoma"
$Inputboxform.FontSize = 10
$Inputboxform.ClientHeight = 250
$Inputboxform.ClientWidth = 400
$Inputboxform.text = $strtitle
$Inputboxform.tag = 1
dim $lblInputboxPrompt
$lblInputboxPrompt = $Inputboxform.Label
$lblInputboxPrompt.HEIGHT = 19
$lblInputboxPrompt.LEFT = 10
$lblInputboxPrompt.TOP = 20
$lblInputboxPrompt.WIDTH = $Inputboxform.width - (2 * $lblInputboxPrompt.left)
$lblInputboxPrompt.text = $strprompt
dim $txtInputboxPrompt
$txtInputboxPrompt = $Inputboxform.TextBox
$txtInputboxPrompt.HEIGHT = 25
$txtInputboxPrompt.LEFT = $lblInputboxPrompt.LEFT
$txtInputboxPrompt.TOP = $lblInputboxPrompt.bottom + 5
$txtInputboxPrompt.Text = $strDefault
$txtInputboxPrompt.WIDTH = $lblInputboxPrompt.width
if $PasswordChar
if Trim($PasswordChar)
$txtInputboxPrompt.passwordchar = $PasswordChar
endif
endif
dim $btnInputboxOK
$btnInputboxOK = $Inputboxform.button("OK")
$btnInputboxOK.FONTNAME = "Arial"
$btnInputboxOK.FONTSIZE = 10
$btnInputboxOK.FONTBOLD = 1
$btnInputboxOK.WIDTH = 80
$btnInputboxOK.HEIGHT = 19
$btnInputboxOK.LEFT = 10
$btnInputboxOK.Top = $txtInputboxPrompt.bottom + 10
$btnInputboxOK.OnClick = "$Inputboxform.hide() $Inputboxform.tag=0"
$btnInputboxOK.Default = 1
dim $btnInputboxCancel
$btnInputboxCancel = $Inputboxform.button("Cancel")
$btnInputboxCancel.FONTNAME = "Arial"
$btnInputboxCancel.FONTSIZE = 10
$btnInputboxCancel.FONTBOLD = 1
$btnInputboxCancel.WIDTH = 80
$btnInputboxCancel.HEIGHT = 19
$btnInputboxCancel.LEFT = $btnInputboxOK.left + $btnInputboxOK.width + 10
$btnInputboxCancel.Top = $btnInputboxOK.Top
$btnInputboxCancel.OnClick = '$Inputboxform.hide() $txtInputboxPrompt.Text = ""'
$btnInputboxCancel.Default = 0
$btnInputboxCancel.Cancel = 1
$Inputboxform.ClientHeight = $btnInputboxOK.bottom + 10
$Inputboxform.Center
$=$Inputboxform.Show()
$=$txtInputboxPrompt.SetFocus()
while $Inputboxform.Visible
$=Execute($Inputboxform.DoEvents)
loop
$strInput = $txtInputboxPrompt.Text
$rc = $inputboxform.tag
$Inputboxform = 0
$inputbox = IIF( $rc, "", $strInput )
$ = SetOption( "NoVarsInStrings", $oldVars )
$ = SetOption( "NoMacrosInStrings", $oldMacros )
exit $rc
endfunction
And following, a simple example of use of this function :$username = InputBox( "Get identity", "select user name", "%username%" )
if not @error
$password = InputBox( "Get password", "password of "+$username, "", "*" )
if not @error
"username : " $username ?
"password : " $password ?
endif
endif Is it post of functions / code like that you are waiting for ?
PS : If you want, you can reformat the code with syntax highlighting
_________________________
Christophe
|
|
Top
|
|
|
|
#214326 - 2025-10-28 08:50 PM
Re: VBSCRIPT end of the Road ahead.
[Re: NTDOC]
|
BradV
Seasoned Scripter
  
Registered: 2006-08-16
Posts: 687
Loc: Maryland, USA
|
I haven't done any Windows scripting for quite a while. My scripting is all done for RHEL 8 & 9. Just stop by occasionally to see what is going on?
|
|
Top
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 1843 anonymous users online.
|
|
|