WshShell.Run "explorer.exe /e," & Directory
Tuesday, September 21, 2010
VBScript: Filesystem stuff
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(ORIGINAL) then
Const FOF_CREATEPROGRESSDLG = &H0&
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.NameSpace(TARGET)
objFolder.MoveHere ORIGINAL, FOF_CREATEPROGRESSDLG
If objFSO.FolderExists(ORIGINAL) then
objFolder.MoveHere ORIGINAL, FOF_CREATEPROGRESSDLG
end if
Dim FSO
Set FSO = CreateObject("Scripting.FileSystemObject")
if FSO.FileExists(ORIGINAL & "\config\Discovery.xml") then
FSO.CopyFile ORIGINAL & "\config\Discovery.xml", InstallLocation & "\config\"
End If
end if
VBScript: Getting User's Home Directory
Set colProcessEnvVars = WshShell.Environment("Process")
HomeDir = colProcessEnvVars("HOMEDRIVE") & colProcessEnvVars("HOMEPATH")
VBScript: Check the bit-ness of the OS
Set WshShell = WScript.CreateObject("WScript.Shell")
Set colProcessEnvVars = WshShell.Environment("Process")
processorArchitecture = colProcessEnvVars("PROCESSOR_ARCHITECTURE")
if processorArchitecture = "AMD64" then
WshShell.Echo "64-bit"
else
WshShell.Echo "32-bit"
end if
VBScript: Checking to see if a process is currently running
strComputer = "."
Set objWMIService = GetObject("winmgmts:" &_
"{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process")
For Each objProcess In colProcess
if left(objProcess.Name,11) = "Process.exe" then
msgbox "Process is currently running.", 48, "Process is Running"
wscript.quit
end if
Next
Loading up some VBScript for future reference...
My next few posts are just samples of VBScript that I built for work that I want to be able to reference in the future.
As you were.
Tuesday, September 14, 2010
Subscribe to:
Posts (Atom)
