- How can I download a file from the Internet via Command Prompt? [duplicate]
- 1 Answer 1
- Not the answer you’re looking for? Browse other questions tagged windows cmd or ask your own question.
- Linked
- Related
- Hot Network Questions
- Find windows OS version from command line
- Find OS Version and Service Pack number from CMD
- Check Windows version using WMIC command
- How do I set the version information for an existing .exe, .dll?
- 15 Answers 15
- Resource Hacker
- 1. Setup
- 2. Resources
- 3. Embed
- 4. Test
- How to get Windows version from command prompt or from PowerShell
- 6 Answers 6
- Assembly version from command line?
- 9 Answers 9
How can I download a file from the Internet via Command Prompt? [duplicate]
As mentioned in the title I need a command line that allows me to download a file in the background without installing any tool just cmd I found this one but it doesn’t work in the background and Need a confirmation
so how to make the magic happen? and is there another command that i need to add it to the above line like a confirmation !?
1 Answer 1
CMD doesn’t have a built-in download command. You can download a utility like wget, and get the file with
PowerShell, which is built into every version of Windows 7 and above, does have a built-in command for downloading in Invoke-Webrequest
You can invoke this in one line from CMD by using the following PowerShell.exe command line.
Not the answer you’re looking for? Browse other questions tagged windows cmd or ask your own question.
Linked
Related
Hot Network Questions
site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2021.4.16.39093
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.
Find windows OS version from command line
Windows has command line utilities that show us the version of the Windows OS running on the computer, including the service pack number. There are multiple CMD commands that help with finding this, you can pick the one that suits your need. Ver command can show you the OS version whereas Systeminfo command can additionally give you service pack, OS edition and build number etc.
Find OS Version and Service Pack number from CMD
As you can see above, ver command shows only OS version but not the service pack number. We can find service pack number as well with Systeminfo command. Systeminfo dumps lot of other information too, which we can filter out using findstr command.
This command works on XP, Vista and Windows 7 and on Server editions also. Find below example for Win7.
In case of Windows 7 SP1, the output would be slightly different as below.
If you want to print more details, then you can use just ‘OS’ in the findstr search pattern. See example below for Server 2008.
Check Windows version using WMIC command
Run the below WMIC command to get OS version and the service pack number.
Example on Windows 7:
If you want to find just the OS version, you can use ver command. Open command window and execute ver command. But note that this does not show service pack version.
This command does not show version on a Windows 7 system.
How do I set the version information for an existing .exe, .dll?
As part of our build process I need to set the version information for all of our compiled binaries. Some of the binaries already have version information (added at compile time) and some do not.
I want to be able to apply the following information:
- Company Name
- Copyright Notice
- Product Name
- Product Description
- File Version
- Product Version
All of these attributes are specified by the build script and must be applied after compilation. These are standard binaries (not assemblies) compiled with C++ Builder 2007.
How can I do this?
15 Answers 15
While it’s not a batch process, Visual Studio can also add/edit file resources.
Just use File->Open->File on the .EXE or .DLL. This is handy for fixing version information post-build, or adding it to files that don’t have these resources to begin with.
Unlike many of the other answers, this solution uses completely free software.
Firstly, create a file called Resources.rc like this:
Next, use GoRC to compile it to a .res file using:
(see my comment below for a mirror of GoRC.exe )
Then use Resource Hacker in CLI mode to add it to an existing .exe :
Or you could check out the freeware StampVer for Win32 exe/dll files.
It will only change the file and product versions though if they have a version resource already. It cannot add a version resource if one doesn’t exist.
rcedit is relative new and works well from the command line: https://github.com/atom/rcedit
There’s also an NPM module which wraps it from JavaScript and a Grunt task in case you’re using Grunt.
What about something like this?
There is this tool ChangeVersion [1]
List of features (from the website):
- command line interface
- support for .EXE, .DLL and .RES files
- update FileVersion and ProductVersion based on a version mask
- add/change/remove version key strings
- adjust file flags (debug, special, private etc)
- update project files ( .bdsproj | .bpr | .bpk | .dproj )
- add/change main application icon
- use ini file with configuration
- Windows Vista support (needs elevation)
- easy to integrate into a continuous build environment
Full Disclosure: I know the guy who wrote this tool, I used to work with him. But this also means that I know he makes quality software 😉
[1] the link is dead. There seems to be mirrored version at download.cnet.com.
I’m doing it with no additional tool. I have just added the following files to my Win32 app project.
One header file which defines some constants than we can reuse on our resource file and even on the program code. We only need to maintain one file. Thanks to the Qt team that showed me how to do it on a Qt project, it now also works on my Win32 app.
There are multiple tools, mentioned by many great answers, I’m going to pick one.
Resource Hacker
I downloaded latest version (5.1.7) from [AngusJ]: Resource Hacker. All the needed information can be found on that page (command line options, scripts, . ). In the following walkthrough I’m going to operate on 2 executables (lab rats) which (for obvious reasons) I’ve copied in my cwd:
- ResourceHacker.exe: I thought it would be interesting to operate on itself
- cmake.exe: random executable with no Version Info set (part of v3.6.3 installation on my machine)
Before going further, I want to mention that ResourceHacker has a funny terminal output, and the the following copy / paste fragments might generate a bit of confusion.
1. Setup
This is more like a preliminary step, to get acquainted with the environment, to show there’s no funky business going on, .
As seen, the executables are OK, they run fine, and here’s how their Details (that we care about) look like:
2. Resources
Resource files are text files that contain resources. A resource (simplified) has:
For more details check [MS.Docs]: About Resource Files. There are many tools (mentioned in existing answers) that facilitate resource file editing like:
- VStudio creates a default one when starting a new project
- One can create such a file manually
But, since it’s about Resource Hacker, and:
- It is able to extract resources from an existing executable
- It has resources embedded in it (as shown in the previous picture)
I’m going to use it for this step ( -action extract )
Next, In order for a resource to be embedded into an .exe (.dll, . ) it must be compiled to a binary form, which fits into the PE format. Again, there are lots of tools who can achieve this, but as you probably guessed I’m going to stick to Resource Hacker ( -action compile ).
In your case saving and editing the resource file won’t be necessary, as the file will already be present, I just did it for demonstrating purposes. Below it’s the resource file after being modified (and thus before being compiled).
3. Embed
This will also be performed by Resource Hacker ( -action addoverwrite ). Since the .exes are already copied I’m going to edit their resources in place.
As seen, I had to d a little trick (gainarie) as I can’t (at least I don’t think I can) modify the .exe while in use.
4. Test
This is an optional phase, to make sure that:
- The executables still work (they weren’t messed up in the process)
- The resources have been added / updated
How to get Windows version from command prompt or from PowerShell
But is there a way to get the exact version string using command line output similar to the one mentioned in the image?
The attached is the output of «winver» command from run. PS: I am looking for a batch or PowerShell command.
There are some alternates available to get the Windows version like this PowerShell command:
6 Answers 6
The following commands are is going to help you with that. If you need more information, just type in systeminfo:
The ver command shows something like this:
But in PowerShell (or Git Bash) you have to call it through the cmd command:
I found it somewhere, PowerShell:
To add to @Bonifacio ‘s answer:
Would be even better, because it returns only the ReleaseId value, which you could then pipe to a file. Especially useful if you have several hosts to deal with.
With system information you can only get the build with that value and go to Google to get the respective version.
However, one simple way is by searching the registry on the command line:
The reg query way suggested all output a little garbage.
Using a for loop with tokens will output clean information.
The tokens=3 refers to the third word from the original output.
You will need to double the % if running inside a bat file.
You can set the output as a variable by replacing echo %i with set build=%i
Also remember to escape ^ any special characters.
Lastly look at HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion for the string that has the required value. You may need to adjust the token count.
Assembly version from command line?
Is there a Microsoft tool to get the assembly version of a DLL file from a command line?
(I know that I can code my own tool.)
9 Answers 9
This is an area where PowerShell shines. If you don’t already have it, install it. It’s preinstalled with Windows 7.
Running this command line:
Note that LoadFrom returns an assembly object, so you can do pretty much anything you like. No need to write a program.
If you use mono and linux, try this:
For those, like I, who come looking for such a tool:
I used the selected answer until I got the following error Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context. for several assemblies
should work in those cases (probably all cases)
Wow this is bad considering things like old exploitable gdiplus.dll’s floating around.
My solution is simple. batch file programming.
This puts an nfo file in the same dir with the version
You can GET filever.exe, which can be downloaded as part of the Windows XP SP2 Support Tools package — only 4.7MB of download.
Get all the versions in a directory to a text file.