Index: /trunk/doc/manual/en_US/user_VBoxManage.xml
===================================================================
--- /trunk/doc/manual/en_US/user_VBoxManage.xml	(revision 42444)
+++ /trunk/doc/manual/en_US/user_VBoxManage.xml	(revision 42445)
@@ -1394,12 +1394,13 @@
         <listitem>
           <para><computeroutput>VBoxManage controlvm &lt;vm&gt; teleport
-          --hostname &lt;name&gt; --port &lt;port&gt; [--password
-          &lt;password&gt;]</computeroutput> makes the machine the source of a
-          teleporting operation and initiates a teleport to the given target.
-          See <xref linkend="teleporting" /> for an introduction. If the
-          optional password is specified, it must match the password that was
-          given to the <computeroutput>modifyvm</computeroutput> command for
-          the target machine; see <xref
-          linkend="vboxmanage-modifyvm-teleport" /> for details.</para>
+          --hostname &lt;name&gt; --port &lt;port&gt; [--passwordfile
+          &lt;file&gt; | --password &lt;password&gt;]</computeroutput> makes
+          the machine the source of a teleporting operation and initiates a
+          teleport to the given target. See <xref linkend="teleporting" /> for
+          an introduction. If the optional password is specified, it must match
+          the password that was given to the
+          <computeroutput>modifyvm</computeroutput> command for the target
+          machine; see <xref linkend="vboxmanage-modifyvm-teleport" /> for
+          details.</para>
         </listitem>
       </itemizedlist></para>
@@ -2603,10 +2604,10 @@
 
           <screen>VBoxManage guestcontrol &lt;vmname&gt;|&lt;uuid&gt; exec[ute]
-            --image &lt;path to program&gt;
-            --username &lt;name&gt; [--password &lt;password&gt;]
-            [--dos2unix]
+            --image &lt;path to program&gt; --username &lt;name&gt;
+            [--passwordfile &lt;file&gt; | --password &lt;password&gt;]
             [--environment "&lt;NAME&gt;=&lt;VALUE&gt; [&lt;NAME&gt;=&lt;VALUE&gt;]"]
-            [--timeout &lt;msec&gt;] [--unix2dos] [--verbose]
+            [--verbose] [--timeout &lt;msec&gt;]
             [--wait-exit] [--wait-stdout] [--wait-stderr]
+            [--dos2unix] [--unix2dos]
             -- [[&lt;argument1&gt;] ... [&lt;argumentN&gt;]]</screen>
 
@@ -2636,4 +2637,14 @@
                   <para>Name of the user the process should run under. This
                   user must exist on the guest OS.</para>
+                </glossdef>
+              </glossentry>
+
+              <glossentry>
+                <glossterm>--passwordfile &lt;file&gt;</glossterm>
+
+                <glossdef>
+                  <para>Password of the user account specified to be read from
+                  the given file. If not given, an empty password is
+                  assumed.</para>
                 </glossdef>
               </glossentry>
@@ -2758,6 +2769,6 @@
               information.</para>
             </note> Examples: <screen>VBoxManage --nologo guestcontrol "My VM" execute --image "/bin/ls"
-          --username foo --password bar --wait-exit --wait-stdout -- -l /usr</screen> <screen>VBoxManage --nologo guestcontrol "My VM" execute --image "c:\\windows\\system32\\ipconfig.exe"
-          --username foo --password bar --wait-exit --wait-stdout</screen> Note that
+          --username foo --passwordfile bar.txt --wait-exit --wait-stdout -- -l /usr</screen> <screen>VBoxManage --nologo guestcontrol "My VM" execute --image "c:\\windows\\system32\\ipconfig.exe"
+          --username foo --passwordfile bar.txt --wait-exit --wait-stdout</screen> Note that
           the double backslashes in the second example are only required on
           Unix hosts.</para>
@@ -2794,6 +2805,6 @@
 
           <screen>VBoxManage guestcontrol &lt;vmname&gt;|&lt;uuid&gt; copyto|cp
