Expect script – Read / write file

Thanks to this source : http://wiki.tcl.tk/367

To read data from a file in an Expect script:

#!/usr/bin/expect -f

set fd "input.txt"
set fp [open "$fd" r]
set data [read $fp]

# Read line by line

foreach line $data {

puts "$line\r"


And to write data to a file:

#!/usr/bin/expect -f

set outputFilename "output.txt"
set outFileId [open $outputFilename "w"]

puts -nonewline $outFileId "A first line\n"
puts -nonewline $outFileId "A second line\n"

#Close file descriptor to ensure data are flush to file
close $outFileId

Windows – Install many software in a simple command line

Chocolatey NuGet allow you to install software with a simple command line.

Easy install

Open a terminal and enter the following command.
Check the Chocolatey NuGet website to get the last version

@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin

You can now install a lot of software using a easy command

choco install git