I want to have an executable file that will call some other programs. The way I would do this in Linux is with a simple bash script that looks like this:
#!/bin/bash
echo "running some-program"
/home/murat/some-program arg1 arg2
What's the best way to do this kind of thing under Windows?
Windows Terminal is a modern host application for the command-line shells you already love, like Command Prompt, PowerShell, and bash (via Windows Subsystem for Linux (WSL)).
Under Windows, one easy way to access a Unix command line shell is to download and install Cygwin. The installer has lots of options, but if you just go through using the defaults, you should end up with an icon on your desktop that will load up a Unix shell.
PowerShell is superficially similar to Unix shells. PowerShell has aliases for many of the commands you are used to in Unix, like ls, rm, cp, mv, etc. However, the way that the cmdlets behind the aliases work is quite different.
In windows 2007 and above, Powershell is a built-in program. Before that, it has to be installed as a separate program. Linux and Unix systems mostly use Bash, and it is used from the very first day in Linux and Unix operating systems.
Take a look at PowerShell, which is the closest you will get to a true scripting language like you have in Unix. Other than that, for simple things such as simply runnning an application, take a look at Windows command script/MS-DOS batch files.
You could go with either an old school batch file (http://en.wikipedia.org/wiki/Batch_file) or you can go with a brand new shiny Windows PowerShell script (http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx).
I use batch for simple operations and PowerShell for complex scripts that also involve data processing.
There are a number of scripting options on windows:
You can use a Windows batch file. Find more information in the Wikipedia article.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With