-            &lt;source on host&gt; &lt;destination on guest&gt;
-            --username &lt;name&gt; [--password &lt;password&gt;]
+            &lt;guest source&gt; &lt;host dest&gt; --username &lt;name&gt;
+            [--passwordfile &lt;file&gt; | --password &lt;password&gt;]
             [--dryrun] [--follow] [--recursive] [--verbose]</screen>
 
@@ -2838,4 +2849,14 @@
 
               <glossentry>
+                <glossterm>--passwordfile &lt;file&gt;</glossterm>
+
+                <glossdef>
+                  <para>Password of the user account specified to be read from
+                  the given file. If not given, an empty password is
+                  assumed.</para>
+                </glossdef>
+              </glossentry>
+
+              <glossentry>
                 <glossterm>--password &lt;password&gt;</glossterm>
 
@@ -2894,4 +2915,11 @@
 
         <listitem>
+          <para><computeroutput>copyfrom</computeroutput>, which allows copying
+          files from the guest to the host (only with installed Guest
+          Additions 4.0 and later). It has the same parameters as
+          <computeroutput>copyto</computeroutput> above.</para>
+        </listitem>
+
+        <listitem>
           <para><computeroutput>createdirectory</computeroutput>, which allows
           copying files from the host to the guest (only with installed Guest
@@ -2899,6 +2927,6 @@
 
           <screen>VBoxManage guestcontrol &lt;vmname&gt;|&lt;uuid&gt; createdir[ectory]|mkdir|md
-            &lt;directory to create on guest&gt;
-            [--username "&lt;name&gt;"] [--password "&lt;password&gt;"]
+            &lt;guest directory&gt;... --username &lt;name&gt;
+            [--passwordfile &lt;file&gt; | --password &lt;password&gt;]
             [--parents] [--mode &lt;mode&gt;] [--verbose]</screen>
 
@@ -2936,4 +2964,14 @@
 
               <glossentry>
+                <glossterm>--passwordfile &lt;file&gt;</glossterm>
+
+                <glossdef>
+                  <para>Password of the user account specified to be read from
+                  the given file. If not given, an empty password is
+                  assumed.</para>
+                </glossdef>
+              </glossentry>
+
+              <glossentry>
                 <glossterm>--password &lt;password&gt;</glossterm>
 
@@ -2985,6 +3023,6 @@
 
           <screen>VBoxManage guestcontrol &lt;vmname&gt;|&lt;uuid&gt; stat
-            &lt;file element(s) to check on guest&gt;
-            [--username "&lt;name&gt;"] [--password "&lt;password&gt;"]
+            &lt;file&gt;... --username &lt;name&gt;
+            [--passwordfile &lt;file&gt; | --password &lt;password&gt;]
             [--verbose]</screen>
 
@@ -3015,4 +3053,14 @@
                   <para>Name of the user the copy process should run under.
                   This user must exist on the guest OS.</para>
+                </glossdef>
+              </glossentry>
+
+              <glossentry>
+                <glossterm>--passwordfile &lt;file&gt;</glossterm>
+
+                <glossdef>
+                  <para>Password of the user account specified to be read from
+                  the given file. If not given, an empty password is
+                  assumed.</para>
                 </glossdef>
               </glossentry>
Index: /trunk/src/VBox/Frontends/VBoxManage/VBoxManageControlVM.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxManage/VBoxManageControlVM.cpp	(revision 42444)
+++ /trunk/src/VBox/Frontends/VBoxManage/VBoxManageControlVM.cpp	(revision 42445)
@@ -1152,5 +1152,5 @@
             uint32_t    uPort        = UINT32_MAX;
             uint32_t    cMsTimeout   = 0;
-            Bstr        bstrPassword("");
+            Utf8Str     strPassword;
             static const RTGETOPTDEF s_aTeleportOptions[] =
             {
@@ -1158,6 +1158,7 @@
                 { "--hostname",          'h', RTGETOPT_REQ_STRING }, /** @todo remove this */
                 { "--maxdowntime",       'd', RTGETOPT_REQ_UINT32 },
-                { "--port",              'p', RTGETOPT_REQ_UINT32 }, /** @todo RTGETOPT_FLAG_MANDATORY */
-                { "--password",          'P', RTGETOPT_REQ_STRING },
+                { "--port",              'P', RTGETOPT_REQ_UINT32 }, /** @todo RTGETOPT_FLAG_MANDATORY */
+                { "--passwordfile",      'p', RTGETOPT_REQ_STRING },
+                { "--password",          'W', RTGETOPT_REQ_STRING },
                 { "--timeout",           't', RTGETOPT_REQ_UINT32 },
                 { "--detailed-progress", 'D', RTGETOPT_REQ_NOTHING }
@@ -1175,6 +1176,13 @@
                     case 'd': uMaxDowntime  = Value.u32; break;
                     case 'D': g_fDetailedProgress = true; break;
-                    case 'p': uPort         = Value.u32; break;
-                    case 'P': bstrPassword  = Value.psz; break;
+                    case 'P': uPort         = Value.u32; break;
+                    case 'p':
+                    {
+                        RTEXITCODE rcExit = readPasswordFile(Value.psz, &strPassword);
+                        if (rcExit != RTEXITCODE_SUCCESS)
+                            rc = E_FAIL;
+                        break;
+                    }
+                    case 'W': strPassword   = Value.psz; break;
                     case 't': cMsTimeout    = Value.u32; break;
                     default:
@@ -1189,5 +1197,5 @@
             ComPtr<IProgress> progress;
             CHECK_ERROR_BREAK(console, Teleport(bstrHostname.raw(), uPort,
-                                                bstrPassword.raw(),
+                                                Bstr(strPassword).raw(),
                                                 uMaxDowntime,
                                                 progress.asOutParam()));
Index: /trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp	(revision 42444)
+++ /trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp	(revision 42445)
@@ -224,5 +224,5 @@
                  "                            exec[ute]\n"
                  "                            --image <path to program> --username <name>\n"
-                 "                            --passwordfile <file> | --password <password>\n"
+                 "                            [--passwordfile <file> | --password <password>]\n"
                  "                            [--environment \"<NAME>=<VALUE> [<NAME>=<VALUE>]\"]\n"
                  "                            [--verbose] [--timeout <msec>]\n"
@@ -235,20 +235,20 @@
                  "                            copyfrom\n"
                  "                            <guest source> <host dest> --username <name>\n"
-                 "                            --passwordfile <file> | --password <password>\n"
+                 "                            [--passwordfile <file> | --password <password>]\n"
                  "                            [--dryrun] [--follow] [--recursive] [--verbose]\n"
                  "\n"
                  "                            copyto|cp\n"
                  "                            <host source> <guest dest> --username <name>\n"
-                 "                            --passwordfile <file> | --password <password>\n"
+                 "                            [--passwordfile <file> | --password <password>]\n"
                  "                            [--dryrun] [--follow] [--recursive] [--verbose]\n"
                  "\n"
                  "                            createdir[ectory]|mkdir|md\n"
                  "                            <guest directory>... --username <name>\n"
-                 "                            --passwordfile <file> | --password <password>\n"
+                 "                            [--passwordfile <file> | --password <password>]\n"
                  "                            [--parents] [--mode <mode>] [--verbose]\n"
                  "\n"
                  "                            stat\n"
                  "                            <file>... --username <name>\n"
-                 "                            --passwordfile <file> | --password <password>\n"
+                 "                            [--passwordfile <file> | --password <password>]\n"
                  "                            [--verbose]\n"
                  "\n"
Index: /trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp	(revision 42444)
+++ /trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp	(revision 42445)
@@ -347,5 +347,6 @@
                      "                            [--autostart-enabled on|off]\n"
                      "                            [--autostart-delay <seconds>]\n"
-                     "                            [--autostop-type disabled|savestate|poweroff|acpishutdown]\n"
+                     "                            [--autostop-type disabled|savestate|poweroff|\n"
+                     "                                             acpishutdown]\n"
                      "\n");
     }
