Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

vbscript

$
0
0

Wondering if someone would be kind enough to help

Is it possible to create a script which list all files in a folder which begin with a particular name, thereafter output the file names to a text file and then create registry key values based on the outputted file names ?

In terms of a vbscript, I have the following thus far ( in sections), but cannot

  • Figure out how to output file names which begin with a particular name or contain xyz
  • How to pass the file names as registry values ( in the WshShell.RegWrite  section below)
  • How to join the two sections in one script

Dim fso Dim ObjFolder Dim ObjOutFile Dim ObjFiles Dim ObjFile

Set fso = CreateObject("Scripting.FileSystemObject")

Set ObjFolder = fso.GetFolder("C:\JetInfo")

Set ObjOutFile = fso.CreateTextFile("C:\WindowsFiles.txt")

Set ObjFiles = ObjFolder.Files

For Each ObjFile In ObjFiles    ObjOutFile.WriteLine(ObjFile.Name & String(50 - Len(ObjFile.Name), " ")) Next

ObjOutFile.Close

Set WshShell = WScript.CreateObject("WScript.Shell")

WshShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Common\JetInfo", "INPUT FILE NAME HERE", "REG_EXPAND_SZ"


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>