Autorun edit on batch

Closed
Mridul - Sep 20, 2008 at 01:18 PM
 Sen - Mar 9, 2009 at 10:09 AM
Hello,
i want know ,how can i create a batch file which edit autorun file in every drive.thanks to all..

1 response

Hi Mridul

You can use biterscripting for batch and automated editing of files.

Let's say you want to insert the first line to file A.bat on drives X:/, Y:/, and Z:/.
The line to be inserted is "THIS IS A COMMENT".

The following script in biterscripting will do the job.

var str drivelist ; set $drivelist = "X:/\tY:/\tZ:/"
while ($drivelist <> "")
do
  # Get the next drive and create the file name by appending A.bat .
  var str file, drive ; wex "1" $drivelist > $drive ; set $file = $drive+"A.bat"

  # Insert the first line into this bat file.
  var str content ; cat $file > $content
  lin "1" "THIS IS A COMMENT\n" $content > $content
  echo $content > { echo $file }
done


You can download biterscripting at http://www.biterscripting.com . It is free. I like it a lot, since you can automate a lot of such activities without having to manually open each drive, each file, type in the text, etc.

Hope this helps.
0