meganz / MEGAcmd

Command Line Interactive and Scriptable Application to access MEGA
Other
1.94k stars 407 forks source link

Megacmd portable installation #681

Open kentzversky opened 2 years ago

kentzversky commented 2 years ago

Hi, all! Thanks for a nice program, we are using widely. Sorry if it's not the right place to post my question.

I want to run MegaCmd from a USB flash drive within any Windows computer I connect to. Even those who doesn't have MegaCmd installed. So I copy C:\ProgramFiles\MEGAcmd folder to my flash drive and try to run:

@echo off
cd /d "%~dp0"
set PATH=%~dp0;%PATH%
echo %PATH%
MegaClient.exe version

I'm getting error:

M:\Crosses\Tools\Mega\MEGAcmd\;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windo.... /skipped/
MEGAcmd Server not running. Initiating in the background...
Unable to execute: C:\Users\Z\AppData\Local\MEGAcmd\MEGAcmdServer.exe errno = : 3

So it seems the only option for MEGAcmdServer.exe is to be located in AppData folder. Is there any chance to launch the server in BACKGROUND from a different location for non-interactive sessions? Or tell MegaClient.exe where the server executable is located somehow?

Thanks.

polmr commented 2 years ago

MEGAclient.exe (aka non-interactive client), will try to access the server and execute it otherwise. That path is hardcoded, so that mechanism won't work if MEGAcmd is not properly installed.

However, you can launch MEGAcmdServer.exe directly, and then execute MEGAclient.exe (or the shell) once the server is up and running.

kentzversky commented 2 years ago

Thanks for your reply, polmr!

However, you can launch MEGAcmdServer.exe directly

Yes, that's the solution I'm using for a moment. Can you kindly clarify how do I launch MEGAcmdServer.exe in background?

kentzversky commented 2 years ago

Hello? Anybody?

polmr commented 2 years ago

From a powershell

start-process powershell -ArgumentList "& c:\path\to\MEGAcmdServer.exe" -WindowStyle hidden

This should do

kentzversky commented 2 years ago

Thank you so much!