proper escaping with guestcontrol; Windows guest/Linux host
Posted: 24. Jun 2015, 23:46
Trying to write a little script that ensures our standard fonts are installed properly (we have had a couple corrupt font files, which is hard to detect by command line):
Unfortunately, my problem is with the last command. Something is amiss with the escaping. I didn't want the shell to interpret the double quotes or the backslashes, so I thought this would be the right escaping, but it simply doesn't work. Does anyone know how we are supposed to deal with the shell's special characters and passing them over properly? Surely someone else does registry editing via the command line???
BTW, Windows gives me back "Error: Bad operation. Use /? for help"
FWIW running Kubuntu 14.04.2 with Windows XP SP3 with VirtualBox 4.3.28-100309~Ubuntu~raring.
Code: Select all
#!/bin/bash
cd Fonts
for font in *; do
# remove old fonts
vboxmanage guestcontrol "XP" execute --image "c:\\windows\\system32\\cmd.exe" --username Admin --passwordfile pw --wait-stdout "/c del c:\\windows\\fonts\\${font}"
fontname="$(echo $font | awk -F '.' '{print $1}')"
# copy over new fonts
vboxmanage guestcontrol "XP" execute --image "c:\\windows\\system32\\cmd.exe" --username Admin --passwordfile pw --wait-stdout --wait-stderr "/c copy s:\\fonts\\${font} c:\\windows\\fonts"
# register new fonts
vboxmanage guestcontrol "XP" execute --image "c:\\windows\\system32\\reg.exe" --username Admin --passwordfile pw --wait-stdout --wait-stderr "add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts\" /v \"${fontname} (TrueType)\" /d ${font} /f"
done
BTW, Windows gives me back "Error: Bad operation. Use /? for help"
FWIW running Kubuntu 14.04.2 with Windows XP SP3 with VirtualBox 4.3.28-100309~Ubuntu~raring.