|How to specify the output format of a powerpoint video export in vbscript|
The output is WMV, if you want a different format you must convert
using a transcoding utility, for example the ffmpeg command line tool.
|How to LDAP query without knowing exact OU|
Do a query with scope Subtree using an ADODB.Connection and an
base = "<LDAP://OU=Users,OU=ABC Company,DC=ABC,DC=local>"
fltr = "(&(objectClass=user)(objectCategory=Person))"
attr = "distinguishedName,sAMAccountName"
scope = "subtree"
Set cn = CreateObject("ADODB.Connection")
cn.Provider = "ADsDSOObject"
cn.Open "Active Directory Provider"
Set cmd = CreateObje
|Return volume name in Do loop|
For the first question: To delay the script, you can use this
The number is in Milliseconds, so 1000 is 1 second.
|VBScript -- objfile.writeline|
Before you go on get rid of the re-initialization of objFSO inside the
Do...Loop, same as objFolder and the rest of the variables you copied.
Concerning sending the email: The simplest way would be to declare a
variable doSendMail at top level, initialize it to false and inside
your Loop set it to true
If intFolderSize > 1 AND doSendMail = False Then
doSendMail = True
|Open Chrome with a Script on any Windows OS from xp on up|
You don't need to use a vbscript.
The following command will determine where Chrome is installed and set
the CHROMEPATH environment variable to this value.
From the command line:
for /f "usebackq tokens=1,2,3,4,5" %a in (`reg query
HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersion /s /f
chrome.exe ^| findstr Application`) do set CHROMEPATH="%c %d %e"
From a batch file:
for /f "useback
|How to read content of a file from FTP server without downloading into local folder in command prompt?|
1. Instead of downloading every file, I just want to open the file,
read the content, and confirm that file contains the requested text.
No. You cannot check the contents of the file without downloading the
contents (i.e. the file) first. If you want to do that you need
something that allows you to run validation code on the remote side
2. Is there any way to rename a file bef
|Filepath from editable textbox with spaces|
You need to quote the full file spec:
>> pth = "C:DataProject X"
>> inp = "DesignCAD Drawings"
>> fil = "bolts.xls"
>> fsp = goFS.BuildPath(pth, goFS.BuildPath(inp, fil))
>> cmd = "excel.exe """ & fsp & """"
>> WScript.Echo cmd
excel.exe "C:DataProject XDesignCAD Drawingsolts.xls"
|Convert Hex String into Array and Write it to registry - VBSCript|
Hex() is a function, so there shouldn't be a string named Hex.
Use Split() to parse a string into an array of strings.
Use a loop to convert hex/base 16 string elements into numbers.
>> WScript.Echo Hex(15)
>> s = "43,00,23,00,01,FF"
>> a = Split(s, ",")
>> WScript.Echo TypeName(a), TypeName(a(0)), Join(a, "-")
>> For i = 0 To UBound(a) : a(i) = CByte("&a
|need help understanding and using wsc files on win64bit|
Without registration, you have to use the script protocol:
set goFS = CreateObject("Scripting.FileSystemObject")
sFSpec = goFS.GetAbsolutePathName(". est.wsc")
set x = getObject("script:" & sFSpec)
x.msg "hello world!"
study WSC (Windows Script Components) Without Registration!
With registration - keep your
|how to expose variables from msscriptcontrol?|
The script control can access your program's stuff, specifically
It's help file should be in system32 folder with Reference, some basic
conceptual info, and some small samples.
Makes run-time functionality available to a scripting engine.
ScriptControl.AddObject(name, object[, addMembers])
The AddObject method has these parts:
name Required. Nam
|Modify File Icon|
You can't change the icon for a specific file. You can, however,
change the icon of a specific shortcut to a file.
Set sh = CreateObject("WScript.Shell")
lnkfile = sh.SpecialFolders("Desktop") & "your.lnk"
Set lnk = sh.CreateShortcut(lnkfile)
If lnk.IconLocation = "C:path osome.ico" Then
sh.IconLocation = "C:path o.ico"
sh.IconLocation = "C:path osome.ico"
|VbScript equivalent to PHP's fmod() function|
After some research I found out that there isn't, so searching for the
calculation I ended up with a custom made vbScript function, as seen
If y > 0 Then
z = Fix( x / y)
z = 1
fmod = x - z * y
|VBS How to call cmd.exe using a string variable with spaces|
Embed the needed quotes (escaped via doubling) in the surrounding
WshShell.Run "cmd /c copy /y ""C:input" & WScript.Arguments(0)
& """ C:output", 0
background, further reading
|POST request fails with error "object required"|
You defined mydata as an integer value. Integer values don't have a
or create mydata as a proper object.
|VbScript to find the end character of a string|
Use Split() to get the part before the . and Right() to get its tail:
>> s = "thisisatextfilea.txt"
>> WScript.Echo Right(Split(s, ".")(0), 1)
(Checking your assumptions (there is a substring left of the one and
only .) might be a good idea for production code.)
|Access word documents header containing a table with vbscript|
Tables in Word documents can be enumerated via the Tables collection.
For Each tbl In
For i = 1 To tbl.Rows.Count
For j = 1 To tbl.Columns.Count
WScript.Echo tbl.Cell(i, j).Value
|How to make a function with two strings as arguments|
Start with the knowledge that a functions returns a value, a tentative
specification of what the function should do, and a basic testing
' returns the string build by inserting m(iddle) into f(ull) at half
Function insertInto(f, m)
insertInto = "?"
Dim t, r
For Each t In Array( _
Array("ABEF", "CD", "ABCDEF") _
r = insertInto(t(0), t(1))
|Change browser language preference programmatically|
If Ansgar does not disagree, I post the final result of researching
It seems there is no better way than updating
HKCUSoftwareMicrosoftInternet ExplorerInternationalAcceptLanguage, and
(at least) broadcasting a WM_SETTINGCHANGE message via SendMessage so
every process in the current session sees this change immediately.
|How to make my VB script overwrite the existing Shortcut file instead of creating a duplicate|
The elements you see in the desktop are stored in different folders.
Assuming that there are two shortcuts with the same name, i will bet
each shortcut is placed in a different folder. The one you are
creating with your code will be placed in the desktop folder of the
current user and the previous one in a shared folder.
You can not overwrite the existing shortcut if the path used to open
|VBSCRIPT - SWbemObjectSet error 8004100C|
On Error Resume Next
transfers error handling from vbscript to you. You now need to test
for errors after every call that might cause one.
If err.number <> 0 then
'fix error or ignore
'If decide to crash
'err.raise(err.number, blah, blah, blah)
Error handling is a chain. From lowest function call up to the app.
Windows looks for error
|VB script to process all files in a folder keeping original name|
Set tsIn = fso.OpenTextFile("c: estfile.txt")
Set tsOut = fso.CreateTextFile("c: estOutput.txt", True)
Do Until tsIn.AtEndOfStream
today = Year(Date) & Right("00" & Month(Date), 2) & Right("00" &
For Each f In fso.GetFolder("C: est").Files
tsOutName = fso.GetBaseName(f) & today & "." &
|Cannot publish .net application or to install Web Deploy 3.5|
After many hours of searching, repairing system using SFC.EXE /SCANNOW
command I found that the problem was McAfee antivirus program. My PC
come with McAfee, but I uninstall it it - at least this is what I
thought I did.
This page explains how to do it in details:
What I did was to run this program:
|how to get SSH server response and status with codes in output file|
Use .ExitCode to get "the exit code set by a script or program run
using the Exec() method".
It makes no sense to re-direct the streams to a file and to access
them. You need to decide whether you want to parse/analyse/report a
log file or to monitor the streams while the .Exec 'works'.
Reconsider the trailing quotes after ls and bye.
|Run exe from vbs error|
I assume that you want to execute file.exe with elevated privileges
and keep the window open.
set oShell = CreateObject("Shell.Application")
oShell.ShellExecute "cmd.exe", "/K file.exe", "", "runas", 1
Note that runas verb is undocumented.
Start-Process -FilePath "cmd.exe" -ArgumentList @("/K", "file.exe")
|measuring print job time programmatically|
There's no simple way to obtain that information from inside your
script, because when the job is removed from the print queue it's
gone. You could set up an event monitor for the print spooler like
Set wmi = GetObject("winmgmts://./root/cimv2")
Set wbemDateTime = CreateObject("WbemScripting.SWbemDateTime")
qry = "SELECT * FROM __InstanceOperationEvent WITHIN 1 " & _
|VB Script for Opening PowerPoint file fails|
Do you just need to open it? As long as pptx files are properly
associated with PowerPoint, you should be able to just "shell" the
file and it will open.
CreateObject("WScript.Shell").Run Chr(34) &
"C:DirectorySample.pptx" & Chr(34)
|VBS - Getting program files folder path?|
This TechNet article shows the list of SpecialFolders. Program Files
is not among them. This is a limitation of the Windows Script Host. In
the same way that the following shows a blank popup
SET wsc = CreateObject("WScript.Shell")
So instead you have at least 2 options.
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(&
|Why am I getting a run- tme error & can you correct it?|
The reason of the error 28 is infinite recursion, caused by Clear()
which leads to subsequent Worksheet_Change execution.
As a quick dirty fix you could use a global Boolean variable to skip
excessive Clear() call.
Public isChanging As Boolean
Private Sub Worksheet_Change(ByVal Target As Range)
If isChanging = False Then
isChanging = True
Dim cell As Range
|Input to Multiple Textbox in Vbsript|
Multiple TextBox for Input in VBScript
Use this link. It's the same requirement.
I would be better if you do some search work for your requirement.
|Passing Parameters to a Stored Procedure using ASP|
You use ADO through late binding, which means that the constants like
adCmdStoredProc, adParamInput etc. are unknown to your code (so they
are always 0).
You can either look them up and define the ones you need as a constant
in your code (or use the numbers directly, but that's not well
readable if you edit the code again later).
Or take a look here on msdn - you may find a file that defines
|"Provider cannot be found" error after migrating from IIS 6.0 to IIS 8.5|
Try SQLCNCLI and SQLOLEDB as your data provider.
These are both OLEDB drivers, rather than ODBC.
Here's a list of the connection strings for each version of SQL from
SQLNCLI - for SQL Server 2005
SQLNCLI10 - for SQL Server 2008
SQLNCLI11 - for SQL Server 2012
|How to launch multiple different URL on a page with auto bot login using .VBS?|
You don't have to use the SendKeys method. You can get the ID off the
username box and the password box by inspect element for each site by
using the .value method. Like this
ie.Doucment.All.Item("email").Value= "Password goes in here".
ie = CreatObject("InternetExplorer.Application")
Do While ie.busy
|Why won't my VBS Spam Bot work?|
A helpful tip you probably didn't notice as you did say you were quit
inexperienced with VBS -
wscript.sleep o & 000
The ampersand (&) is a character with the logical equivalent of
and, similar to or and not, in that they are logic, and is used in if
statements to check whether both, for example, foo and bar are
equivalenet to each other; for example:
variable1 = true
variable2 = true
|Is there any method to detect whether STDIN has been redirected within VBscript?|
In short, no, but ...
I've tested everything i could think of and have not found a
reasonable way to do it.
None of the properties/methods exposed by the TextStream wrappers
retrieved with WScript.StdIn or fso.GetStdStream give enough
information to determine if the input is redirected/piped.
Trying to obtain information from the behaviour/environment of a
spawned process (how to create the ex
|How to create Multiple bot log-in in one page using VBS|
You can use for loop for multiple log-in and use array value for
username and pwd.
Dim uname(5) 'assign user name value to array element 0 to 5
Dim pwd(5) 'assign password value to array element 0 to 5
Set a = createobject ("wscript.shell")
For i=0 to 5 step 1
a.sendkeys chr (9)
|Getting compilation error , expected end of statement in vb script..|
A command line script can't contain neither HTML markup
(<whatever>) nor reference components provided by the browser
A hello word VBScript should look like
WScript.Echo "Hello world"
MsgBox "Hello world"
depending on whether you want to use a console (cscript hello.vbs) or
wscript/double click on hello.vbs.
|Why Does vbScript "And" Operator cause an Overflow Error?|
I have come up with a work-around solution to this problem using
much simpler than what was proposed in the Eric Lippert article.
Solution is as follows:
//bitand function for JS
//vbscript cant handle bitwise operations cleanly on values above
|Multiple users to run the same script|
There are several ways to obtain the account name of the currently
logged-in user, for instance by expanding the respective environment
>>> Set sh = CreateObject("WScript.Shell")
>>> WScript.Echo sh.ExpandEnvironmentStrings("%USERNAME%")
or via a WshNetwork object:
>>> Set net = CreateObject("WScript.Network")
>>> WScript.Echo net.UserName
or via WMI:
>>> Set wmi = Get
|Is it possible to store a .ico file in a vbscript?|
This HTA show you how to embed a file exe or com zipped in a vbscript
For exemple i embeded the WGET.EXE to download a PNG file =
estabanner5.png just for the test
[HTA] Encapsulate a zipped exe file in a VBScript
And i found this Vbscript on the net named Basic Base64- Encode-
You just Drop a file onto script and click YES to encode. And Click NO
to decode a Base64 string.