Stack Exchange Network
Stack Exchange network consists of 183 Q&A communities including
Stack Overflow
, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Visit Stack Exchange
Software Engineering Stack Exchange is a question and answer site for professionals, academics, and students working within the systems development life cycle. It only takes a minute to sign up.
Sign up to join this community
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
(On Windows 7 64 bit)...
I am looking for a program, something similar to the default Windows Terminal, what I need it to do is:
Load text from a given URL, split the code in two variables and then trigger a simple Windows command based on these two variables.
Currently I am doing this with PHP ...
$my_vars = file_get_contents('http://site.com/data.txt');
list($var1, $var2) = explode($my_vars);
exec("my command $var1 $var2");
This does the job fine but I don't like having PHP installed on Windows for something as simple as this. I am looking for a more compact file that maybe can be triggered from command prompt and doesn't have many additional files or dependencies, I need it to run on 2-3 computers too.
–
–
–
Looks like you want some form of general purpose scripting language.
Windows batch scrips
are the traditional way of doing simple tasks like this on Windows. In more modern versions this has been replaced with
Powershell Scripts
.
Seen as you want to get things from a URL you might want to use a more powerful language however such as
Ruby
or
Python
. Both are quite capable of accomplishing the task as simply as PHP does it in your example. The choice between the two is more a matter of style and familiarity rather than one of capability.
–
–
–
Another way of doing things like this when Windows batch scripts are not powerful enough is using VBScript - not so nifty as Powershell, but IMHO easier to "grok". See
here
for an example routine for HTTP downloading, and
here
how to execute a command. VBScript is part of every Windows installation since ~2000. Powershell is only preinstalled for Win7 and later (which may suffer your needs).
–
Thanks for contributing an answer to Software Engineering Stack Exchange!
-
Please be sure to
answer the question
. Provide details and share your research!
But
avoid
…
-
Asking for help, clarification, or responding to other answers.
-
Making statements based on opinion; back them up with references or personal experience.
To learn more, see our
tips on writing great answers
.