How to launch multiple applications from a sed file - sed

I have created a .sed file for input in iexpress.exe. The entry in .sed file has two applications. One is a batch file and another is an .exe file, for example:
AppLaunched=cmd.exe /c abc.bat
AppLaunched2=setup.exe
After creating the setup and executing, only the batch file is executed. I want to execute both files.
Any idea?

If I understand your problem correctly you could try using & to chain commands,
AppLaunched=cmd.exe /c abc.bat & setup.exe
There are a few other ways but this is one of the most simplistic.

Related

Powershell call a script from another scipt as if in a different folder

I use the video transcoding tools made by Don Melton over on GitHub to compress self filmed videos. Now I would like to automate this task by using a PowerShell script to loop over the contents of a folder as input arguments for the tool and have the output put into a seperate folder. My problem is that the tool is written in a way that it has no option to provide an output location, instead it always places the output files in the directory where it is called in. So when I cd into an "output" directory "next to" the one where my input files are, I then can call
other-transcode ../input/file.mp4
and the output file of the same name as the input file will be placed in the output directory.
Now when I want to use the command in a script, how do I tell PowerShell to run the command as if it was typed manually into a shell that was in the output directory at the moment?
For context, this is my end goal, but I think it is easier to split the complicated question into multiple ones.

PowerShell: Open file via .bat script

imagine I have a files with certain extensions (for example '.abc').
The default program I set for files with this special extension is a batch script with powershell commands in it, so when I doubleclick the file, it runs the script. It works.
Now my question is, can I somehow get the file path of the .'abc' file I opened? Is there a command for this?
Thank you.
Inside of your batch file it should be possible to access the ".abc" file via parameter %1.
Per default Windows sends the filename of the file you doubleclick to the receiving program (or batch script) as parameter one.
Try this inside of your batch file (near the top) and pick what suits your needs:
echo param1: %1
echo param1 unquoted: %~1
echo drive: %~d1
echo drive and path: %~dp1
echo filename and extension only: %~nx1
set myparam=%~1
echo myParam: %myparam%
See the help documentation of for for the "%~..." syntax by executing for /? in a cmd.exe command window. (Or read here: What does %~dp0 mean, and how does it work?)

How to upload a lot of files at once using FileZilla (possibly using a file containing the list of files to publish)?

Is there a way, using FileZilla, to publish many files at once (currently I have to choose them one by one every time, because they can be in different directories and I can't publish the whole directory)?
The ideal solution I am looking for is to use a single .txt file where I can paste the list of paths I want to publish and then somehow tell FileZilla to use it and publish each file to the remote server.
FileZilla lets you export the list of the files you have published with File -> Export in XML format. I am looking for something like this but I need to do the opposite operation.
If someone has some insights on it, please share them with me. Thanks!
P.S.: currently, I also use NetBeans IDE and publish files with it by clicking with the right button of the mouse and selecting Upload. If there's a way to do the same with NetBeans, that would be great (I write PHP code).
Thanks for the attention.
FileZilla does not allow any kind of automation.
See How do I send a file with FileZilla from the command line?
But you can use any other command-line FTP client.
For example WinSCP FTP client has Uploading a list of files example that exactly covers your task:
You may use following batch file that calls WinSCP script:
#echo off
set SESSION=ftp://user:password#example.com/
set REMOTE_PATH=/home/user/
echo open %SESSION% >> script.tmp
rem Generate "put" command for each line in list file
for /F %%i in (list.txt) do echo put "%%i" "%REMOTE_PATH%" >> script.tmp
echo exit >> script.tmp
winscp.com /script=script.tmp
set RESULT=%ERRORLEVEL%
del script.tmp
rem Propagating WinSCP exit code
exit /b %RESULT%

Read Arguments From CMD and Concatenate Strings in Bat File

I have the following code in my bat file which saved as MyLM.bat:
#echo off
matlab -automation -r "addpath('C:\Users\mojtaba\BrainModel');AddPathes;MyLM('MT5Test_LM')" > matlab_output.log
exit
In which i simply add the main path and then necessary paths and then i run my function (Which is MyLM). I am running the following code from my matlab command prompt :
!start "MATLAB test" /Min /B MyLM.bat
and it works fine and i am happy! So i can run different instances of matlab separately using different bat files. What will makes me happier is that i can pass my argument (which is 'MT5Test_LM') from matlab command prompt. So i dont need to save different bat files. What i actually need is to have some code like this :
!start "MATLAB test" /Min /B MyLM.bat 'MT5Test_LM'
then i need some piece of codes in my bat file to read this argument and concatenate some strings.
Is there any suggestion?
Have you tried using the input argument of the batch file (%1)?
See, e.g., this manual on batch file input argument.
You might want your bathc file to look like
matlab -r "myLM( %1 )"

Passing Parameters/Argument to FTP filename from DOS

I am calling a FTP file from DOS, which holds ftp set of commands as follows:
ftp -s:ftpcmd1.txt
Now, the change requirement says, file is to be called multiple times with different file paths.
so, I need to write above statement, each time passing new file path as argument with FTP filename and writing something like "%1" in command inside ftp-file. Please help me with same. How do I do it.
Thanks.
I dont know if we can pass parameter to ftp script (atleast in DOS). But in the above case dynamically written out ftp script file would help. Small bat file which would do that is like below.
echo "user username pwd">ftpcmd1.txt
echo "bin">>ftpcmd1.txt
echo "put %1">>ftpcmd1.txt
echo "bye">>ftpcmd1.txt
ftp -n -i -v servername<ftpcmd1.txt
If you call this bat file with any file name as the first command line argument, it would transfer the file to target servername. Hope this is what you are looking for.