@@ -444,5 +445,7 @@
                      "                                           [--allowlocallogon <yes|no>] |\n"
                      "                            teleport --host <name> --port <port>\n"
-                     "                                   [--maxdowntime <msec>] [--password password]\n"
+                     "                                     [--maxdowntime <msec>]\n"
+                     "                                     [--passwordfile <file> |\n"
+                     "                                      --password <password>]\n"
                      "                            plugcpu <id>\n"
                      "                            unplugcpu <id>\n"
@@ -529,9 +532,12 @@
         RTStrmPrintf(pStrm,
                      "VBoxManage bandwidthctl     <uuid|vmname>\n"
-                     "                            add <name> --type disk|network --limit <megabytes per second>[k|m|g|K|M|G] |\n"
-                     "                            set <name> --limit <megabytes per second>[k|m|g|K|M|G] |\n"
+                     "                            add <name> --type disk|network\n"
+                     "                                --limit <megabytes per second>[k|m|g|K|M|G] |\n"
+                     "                            set <name>\n"
+                     "                                --limit <megabytes per second>[k|m|g|K|M|G] |\n"
                      "                            remove <name> |\n"
                      "                            list [--machinereadable]\n"
-                     "                            (limit units: k=kilobit, m=megabit, g=gigabit, K=kilobyte, M=megabyte, G=gigabyte)\n"
+                     "                            (limit units: k=kilobit, m=megabit, g=gigabit,\n"
+                     "                                          K=kilobyte, M=megabyte, G=gigabyte)\n"
                      "\n");
 
