0

I have a weird requirements thanks to a new vendor programming change.

We setup DNS records automaticly using the dnscmd.exe program in C:\windows\system32.

The vendor has made a change now restricting us to running scripts located within a specific directory (not the system32).

I need a VBscript that can execute C:\windows\system32\dnscmd.exe and have me dynamically supply the switches.

EX: i can do

dnscmd.vbs /recordadd blahblah blah
dnscmd.vbs /recorddelete blahblah blah
  • See [this](http://stackoverflow.com/questions/298562/windows-xp-or-vista-how-can-i-run-a-batch-file-in-the-background-no-windows-di/298564#298564) post for an example of collecting switches (args) and passing them to another app that you can run with the `Run` method of the `Shell` object. – Bond Feb 26 '14 at 01:52

1 Answers1

0

Here you go:

Dim oShell : Set oShell = WScript.CreateObject ("WScript.Shell")
'separate commands by "&" symbols
dim commands(1)
commands(0) = "dnscmd.exe /recordadd blahblah blah"
commands(1) = "dnscmd.exe /recorddelete blahblah blah"

'....continue....

oShell.run "cmd /K CD C:\windows\system32\ & " join(commands, " & ")
Set oShell = Nothing
Rich
  • 3,751
  • 2
  • 23
  • 43