[Samsung Galaxy Nexus] gaglax:
this is a permanent solution.

only if you wipe via cwm you have to replace the files or rerun the script.

if you just turn off your phone and on again the sim unlock is permanent.

i stripped the code to the following.

just copy and paste the code, save it to simunlock.cmd.

make sure you set the correct path in the following line:

set sdk="c:\Program Files\Android\android-sdk\platform-tools\adb.exe"

run, hit any key a few times and wait for reboot ;-)

echo on
title Galaxy Nexus GSM Unlock

pause
cls

REM set your path to adb.exe here
set sdk="c:\Program Files\Android\android-sdk\platform-tools\adb.exe"
echo using adb.exe: %sdk%

echo basic pretasks:
%sdk% root

%sdk% shell su -c "mount -oremount,rw /dev/block/mtdblock3 /system"
%sdk% shell su -c "mount -oremount,rw /dev/block/mtdblock3 /mnt/sdcard"
%sdk% shell su -c "mount -oremount,rw /dev/block/mtdblock3 /factory"
%sdk% shell su -c "mount -oremount,rw /dev/block/mtdblock3 /data"
%sdk% shell su -c "mount -oremount,rw /dev/block/mtdblock3 /"
%sdk% shell su -c "chmod 777 /data"
%sdk% shell su -c "chmod 777 /factory/nv.log"
%sdk% shell su -c "chmod 777 /factory/nv_data.bin"
%sdk% shell su -c "chmod 777 /factory/nv_data.bin.md5"
%sdk% shell su -c "chmod 777 /data/radio/nv_data.bin.md5"
%sdk% shell su -c "chmod 777 /data/radio/nv_data.bin"
%sdk% shell su -c "rm /tmp00"
%sdk% shell su -c "rm /tmpff"
%sdk% shell su -c "rm /data1"
%sdk% shell su -c "rm /data2"
%sdk% shell su -c "rm /data3"
%sdk% shell su -c "rm /mnt/sdcard/nv_data_mod/unlock/nv_data.bin"
%sdk% shell su -c "rm /mnt/sdcard/nv_data_mod/unlock/nv_data.bin.md5"

PAUSE

echo unlocking:

%sdk% shell su -c "echo 'SC-04D nv_data.bin backup + sim unlock'"
%sdk% shell su -c "mkdir /mnt/sdcard/nv_data_mod/ "
%sdk% shell su -c "mkdir /mnt/sdcard/nv_data_mod/factory"
%sdk% shell su -c "mkdir /mnt/sdcard/nv_data_mod/unlock"
%sdk% shell su -c "mkdir /data/radio"
%sdk% shell su -c "cp /factory/nv_data.bin /mnt/sdcard/nv_data_mod/factory/nv_data.bin"
%sdk% shell su -c "cp /factory/nv_data.bin.md5 /mnt/sdcard/nv_data_mod/factory/nv_data.bin.md5"
%sdk% shell su -c "cd /mnt/sdcard/nv_data_mod/ "
%sdk% shell su -c "echo -en \\x00 > tmp00 "
%sdk% shell su -c "dd if=./factory/nv_data.bin of=./tmpff bs=1 count=30 skip=16 "
%sdk% shell su -c "dd if=./factory/nv_data.bin of=./data1 bs=1 count=1572969 "
%sdk% shell su -c "dd if=./factory/nv_data.bin of=./data2 bs=1 skip=1572999 count=5090 "
%sdk% shell su -c "dd if=./factory/nv_data.bin of=./data3 bs=1 skip=1578090 "
%sdk% shell su -c "cat data1 tmpff data2 tmp00 data3 > /mnt/sdcard/nv_data_mod/unlock/nv_data.bin "
%sdk% shell su -c "md5sum /mnt/sdcard/nv_data_mod/unlock/nv_data.bin | tr '\n' 'X' | sed 's/ .*//' > /mnt/sdcard/nv_data_mod/unlock/nv_data.bin.md5 "
%sdk% shell su -c "od -x ./factory/nv_data.bin > factory.dmp "
%sdk% shell su -c "od -x /mnt/sdcard/nv_data_mod/unlock/nv_data.bin > unlock.dmp"

%sdk% shell su -c "rm /factory/nv_data.bin"
%sdk% shell su -c "rm /factory/nv_data.bin.md5"
%sdk% shell su -c "rm /data/radio/nv_data.bin"
%sdk% shell su -c "rm /data/radio/nv_data.md5"
%sdk% shell su -c "rm /data/radio/nv_data.bin.md5"
%sdk% shell su -c "rm /tmp00"
%sdk% shell su -c "rm /tmpff"
%sdk% shell su -c "rm /data1"
%sdk% shell su -c "rm /data2"
%sdk% shell su -c "rm /data3"

%sdk% shell su -c "cp /mnt/sdcard/nv_data_mod/unlock/nv_data.bin /factory/nv_data.bin"
%sdk% shell su -c "cp /mnt/sdcard/nv_data_mod/unlock/nv_data.bin.md5 /factory/nv_data.bin.md5"
%sdk% shell su -c "cp /mnt/sdcard/nv_data_mod/unlock/nv_data.bin /data/radio/nv_data.bin"
%sdk% shell su -c "cp /mnt/sdcard/nv_data_mod/unlock/nv_data.bin.md5 /data/radio/nv_data.bin.md5"

%sdk% shell su -c "chmod 777 /factory/nv.log"
%sdk% shell su -c "chmod 777 /factory/nv_data.bin"
%sdk% shell su -c "chmod 777 /factory/nv_data.bin.md5"
%sdk% shell su -c "chmod 777 /data/radio/nv_data.bin.md5"
%sdk% shell su -c "chmod 777 /data/radio/nv_data.bin"

echo press any key to reboot
PAUSE

%sdk% shell su -c "reboot"

EXIT