View Single Post
Old 10-20-2020, 12:30 PM
samky2005 samky2005 is offline
Registered User
Join Date: Feb 2010
Posts: 12
save in the text file


I was able to use ReadString() to capture the output of "show running-config" command and save it into the file using objFile.WriteLine.
However the very first line in the text file included the command.
Is there way not to include the command in the text file?

  Dim objTab, szCommand

  Set objTab = crt.GetScriptTab
  szCommand = "show cur"
  objTab.Screen.Send szCommand & chr(13)
  objTab.Screen.WaitForString vbCr 
  Dim strResult, objFile
  strResult = objTab.Screen.ReadString ("return",3)
  Set objFile = g_fso.OpenTextFile("c:\temp\config_sample.txt", ForWriting, True)
  objFile.WriteLine strResult

Thank you

Last edited by cboyack; 10-20-2020 at 12:50 PM. Reason: Please use [CODE] and [/CODE] tags to denote code strings