VBScript help: Re batch file and wildcard

Code with C | Programming: Projects & Source Codes Forums Visual Basic Classic VBScript help: Re batch file and wildcard

This topic contains 2 replies, has 1 voice, and was last updated by  Adan 2 years, 7 months ago.

  • Author
  • #10677


    Given this bit of vbs code:

    How can I make it so that I can use a wildcard (*.*), rather than test.txt as in the above? I have several different files I need to write a bit of text to, note not all are text files just for your info.

    I know I can use a batch file to do this, but I am going with vbs for it will contain vb specific code that I cannot spend alot of time trying to modify it then the result will be against what I am originally looking for.

  • #10678


    You need to get a list of files in the directory/directories that you want and then loop through the writing function with each of the files.


  • #10679


    I figured out how to recurse through a folder, but to write to all files in the folder I can’t find out how to do that. If I put a wildcard like *.js or *.php it don’t work, I get a bad filename or number error, if I remove the wildcard and replace that with the actual name, it will work. Any other suggestions?

You must be logged in to reply to this topic.