Running the command:
file run.sh
Gives me:
run.sh: Bourne shell script text executable
in Linux. Is there an equivalent command in Windows?
Running the command:
file run.sh
Gives me:
run.sh: Bourne shell script text executable
in Linux. Is there an equivalent command in Windows?
It has a built-in file command in git-bash.exe
fileLink here https://github.com/nscaife/file-windows/releases
Or here https://github.com/julian-r/file-windows/releases
It is a command tool written in Go.
Similar to file command but cross-platform without any dependency.
Usage:
file <SOME_FILE>
As others have said, there's nothing built into Windows. If you'd like an alternative to the file ports, check out TrID. The developer also makes the analyzer available as both a Win32 DLL or a .NET Assembly.
There probably isn't one on your system by default. You could install the Cygwin tools suite (ports of GNU commands to the Win32 APIs). There used to also be the MKS Toolkit and another one whose name escapes me at the moment. MKS was commercial, Cygwin, of course was GNU/GPL, and the other won was eventually renamed (from OpenNT?) and later acquired by Microsoft and incorporated into some sort of MSDN suite for Win2K or Server 2003 or something like that.
For any of those you'd just run the 'file' command on your target files just as you would under UNIX. You might have to start them under the included UNIX-like shell (bash, for Cygwin, ksh or MKS Toolkit, and who knows what for the other one).
> file.exe inkscape inkscape: symbolic link to /e/AppData/Roaming/inkscape.
– Todd Partridge
Mar 02 '24 at 18:07
On Windows 10, you can now install Bash. Once that's installed, you'll have access to the same File command that Ubuntu uses. It might be a bit overkill to do all this just for the one command, but I find it quite useful.
If you want the file command without installing all of Cygwin, you can pick up a copy from the GnuWin project. It's an older build but still useful:
Not built-in; Windows uses file-extensions to determine file-type. I'm pretty sure that there's a port of file in Cygwin, though.
Try getting a copy of cmder.exe you can run without installing and it has nix commands built in. You can also add any additional commands you might want that will load into path on launch.
If you have WSL installed, you can simply use the file command on Windows file system folder /mnt/.
Example:
file /mnt/c/"Program Files"/Notepad++/notepad++.exe
The output will be something similar to:
/mnt/c/Program Files/Notepad++/notepad++.exe: PE32+ executable (GUI) x86-64, for MS Windows
Take a look at File.exe - a small program similar to the Unix / Linux file executable which can examine files, in this case it is designed to query an executable file and display the processor that the file was compiled to run on and any other details it can report on.
filecommand is not part of the Linux kernel per say. It's a package that's installed on most distributions by default. Windows doesn't have something like this. Most decisions there are taken based on file extensions rather that content. – Noufal Ibrahim Apr 18 '11 at 10:17