This question already has answers here:
Windows batch file file download from a URL
(20 answers)
Closed 7 years ago.
I have a batch file, and I'd like to make a part of it save/download a file from a website...
eg.
example.com/file.jpg
This would then be saved to a location on my computer. Is there a way to do this? I've tried using the copy/xcopy/ROBOCOPY commands, but to no avail.
My operating system is Windows 8.1
You can use bitsadmin /? it's native in windows but not sure in windows8
bitsadmin.exe /transfer "JobName" http://download.url/here.exe C:\destination\here.exe
It is operating system specific. On POSIX systems, you might use curl or wget to download files; perhaps they exist on your OS (even if it not POSIX compliant, e.g. Windows, to which both utilities have been ported)
Both curl & wget are free software. You can download their source code, perhaps adapt it to your additional needs (I guess you won't have to do that, but who knows?), compile them into some executable, and run that executable on the command line.
Related
I am trying to compile .sh file from MATLAB on Windows. When I type mcc -m filename.m it generates .exe file but I would like to run it on Ubuntu server. Is it possible to make it on Windows?
The .sh file extension is typically used for shell scripts. Check the first line of your file. If it reads !#/bin/bash or so, you are looking at a shell script which has nothing to do with matlab. Instead, you may want to install cygwin to have the usual Linux/Unix shell programming environment available on windows.
In Unix/Linux we are having vi & cat command to view or edit a file. There are any alternative command to view/edit a file in windows command prompt.
Cygwin is a large collection of GNU and Open Source tools which provide functionality similar to a Linux distribution on Windows.
It includes both cat and vi.
It is possible to select which parts of Cygwin to install. See Installing and Updating Cygwin Packages for more instructions.
There is a edit on windows but it doesn't work on 64Bit machine. So alternate solution is given below.
Just download vim for windows from Here (direct download link), on the installation it will ask if you want to create shortcuts for calling it from the command line. Then you can just vim
For Windows, To view the filename use, Type filename
This question already has answers here:
Displaying Windows command prompt output and redirecting it to a file
(32 answers)
Closed 8 years ago.
I am trying to redirect both the standard out and standard error in a Windows batch file to the same file.
However I would like the standard error and user input prompts to be displayed in the console as well.
I tried the following:
Process_SVN_Repos.bat > Process_SVN_Repos.log 2>&1
However this causes the STD ERROR to go to
the file (which I want), but does not show up in console and hence I can not input any user required inputs because I don't see any user prompt.
So basically I am trying to:
Redirect all std out to a file.
Redirect all STD ERROR to the same file.
Also show the same STD ERROR on the console.
See the user prompt the application needs in the console and be able to input the user prompt.
You need a tee command for Windows. Here are few options:
Rob van der woude pure batch solution / ....
Dave Benham's jscript/bat hybrid
Tee by Microsoft - it's part of Unix services for Windows (after installation it's available in the BIN folder and has no exe extension) - For XP/Windows Server 2003 for Windows Vista, Windows 7, Windows 8, Windows Server 2008, and Windows Server 2012.
Command line co uk
UnixUtls
Windows doesn't have a tee command, so you can't. As Windows includes Unix you could use one of those shells. I don't know if it has tee, but it has 350 utilities.
If you are using a Unix environment then you can easily use the tee command. But since you are on Windows, it doesn't support you directly. But there are alternatives that you can use.
I have used Wintee for a similar task like yours. I suggest you use that small utility called wtee.exe. If that can't help your task there are other alternatives as well.
Our Apache web server works in a Linux environment.
The cgi executables are called via a sh file (for example /cgi-bin/iwsblogin.sh).
The call "/cgi-bin/iwsblogin.sh" is in an html file.
Now I want to make a development and testing environment for this web server on windows.
I do not want to change the calls in the html files from "iwsblogin.sh" to "iwsblogin.bat" just for testing purposes.
Is there a way to configure windows in such a way, that files with the extension ".sh" are treated as executables the same way as ".bat" and ".exe" files?
The contents of this .sh file is for example:
- ms dos commands for setting some environment variables.
- Path of an exe file which should be called.
I know that there exist similar questions on stackoverflow where user suggest using cygwin, but this is NOT an option for me!
Thanks alot in advance
There are some ways to do this.
If the .sh file works when you rename it to .bat, you can use "run as" and select C:\Windows\System32\cmd.exe as default program
Use a sh emulator. For example, msysgit includes one or you can use cygwin (possibly the same source?).
I know you don't want to use cygwin, but why not? Please explain why this isn't an option. It is hard to look for an answer if we don't know why regular answers won't work.
I dont really understand whats going on and cant see the difference:
I'm downloaded the base64.exe for creating base64 text under windows. i copied it to C:\Windows\ because its in the %PATH% variable.
Now i want to try it: echo Hello | base64 works great. Okay i dont need to append .exe and as far as i know i dont need to do it also with .bat and .com files.
But now i have some cygwin tools installed and for example tried which base64, which doesnt work, because it says that base64 is not in path. Then i typed in which base64.exe and got C:\Windows.
So my question is now: when i need to use .exe and when i dont? Is it only when i'm using cygwin tools that i need to append .exe?
Cygwin is a shell which emulates UNIX behaviour. UNIX doesn't know anything about .exe, thats why Cygwin can't find base64.exe. Under UNIX, binaries are stored without an extionsion added to their filename, e.g. just base64.
Windows CMD automatically appends .bat, .com, .exe and the like to your file names. Cygwin does not. So if you are using a linux shell you have to append it manually.
Since Cygwin is aware that it always runs under Windows it might append .exe if you want to perform certain actions in the shell itself (e.g. opening a file), to behave more friendyl to Windows users who expect this behaviour. However programs running under Cygwin might not integrate those features since they were mainly devoloped for usage under UNIX. That could be a reason why which base64 fails.