I have no prior experience working with batch files or shell scripting in general. I need to understand the operations being carried out by a batch file used in a related project. Any resource that gives exhaustive list of batch file commands and what each one does?
Once you get acquainted with the general .BAT file information, using some of the pointers to useful information that other users have posted in the other answers, you might try some of the following strategies that help you understand and analyze the BAT files used int your projects:
add an ECHO command in front of all command invocations
read HELP command for each command line in the BAT file
execute at the command prompt each command line in the BAT file
remove the #echo off at the top of the .BAT file, and see how the BAT progresses
add some PAUSEs to keep viewing some commands on screen before they disappear.
There are some useful answers here in this Stack Overflow question: Best free resource for learning advanced batch-file usage?
As well there are quite a few resources available through google search for Batch file resources, as well as the Wikipedia entry http://en.wikipedia.org/wiki/Batch_files
That should get you started at least.
A little search on google should give a lot of tutorials and websites with information on writing them for both Windows and Linux.
Maybe you should start from the beginning though.
http://ss64.com/nt/
http://academic.evergreen.edu/projects/biophysics/technotes/program/batch.htm
http://www.robvanderwoude.com/batchcommands.php
http://en.wikipedia.org/wiki/List_of_MS-DOS_commands
They're just a few examples i found with a little google search. You should search it and find something thats better for you.
Hope this helps.
Related
I used to use a sort command when trying to view all files across a bunch of folders at once. It makes sorting files easier. I do know part of the command was written as not sort kind, however I am unable to remember which parts need to be capitalised, and where the colon (:) goes. I have trying googling the answer, and even gone through hours of YouTube videos trying to find the answer. I would prefer not to use the asterisk (*) command or the DIR command Screenshot showing one of many attempted iterationsas that is not suitable for my use. Thank you.
I have since been alerted on StackExchange that the answer to the issue I was having is kind:NOT Folder.
I have visited StackOverflow thousands of times and it's always incredibly useful. This will be my first question on this site, after spending the entire day attempting to solve a problem.
Long story short, I use a program who's configuration settings allow for custom user programs to be executed with a button click on the main GUI. Alongside this is an input for a cmd line option. You can see the config in this image.
Configuration Settings Window
So I have created a script to execute and have been trying with no success for the entire day. I don't imagine I have to explain what it's like to keep changing small details and even starting over again a dozen times. Basically, when you highlight an order in the program, I want to move any (*.stl) files from the orders folder. The .bat file converted to exe i tried dozens and dozens of similar scripts like the code below. I have a .bat and a .exe that work fine when I am moving a file from my own directories. But now with this very new to me, environment variable. No matter how I format it, it doesn't work. In the beginning it was always exit code 255. But now I get exit codes 0, 1, but no file copy. I have made progress and but decided I need to ask for help.
Thank you in advance.
edit: enter image description here
for /r %ORDER_FOLDER% %f in (*.stl*) do #copy %f C:\Users\Lap2\Desktop\test_dir
background info:
I know this question has been asked countless times, but I'm not understanding the answers.
Today is the first time I've ever done anything with python, so I'm a total noob.
I'm using windows 7.
python 3.3.5 lives here: C:\Python33\python.exe
I have a .py file I want to run saved here: C:\Users\Scydmarc\Documents\cs188\python_basics\myfile.py
If I simply double click on myfile.py, it opens, runs, and closes super fast. By doing a perfectly timed printscreen, I can see that it works. It is my understanding that I need to run the file from within python.exe to get the window to stay open and allow me to mess with variables etc after it runs. So I open python.exe. What exactly do I need to type to run myfile.py? I've found lots of people trying to do this, but I guess I'm not understanding the answers. When I try to follow along, I get tangled up with errors. Do you still need to put python before the file name while in the python.exe window? Do I somehow need to specify a full path to the file? Some are actually running from the windows command prompt and not the python command prompt. When trying to change PYTHONPATH, are you supposed to do that from inside python, or the windows command prompt? Some examples use '/', while some use '\'. So, I think a complete example (what to actually type, in what window, line by line, with real filepaths) would clarify a lot for me and be super helpful. I'm thinking if I can actually see it done once, I can figure out how to make it do what I want in the future. Thanks for any help you can give.
in your python dir type python.exe pathtofile.py or set python.exe to your classpath
edit: https://www.youtube.com/watch?v=IokKz-LZsEo
I have a production flow that combines XSLT and some shell scripts in about 4 steps before it reaches completion. I execute each step manually at the moment.
I'm using Saxon 9 from the command line in Linux. Can I have the xsl's execute shell scripts.. instead of me?
(I know I could achieve the desired result in another way with Ant or Make.. but prefer to stay in XSLT if it is not a huge effort to do so)
Update: I've minimized my shell scripts and sped things up using Xproc. I'm not entirely satisfied with the result, but Xproc has improved life. Kai's suggestion below looks good.. but I have not tried it yet.
I'm not Java savvy either, but I found with Michael Kay's tutorials on the Saxonica website it's doable.
Here's what I did and what's working well for me:
In the root element of the XSLT stylesheet I assigned a namespace for the function (in my case I'm using it for unzipping, so I named the prefix unzip, but that could certainly be anything):
xmlns:unzip="java:java.lang.Runtime"
I am defining a variable with a file path for a batch file to be called later. Then I am using
<xsl:result-document href="{$batchFile}" method="text"> ... </result document>
to create the batch file. (Unzipping could be certainly done with just a command, but I found the batch file version more handy as I needed to combine the unzip-command with some change directory command and other little stuff. And furthermore using a batch file opens up a world of more elaborate tasks that could be called from the XSLT sheet.)
When I need my batch file be executed, I insert an xsl:message like this:
<xsl:message>Executing <xsl:value-of select="unzip:exec(unzip:getRuntime(),concat('cmd /c /y start ',$batchFile))"/></xsl:message>
Hope that helps,
best regards,
Kai
You can call java.lang.Runtime.exec() in the same way as any other external Java function.
I have a huge file with all the commands I use on and off the commandline. This file is getting harder to open and navigate as its size gets larger. I am looking for a commandline utility that makes this process easier. I found this gem, which does something similar to what I want, but it's terrible with long lines of code with multiple quotation marks.
What does everyone use to keep your code snippets and easily access it from your terminal?
I keep a similar file myself. This example isn't directly useful with your file. However when I find that I need to run a particular command I recently used, without looking it up again, I run a grep on history.
For example:
history | grep "svn co"
You may try Komandi, a multiplatform command snippets manager.