@@ -680,6 +686,8 @@
                      "                            getregisters [--cpu <id>] <reg>|all ... |\n"
                      "                            setregisters [--cpu <id>] <reg>=<value> ... |\n"
-                     "                            show [--human-readable|--sh-export|--sh-eval|--cmd-set] \n"
-                     "                                <logdbg-settings|logrel-settings> [[opt] what ...] |\n"
+                     "                            show [--human-readable|--sh-export|--sh-eval|\n"
+                     "                                  --cmd-set] \n"
+                     "                                <logdbg-settings|logrel-settings>\n"
+                     "                                [[opt] what ...] |\n"
                      "                            statistics [--reset] [--pattern <pattern>]\n"
                      "                            [--descriptions]\n"
Index: /trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp	(revision 42444)
+++ /trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp	(revision 42445)
@@ -2277,34 +2277,10 @@
             case MODIFYVM_TELEPORTER_PASSWORD_FILE:
             {
-                size_t cbFile;
-                char szPasswd[512];
-                int vrc = VINF_SUCCESS;
-                bool fStdIn = !strcmp(ValueUnion.psz, "stdin");
-                PRTSTREAM pStrm;
-                if (!fStdIn)
-                    vrc = RTStrmOpen(ValueUnion.psz, "r", &pStrm);
-                else
-                    pStrm = g_pStdIn;
-                if (RT_SUCCESS(vrc))
-                {
-                    vrc = RTStrmReadEx(pStrm, szPasswd, sizeof(szPasswd)-1, &cbFile);
-                    if (RT_SUCCESS(vrc))
-                    {
-                        if (cbFile >= sizeof(szPasswd)-1)
-                            errorArgument("Provided password too long");
-                        else
-                        {
-                            unsigned i;
-                            for (i = 0; i < cbFile && !RT_C_IS_CNTRL(szPasswd[i]); i++)
-                                ;
-                            szPasswd[i] = '\0';
-                            CHECK_ERROR(machine, COMSETTER(TeleporterPassword)(Bstr(szPasswd).raw()));
-                        }
-                    }
-                    if (!fStdIn)
-                        RTStrmClose(pStrm);
-                }
-                else
-                    errorArgument("Cannot open password file '%s' (%Rrc)", ValueUnion.psz, vrc);
+                Utf8Str password;
+                RTEXITCODE rcExit = readPasswordFile(ValueUnion.psz, &password);
+                if (rcExit != RTEXITCODE_SUCCESS)
+                    rc = E_FAIL;
+                else
+                    CHECK_ERROR(machine, COMSETTER(TeleporterPassword)(Bstr(password).raw()));
                 break;
             }
