vbscript

List first few files in subfolders and return list with file names and folder names using VBScript [duplicate]

拟墨画扇 提交于 2021-01-07 02:44:39
问题 This question already has answers here : Recursively access subfolder files inside a folder (2 answers) Closed 4 months ago . The code that I currently have (given below), I prompt the user for the folder path then return the first 10 files from one folder. I then put the file names into a text file. I want to be able to list only 10 random "wav" files from each of the subfolders, then return the names of the files and its corresponding folder name to the text file. CODE Const WINDOW_HANDLE =

OS architecture detection script

烂漫一生 提交于 2021-01-05 09:28:09
问题 I have just downloaded the two .msi installers for 7zip (x86 and x64). Does anyone have a simple script I can use to detect the OS architecture and launch the appropriate .msi file? 回答1: this might help strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colProcessors = objWMIService.ExecQuery _ ("Select * From Win32_Processor") For Each objProcessor in colProcessors If objProcessor.Architecture = 0 Then

How to debug vbscript with Visual Studio Community (2019)

半腔热情 提交于 2020-12-31 17:42:26
问题 I'd like to find a free solution to debug vbscripts, and I tried Visual Studio 2019 Community Edition. I did the very basic installation with only one additional component, the Just-In-Time debugger. I ran all the following steps as administrator. I have created the file Script2.vbs with this very simple script: a=1 b=1/0 c=1 I started the command line (cmd.exe) and entered cscript.exe /x "C:\...\Script2.vbs The script is executed and fails as expected at line 2 but the problem is that the

Access denied error with MSXML2.ServerXMLHTTP

流过昼夜 提交于 2020-12-29 07:54:12
问题 I'm receiving an intermittent "msxml3.dll error '80070005' Access is denied." error. The object always posts back to the same domain. I don't quite know why it works sometimes and why it fails other times. This is Classic ASP - VBScript set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP") xmlhttp.open "POST", "http://xxxx.com/GetCacheValue.aspx", false xmlhttp.send "" strCaptchaText = xmlhttp.responseText set xmlhttp = nothing 回答1: Here's something I snipped from a Google search result:

German Umlauts in Powershell called by vbs

。_饼干妹妹 提交于 2020-12-26 04:01:21
问题 i do have a ps1 file, which create a Link create-link.ps1 $path = $env:HOMESHARE + "\My Projects\" If(!(test-path $path)) { New-Item -ItemType Directory -Force -Path $path } $WshShell = New-Object -comObject WScript.Shell $Shortcut = $WshShell.CreateShortcut($env:HOMESHARE + "\My Projects\" + "linkname.lnk") $Shortcut.TargetPath = "\\path\for\link" $Shortcut.Description = "äöüß" $Shortcut.IconLocation = $env:SYSTEMROOT + "\\system32\\shell32.dll,3" $Shortcut.Save() I also do have a vbs file

German Umlauts in Powershell called by vbs

為{幸葍}努か 提交于 2020-12-26 04:00:11
问题 i do have a ps1 file, which create a Link create-link.ps1 $path = $env:HOMESHARE + "\My Projects\" If(!(test-path $path)) { New-Item -ItemType Directory -Force -Path $path } $WshShell = New-Object -comObject WScript.Shell $Shortcut = $WshShell.CreateShortcut($env:HOMESHARE + "\My Projects\" + "linkname.lnk") $Shortcut.TargetPath = "\\path\for\link" $Shortcut.Description = "äöüß" $Shortcut.IconLocation = $env:SYSTEMROOT + "\\system32\\shell32.dll,3" $Shortcut.Save() I also do have a vbs file

Using htmlfile COM object to access the .getOwnPropertyDescriptor() method of an object in WSH JScript

佐手、 提交于 2020-12-15 05:31:23
问题 In the comments of this question, I was told that the .getOwnPropertyDescriptor() method isn't supported in ES3 ..., so it probably isn't supported in JScript [either] and that is indeed what I see when trying to invoke that method in cscript.exe / wscript.exe : Object doesn't support this property or method However, the latest JScript version I'm using is 5.812 and according to this document, the method should be available in 5.8* JScript. The discrepancy has also been noted in this post,

Run Excel Macro from Outside Excel Using VBScript From Command Line

这一生的挚爱 提交于 2020-12-15 01:44:32
问题 I'm trying to run an Excel macro from outside of the Excel file. I'm currently using a ".vbs" file run from the command line, but it keeps telling me the macro can't be found. Here is the script I'm trying to use Set objExcel = CreateObject("Excel.Application") Set objWorkbook = objExcel.Workbooks.Open("test.xls") objExcel.Application.Visible = True objExcel.Workbooks.Add objExcel.Cells(1, 1).Value = "Test value" objExcel.Application.Run "Macro.TestMacro()" objExcel.ActiveWorkbook.Close

Run Excel Macro from Outside Excel Using VBScript From Command Line

老子叫甜甜 提交于 2020-12-15 01:44:19
问题 I'm trying to run an Excel macro from outside of the Excel file. I'm currently using a ".vbs" file run from the command line, but it keeps telling me the macro can't be found. Here is the script I'm trying to use Set objExcel = CreateObject("Excel.Application") Set objWorkbook = objExcel.Workbooks.Open("test.xls") objExcel.Application.Visible = True objExcel.Workbooks.Add objExcel.Cells(1, 1).Value = "Test value" objExcel.Application.Run "Macro.TestMacro()" objExcel.ActiveWorkbook.Close

Run Excel Macro from Outside Excel Using VBScript From Command Line

|▌冷眼眸甩不掉的悲伤 提交于 2020-12-15 01:43:34
问题 I'm trying to run an Excel macro from outside of the Excel file. I'm currently using a ".vbs" file run from the command line, but it keeps telling me the macro can't be found. Here is the script I'm trying to use Set objExcel = CreateObject("Excel.Application") Set objWorkbook = objExcel.Workbooks.Open("test.xls") objExcel.Application.Visible = True objExcel.Workbooks.Add objExcel.Cells(1, 1).Value = "Test value" objExcel.Application.Run "Macro.TestMacro()" objExcel.ActiveWorkbook.Close