I have to write a batch file to download a .exe application and I am finding it very difficult to make sense of the whole process.
All I have got done so far is;
start /d C:"\Program Files <x86>\Google\Chrome\Application"
chrome.exe http://website/directory
This brings up the page I want to go to and the .exe file is on this page, but I don'y know how to download it, I tried;
start /d C:"\Program Files <x86>\Google\Chrome\Application"
chrome.exe http://website/directory/download.exe
This was no good, it tried to load the page, while I thought it would just download the file.
If anyone can give me some insight into this, it would be great
Do not use chrome. Depending on the tools you can rely on, use for example wget or curl. For documentation, have a look at the project's homepages (wget, curl), basic invokation is easy:
wget -o outfile http://example.com/url/to/file
curl -o outfile http://example.com/url/to/file
You may need to change:
http://www.
to
ftp://ftp.
It would help if you provided the actual internet file link.
Related
I have to download all files from a ftp folder using Explicit FTP over SSL/TLS. I need that for a jenkins job, running on a windows machine and didnt find any plugins - so I am trying to use a batch script with curl and the following code lists the contents of the folder.
set "$FILEPATH=C:\temp"
set "$REMOTEPATH=/files/"
curl -u user:pass --ftp-ssl ftp://hostame.com:port%$REMOTEPATH% -o %$FILEPATH%
I figured out that with curl I have to download files one by one, but how can I achieve to go through all the files in a ftp directory and get them one by one?
Is there a better way to achieve that? I read about mget, but it doesnt seem to work with the explicit ftp over ssl.
Thanks
I couldnt bring it to work with batch directly in the script, so I wrote a python script instead and download it from git and execute it as a step in the pypeline. It has some nice libraries, so it works as a charm.
I'm currently using a bat file in my shell:sendto folder that allows me to right click MKV files and open a cmd window that uses ffmpeg to change containers and produces an mp4 in the same directory as the source file. It works great, but I'd like to automate the process of deleting the original MKVs after (successfully) changing containers, and skipping the recycle bin if possible.
Right now my .bat file is like follows:
"C:\ffmpeg\bin\ffmpeg.exe" -i %1 -codec copy "%~n1.mp4"
I've looked it up already but could only find a similar question about batch processing an entire folder and without the sendto part, and I wasn't sure how to make that work for me.
So if someone could point me towards what to append to it to make it happpen, I'd appreciate it.
Thanks ! :)
I want to use a Batch file to upload files from a folder on my computer.
When I call the FTP Script to do the upload:
FTP -v -i -s:ftp.txt
or
FTP -v -i -s:c:\path\to\file\ftp.txt
Neither of those works, and instead
Error opening script file: ftp.txt
is returned.
Strange thing is, that the exact same script is being executed without problems on another computer.
Opening the batch file with admin-rights does not help. I'm running Windows 10.
Edit: The ftp.txt looks like this:
open ##host##
##user##
##password##
lcd c:\local\path\
cd path/on/server/
binary
mput "*.xxx"
disconnect
bye
Make a new, empty file with echo >ftp.test and try with that file.
If that gives you the same error, you'll need to look at your execution environment (look at set and the process owner of cmd.exe). It's also possible that the ftp command is being run as a user that doesn't have access to that file.
If you don't get an error then it's probably either a file-permissions or special-character issue with ftp.txt. Retyping the same content into a different file will get around those issues. Remember not to copy/paste because you could accidentally copy invisible special characters that you're trying to avoid.
I would like to add to this conversation since there have been a lot of views and no solution. I had the same response and it wasn't a permissions issue. It was also no the text file that was the issue because it never technically reached the text file. It was the path to the text file. The following for me didn't work. I had to put quotations around the path even though there were no spaces to confuse the command line.
What you tried:
FTP -v -i -s:c:\path\to\file\ftp.txt
What I tried and worked. (I didn't need to use -v, mine works without it)
FTP -i -s:"c:\path\to\file\ftp.txt"
Running the file acted normal for me. My issue was trying to run the batch file through Windows Task Manager. Somehow, this was causing it to lose the text file somehow. I hope this helps anyone else who reads this thread.
I had to put the .txt file path in the "Start In" section for it to work in Windows Task Manager. No problems since.
I am vaguely familiar with batch. Super light knowledge. Anyways, I have this program that runs in a command line mode (it happens to render minecraft maps).
It is normally used by opening cmd, and typing mapcrafter.exe -c config.config -j 8 which runs the exe, specifies the config file, and runs the job with 8 threads.
One thing I wanted to do was put all of this in a batch file so I didn't have to type everything in every time I wanted to re-render it. It looked like:
start cmd.exe /K mapcrafter.exe --config "config.config" --jobs 8
This worked great, when the batch file was in the same directory as the exe.
Anyways, what I don't know how to do is to:
Start command prompt
change directory (cd) to the folder containing the .exe
Run the .exe with the two (-c -j) parameters
I want to do all of this in one batch file, and I want it to keep the command prompt window open, since the .exe outputs errors and percent completion.
I'm lucky I was able to get the one-line batch file working, with my limited knowledge of batch. At this point, I'm out of ideas as to how I should approach this. Thank you in advance for any help you can offer!
Why don't you just create a batch file with
mapcrafter.exe --config "config.config" --jobs 8
The reason it doesn't work when it is not in the same directory is because your path variable doesn't have the location of mapcrafter. An easier way around would be to use full path something like
D:\MineCraft\mapcrafter.exe --config "config.config" --jobs 8
If you want to learn more about configuring PATH environment variable see
Adding directory to PATH Environment Variable in Windows
you could just make a shortcut of the .bat file and have that on your desktop or wherever you want it. here is Microsoft's support page on this http://support.microsoft.com/kb/140443
Currrently, I am running jmeter with this property to load my script for beanshell preprocessor.
<apache jmeter Bin directory>/bin/jmeter -Jbeanshell.preprocessor.init=D:/commons.bshrc
I need shortcut to lauch JMeter with argument. I would like to store this property somewhere and would be able to use the short cut to load the same file when jmeter is started.
Example : when I click on "apache-jmeter.jar" file from bin directory, it opens jmeter GUI. But it should also load the commons.bshrc file.
Is there any ways to do this?
You can create batch file:
#echo off
start /d "Java bin" -jar jmeter.jar -Jbeanshell.preprocessor.init=D:/commons.bshrc
Check out this wiki, about howto create batch file. http://www.wikihow.com/Write-a-Batch-File
Or you can easily edit your jmeter.bat file.