corsasport.co.uk
 

Corsa Sport » Message Board » Off Day » Geek Day » Need to convert a batch file into VBScript


New Topic

New Poll
  Subscribe | Add to Favourites

You are not logged in and may not post or reply to messages. Please log in or create a new account or mail us about fixing an existing one - register@corsasport.co.uk

There are also many more features available when you are logged in such as private messages, buddy list, location services, post search and more.


Author Need to convert a batch file into VBScript
Richie
Member

Registered: 3rd Dec 02
Location: Newport, Wales
User status: Offline
17th Oct 07 at 18:02   View User's Profile U2U Member Reply With Quote

But im a dribbler when it comes to VB script.

Can anyone help?
Dom
Member

Registered: 13th Sep 03
User status: Offline
17th Oct 07 at 18:36   View User's Profile U2U Member Reply With Quote

just google for the batch file equivalent in VBScript, it's fairly simple - though if you need to output anything then a message box is about as far as it goes unless you're going to embedded it into a HTML page in which case the worlds your oyster.

what does the batch file do anyways?
Richie
Member

Registered: 3rd Dec 02
Location: Newport, Wales
User status: Offline
17th Oct 07 at 19:10   View User's Profile U2U Member Reply With Quote

Adds a bunch of firewall rules on vista....

@echo off
echo Adding Windows Firewall Rules......
echo.
echo.
echo.
pause
set OFPATH="%ProgramFiles%\Microsoft Office\Office12"
netsh firewall add allowedprogram program = %OFPATH%\GROOVE.EXE name = "Microsoft Office Groove" mode = ENABLE profile = ALL
netsh firewall add allowedprogram program = %OFPATH%\ONENOTE.EXE name = "Microsoft Office OneNote" mode = ENABLE profile = ALL
netsh firewall add allowedprogram program = %OFPATH%\OUTLOOK.EXE name = "Microsoft Office Outlook" mode = ENABLE profile = ALL
ECHO Firewall Rules Added Sucessfully......
pause
exit
Richie
Member

Registered: 3rd Dec 02
Location: Newport, Wales
User status: Offline
18th Oct 07 at 19:38   View User's Profile U2U Member Reply With Quote

Scaredy cats
Dom
Member

Registered: 13th Sep 03
User status: Offline
18th Oct 07 at 22:42   View User's Profile U2U Member Reply With Quote

look at the objshell function under VBScript, im not 100% clued up but something like -

code:

Option Explicit
Dim objShell
Dim strPath as String

strPath = "%ProgramFiles%\Microsoft Office\Office12"
Set objShell = CreateObject("WScript.Shell")

objShell.Run("netsh firewall add allowedprogram program = " & strPath & "\GROOVE.EXE name = 'Microsoft Office Groove' mode = ENABLE profile = ALL")
Wscript.Sleep 1500
WScript.Quit

James
Member

Registered: 1st Jun 02
Location: Surrey
User status: Offline
18th Oct 07 at 22:47   View User's Profile U2U Member Reply With Quote

objShell isnt a function its an object, pretty sure those last two lines should be objShell.Sleep and objShell.Quit too.

But apart from that, providing there aren't any syntax errors, the above should work.

[Edited on 18-10-2007 by James]
Richie
Member

Registered: 3rd Dec 02
Location: Newport, Wales
User status: Offline
18th Oct 07 at 23:05   View User's Profile U2U Member Reply With Quote

Manged to get it working using this in the end (didnt need groove or onenote either)

Dim oShell

Set oShell = WScript.CreateObject ("WSCript.shell")

oShell.run "cmd /K""netsh firewall add allowedprogram program= ""C:\Program Files\Microsoft Office\Office12\OUTLOOK.EXE"" ""Microsoft Office Outlook 2007"" profile = ALL & exit """""""

Set oShell = nothing

 
New Topic

New Poll

  Related Threads Author Forum Replies Views Last Post
Converting wav. midi. file to MP3. Rhino General Chat 4 625
27th Sep 04 at 22:11
by Rhino
 
Has Anyone Got A Nokia 6630? iceman Geek Day 30 1010
15th Feb 05 at 13:49
by iceman
 
Batch file writing Skinz Geek Day 3 676
6th Jul 05 at 11:32
by loafofbrett
 
Autorun/Commands Dan Lewis Geek Day 2 396
20th Oct 06 at 13:18
by almost_me
 
File Converting K5-KYL Geek Day 11 346
31st Aug 07 at 20:43
by K5-KYL
 

Corsa Sport » Message Board » Off Day » Geek Day » Need to convert a batch file into VBScript 28 database queries in 0.0121951 seconds