Q:

batch or vbs - find file in random folder and write on it

I wish to realize a script which :
1) the script find a file with is name is "config.js" in a random directory
For example the file can be situated in "C:\1erg9r1f\config.js" or "C:\5rg9f26e\config.js". Or other randompaths...
2) When the script found the file, i wish automaticaly add 2 lines at the end of this file
2 lines to add in the file :
preferences.proxy: http://fw

preferences.proxy.https: https://fw

3) If the script finds the file in 2 folder, the script must add lines in theses 2 config.js files
Have you an idea to how i can realize this script?
Sorry for my bad English, I am French... lol :)

A:

for /d /r "c:\"  %%a in (*) do (
 if exist "%%~fa\config.js" (
  echo file found "%%~fa\config.js"
  (echo(preferences.proxy: http://fw)>>"%%~fa\config.js"
  (echo(preferences.proxy.https: https://fw)>>"%%~fa\config.js"
 )
)

But be prepared to wait a lot.  
If it the file only in first level folder on c: you can try also this (not tested):
pushd "c:\"
for /d %%a in ("*") do (
  if exist "%%~fa\config.js" (
      (echo(preferences.proxy: http://fw)>>"%%~fa\config.js"
      (echo(preferences.proxy.https: https://fw)>>"%%~fa\config.js"
 )
)

