0

Right im looking for a script that I can click on after I have logged in to open various programs just to save me a bit of time. I have managed to get a script to open one but as a bit of a newbie can someone provide advice.

Dim objShell
Set objShell = WScript.CreateObject( "WScript.Shell" )
objShell.Run """C:\Program Files (x86)\servicecenter\Run\scguiw32.exe "" ""-

express:dvla.servicecenter.fs.fujitsu.com.12680"""
Set objShell = Nothing

4 Answers 4

1

You might be overthinking it a bit to use VBScript or Powershell for this job. A batch file will work.

@echo off
start "c:\Program Files\Folder 1\program.exe"
start "c:\Program Files\Folder 2\program.exe" -switch -argument
exit
Sign up to request clarification or add additional context in comments.

Comments

1
Dim objShell
Set objShell = WScript.CreateObject( "WScript.Shell" )
objShell.Run("Path to program")
wscript.sleep (100)
objShell.Run("Path to program")
wscript.sleep (100)
wscript.quit

Comments

0

I do not have scguiw32.exe, so I created simple script which opens file in notepad and in word.

Dim objShell
Set objShell = WScript.CreateObject( "WScript.Shell" )
objShell.Run "C:\Windows\notepad.exe c:\dump.txt"

objShell.Run """C:\Program Files (x86)\Microsoft Office\Office14\winword.exe"" c:\dump.txt"
Set objShell = Nothing

BTW Instead of vbscript you can use now powershell, and powershell script is much more easy to understand. For example above one will be: Create run.ps1 with content

& 'C:\Program Files (x86)\Microsoft Office\Office14\WINWORD.EXE' c:\dump.txt
notepad.exe C:\dump.txt

Click it right-click and choose Run with Powershell

5 Comments

Where have the dump.txts files come from
Dump.txt is just an example of arguments passed to exe file
would you be able to base a script for powershell on what I wrote as the question?
I possible will be like this: & "C:\Program Files (x86)\servicecenter\Run\scguiw32.exe" "- express:dvla.servicecenter.fs.fujitsu.com.12680"
There is an alternative. Run powershell. Type Start-Process -FilePath "C:\Windows\notepad.exe" -ArgumentList "C:\dump.txt". You can use TAB key when typing paths
0

Here is how to use vbscript to create an array of programs you want to run and then execute each one.

'---Declare Variables
Dim objShell, strprogram1, strProgram2, colprograms, item

'---Create Scripting Shell Object
Set objShell = CreateObject("WScript.Shell")

'---Create Program Variables
strProgram1 = """C:\Program Files (x86)\servicecenter\Run\scguiw32.exe"" ""-express:dvla.servicecenter.fs.fujitsu.com.12680"""
strProgram2 = "C:\Windows\notepad.exe C:\Dump.txt"

'---Add Variables to an Array
colPrograms = Array(strProgram1,strProgram2)

'---Run each program in the array once
For Each item In colprograms
    objShell.Run item
Next

WScript.Echo "Done."

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.