Shell/Batch
Batch files - the lost manual
Shell/BatchThings you always forget how to do in Windows batch files when you really really need them:
Change to the directory where the batch file is located
%0\ >NUL 2>&1
cd %0\.. >NUL 2>&1
cd /d %0\.. >NUL 2>&1
Check a registry entry
REG QUERY HKEY_LOCAL_MACHINE\SOFTWARE\TrendMicro\PC-cillinNTCorp\CurrentVersion /V Server > %TEMP%\trend.txt
FIND /i "newserver" %TEMP%\trend.txt > nul
If errorlevel 0 If Not errorlevel 1 goto raAlreadyMoved
echo Please wait. Moving to new server...
call servermove.bat
goto raTrendDone
:raAlreadyMoved
GIMP Corporate Windows install script
Shell/BatchThis is a short script useful to install GIMP and all its dependencies without further user intervention:
' This installs The GIMP and all dependencies (eg. GTK+) Option Explicit Const windowStyle = 8 ' Display as active app Dim result, oShell If result = VBNo Then oShell.run "gtk+-2.10.6-1-setup.exe /SP- /SILENT", windowStyle, True oShell.run "gimp-2.2.13-i586-setup-1.exe /SP- /SILENT", windowStyle, True ElseIf (result = VBYes) Then oShell.run "gtk+-2.10.6-1-setup.exe /SP- /SILENT", windowStyle, True oShell.run "gimp-2.2.13-i586-setup-1.exe /SP- /SILENT", windowStyle, True
yum-proxy
Shell/BatchThanks for coolmohitz for this idea. Copying this into your /usr/bin directory enables easy proxy authentication for yum without storing your Windows username and password anywhere in .bashrc:
#!/bin/bash
if [ "$PROXY" == "" ]
then
echo "PROXY environment variable not set. Set it now?"
read -e -p "proxy address and port: http://" PROXY
fi
read -e -p "proxy username: " username
read -es -p "proxy password: " password
export http_proxy="http://$username:$password@$PROXY"
export ftp_proxy="http://$username:$password@$PROXY"
echo ""
while [ "$yumcmd" != "exit" ]
do
echo "Type yum commands now ('exit' to terminate):"
read -e -p "(yum) " yumcmd
if [ "$yumcmd" != "exit" ]
then
yum $yumcmd
fi
done

