The "~" character is used in truncated directory/filenames. It appears because when you're running a batch file you are running it in an MS-DOS environment. DOS is designed to work with FAT 3.2 file system (if I'm right), which is why directories and files are accessed with the 8+3 character filename format.
eg.
If you have a directory called "Documents and Settings" on the root of your H.D.D (for arguments sake call it C:) then to access it you would type "cd c:\docume~1".
If you wanted to edit a text file called "thisistoolong.txt" then you would type, in a command prompt or DOS itself, "edit c:\thisisto~1.txt".
Also, the reason why your getting a syntax error for the set command is in the first line - SET /P %homedir%=Welches Verzeichnis soll gepackt werden?
..."homedir" is the actual variable and "%homedir%" is the reference to the variables data. So, in that line above, what your command interpreter is actually trying to do is prompt a user to set a totally different variable (whatever is stored inside homedir). Just remove the "%" signs before and after homedir in the SET lines and you'll be fine.
EDIT:
just noticed it was a number... numbers work like this..
Filename Special Words would go around here
(%0---------%1-----%2---%3-%4----%5--%6)
and can be used like this:
IF %1 == "Gary" THEN ECHO "You suck"
I didn't really understand that so I'm not sure our friend BlaStA will. Numbers preceeded with a "%" sign usually reference parameters passed to programs. Eg.
If you had a batch file (temp.bat) with this contents inside:
@echo off
cls
echo %1 %2 %3 %4 %5
...and you run it from your command prompt like this:
C:\Documents and Settings\#####\Desktop\> temp.bat Matthew Mark Luke John
Then you would get a clear screen then the words "Matthew Mark Luke John" printed out on your screen. %1 matches up with the first parameter passed to temp.bat and %2 with Mark etc.