trouble using megacmd command line utilities in my script

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
douteigami
Posts: 1
Joined: 17 Mar 2019 19:53

trouble using megacmd command line utilities in my script

#1 Post by douteigami » 17 Mar 2019 20:08

hello, i'm working on something that automates a few tasks when i drag a folder to the program, it renames the .png image files alphanumerically counting up from 01, compresses them, archives them in zip/rar, and then uploads to my mega.nz folder. it's using advanced renamer for renaming, optipng for compression, winrar's rar.exe for archiving, and megacmd for uploading. the first three programs i have installed in a folder called scanmate, and the batch file and scanmate folder are also both in the same directory.

i have the first three portions working fine, they aren't causing me problems but i'll include them, maybe someone else can use them in the future:

%cd%\scanmate\advanced_renamer_portable\arenc.exe -e %cd%\scanmate\alphanumeric-to-numeric.aren -t files -p "%1" -msk "*.png" -o filename -m rename
for /r "%1" %%a in (*.png) do (%cd%\scanmate\optipng\optipng.exe -force -v -o2 "%%a")
<choice here for either zip/rar formats for %archiveformat%, and a set /p decides the %archivename%>
%cd%\scanmate\winrar\rar.exe a -r %1\%archivename%.%archiveformat% %1\*.png


the last part, uploading to mega.nz, they have command line tool called "megacmd", and including megacmdshell.exe in my batch brings up an interactive mode where i can then enter
login username password
cd /mymegafolder/
put %1\%archivename%.%archiveformat%

doing so will upload the archivename.rar/zip to /mymegafolder/. this last part i can do manually, but i'm trying to automate things, so this requires megacmdserver.exe instead of megacmdshell.exe, but when that's started in my batch file it's not interactive, i can't even enter commands, and i can't figure out how to pass those commands within my batch file to it.

i realize this question is more geared for this particular megacmd program, instead of batch scripting in general, but i don't know if it's just something simple i don't understand.

thanks, hopefully this question isn't bad. i recently started learning batch scripting and referenced this site a lot, so that's why i came to post my question here.

Post Reply