Originally posted by: Rumpel Tumskin
Here is what the teacher sent me back to show what it should be
md .\asg5
time /t > .\asg5\time.txt
cd .\asg5
dir
pause
Where can I find info on what all the .\ , /t, and > symbols do and a big list of them. Every help tutorial I find on batch files really do not discuss these characters, they just talk about the commands. I can't figure out how to do freaking batch files untill I can find a good guide to teach me how to use the command prompt. I need a "Dummies" quality web guide.
Ok, I really can't believe that aren't teaching you these things. I learned this stuff in seventh grade! (That's Canadian public schools for ya).
The \ is the same thing as the \ in C:\Windows\System32 - it's part of the "path" to a file. In Windows, the path starts at the disk drive letter, such as C:\ or A:\ and everything is stored on the computer in directories (folders) underneath the drive letter. Take your My Documents folder, it's located in Windows XP at C:\Documents and Settings\Rumpel Tumskin\My Documents, where each "level" of directories is divided by a \ or "backslash".
So, if you are in a location on the computer, such as C:\hp\temp\ and you want to access a file in C:\hp\tools you'd type the following on the command line:
cd ..\tools
Where cd means "change directory", the first . means "current directory" and the second . means "the directory before the current directory and the \tools means "the directory called tools. So, cd ..\tools means "jump back one directory lower, then jump up into the tools directory from there".
You teacher is only using one period, so what he is doing is simply "specifying the path" to be the current directory - it was "specifying the path" that you were missing, when I mentioned that you were missing a crucial concept. They taught us way back when that computers are picky and they will only do exactly what we tell them to do. And, back then it was important, because not specifying the path can cause lost data, lost time, and lost hair!
The reason I mentioned the .. is that is very handy when working on the command line. In linux and in dos, you use it all the time when using the cd (change directory) command, such as
cd ..
to jump back one directory
cd \
to jump all the way back to root of the drive, C:\
and
cd ..\..\tools\uninstall.bat
to run a file "2 jumps down, 1 jump up" from your current location!
I''s all very handy stuff that I take for granted, as ''ve know how to do it for something like 20 years now... I AM old... Anyhow, to explain the other characters,
/t is wha''s called a "switch" or "parameter" in Windows. Many command line programs, such as time and dir have multiple switches that allow the program to output (or input) different information. Pretty much all dos progams will output some helpful information if if they are followed by the /h switch (time is not one of them...). time /t tells the time command to output the time in the 12:00 AM format, rather than military time.
> and >> are "redirectors" that simply do exactly what that sounds like: they redirect the output of one program into the input of another file or program. So,
time /t > .\asg5\time.txt
means, "take the time output from time /t and put in a text file called time.txt, which is located one directory up from the current location and is called asg5".
An important thing to note is that a > redirection into a file will overwrite the contents of the file starting at the first byte, where as the >> redirection means, "stick this crap after the last character in the file", otherwise refered to "appending". Both are very handy operators in any scripting language!
Well, I hope that helps some. If not, you could head to
www.linux.org and download one of the very small floppy disk versions of linux and play around with the bash scripting howtos. bash stands for "bourne again shell", after the guy (Bourne) who wrote a new *nix shell. sh is the standard unix shell, where bash is the standard linux shell. Anyhow, linux shell scripting is more powerful and rewarding than dos shell scripting (and more relivent today), but the underlying concepts of both dos and linux shell scripting are the same - they both are derived from the unix of the 1960s!
Good luck with your classes and best wishe