Page 1 of 1

#1 The CLI, a mighty tool it is

Posted: Thu Mar 30, 2006 6:53 am
by Ace Pace
So I've been looking at expanding my knowledge of Winnie, unfortunatly there was only one thing left. The dreaded command line.

Cue 4 months later, circa a month ago, I feel okay with it, I can manage my net connection from it, I'm now looking into the unfanthomable world of automation, specificly automating Defragging.

Every thing I lay out here, credits go to Destructionator in finding out how to do it. First step was pretty easy, running a defrag through the CLI(command line interface) was simple. And I thought, alright, lets schedule the command and leave. Whoa there, Windows can't run the CMD interface then a command! It can only run a single command for a task at once. Back up, my mind struggles to remember this thing called a batch script. My mind trembles. Alright, how hard could it be? Not very, a short time later, I have my first batch script written, several new sources of information and one happy computer.

All well you say? Eh...not quite. I've been having sleeping issues, specificly waking up. Of course, I wondered, how can a PC help with this? Alarm clock time! But another Ring Ring! tone in my room at the proper time won't really help, my mind is apathetic towards that tone. What I needed was Music. Cue my music folder and player(WMP10) to the rescue. All good? Nyet. Running an automated command to WMP10 to startup did nothing, it didn't autoplay, and obviously I need it autoplaying.
Again, cue the batch script. A little script to run a playlist file(that autoplays) and I'm done.

Whats the moral of the story? While the CLI is kinda frightening, it can a nice little tool to improve your use of Winnie. Oh and its just fun typing commands into black screens, but we'll leave that to Linux nuts.

My next step is obvious, I need to practice, but how to do that? I'm asking you people, give me simple tasks that you think the computer should do automaticly, stuff like the Alarm Clock, maintenance, etc.

#2

Posted: Mon Apr 03, 2006 10:17 pm
by Destructionator XV
I can't think of any good things to automate, as we have discussed on AIM, but some good things to know about the CLI is how it can make your life easier for even simple tasks.

Lets say you wanted to rename a bunch of files in a folder from .jpeg to .jpg. Doing that with the GUI would be a real pain. But from the command line, it is as simple as

rename *.jpeg *.jpg

done! Getting a good feel and comfort with the command line will make you a much more powerful user, even at simple tasks, and will help you greatly if you even decide to venture into other OSs, like Linux. But even in Windows, I generally keep a cmd window open at all times. You never know when it will be useful.

A few things you probably didn't know about the Windows CLI:

1) It has a primitive tab completion feature. While this is not nearly as nice as the tab completion in the Linux bash shell, it still helps save a lot of time. Try the following someday:

cd \
cd doc[PRESS TAB NOW]

When you press tab, it will automatically fill in "Documents and Settings", saving you a bunch of time. It's a nice feature, even when poorly done like it is in Windows XP.

2) Windows 2000 and Windows XP Pro have a telnet server build in. If you want to try it out, in XP Pro, go to control panel, administration tools, then services (or punch in services.mfc in a command window!). Go down to the telnet service and start it. You will need to set a password on your account to log in over telnet.

Type
telnet your.box.ip.address
in a command window on another computer (or type telnet localhost if you want to try it from your own box), then punch in your username and password when prompted, and boom! You have a Windows command line remotly.

I don't reccommend you actually use this die to the security risks. Not only is it an other avenue of attack, telnet connections are not encrypted, meaning anything you send along that link, including your password, can be sniffed by outside listeners. But it is fun to try out, or use inside a properly secured and firewalled LAN. However if you really like remote control, Remote Desktop is way way better (but rdp only allows one user logged in at once; you can telnet multiple simotanious users in). But that is another discussion for another time.

3) The runas command is really cool. It lets you excute a program as another user on the machine, like right clicking and selecting run as in the GUI. This is useful if you want to do the Right Thing and run as non-admin on your Windows box.

4) The shutdown command is pretty cool. You can shut down your maching with a timed countdown from the command line. Kinda nice scheduling this if you like to shutdown your box at a cerain time at night or something. Also kinda cool to use if you telnet into the box and shut it down. Amaze your friends as your box powers off on command from another room!

There is somemore, like going into Windows Script Host and the sort, but you would never use that. I never use it; it is useful for IT admins controling a large group of computers.

As I said, try doing some common tasks with the command line. You will find it makes some things easier and some things harder. Just another tool to use.

#3

Posted: Mon Apr 03, 2006 10:36 pm
by Kreshna Aryaguna Nurzaman
Um, folks? Windows CLI has been around since the 80's. In fact, there were times when you can play good games on it. Of course, at that time, the name was MS-DOS. :wink:

#4

Posted: Tue Apr 04, 2006 12:17 am
by Kreshna Aryaguna Nurzaman
Anyway, I'm using the command prompt almost all the time since my job mainly involves a text-based command console, the text-based SQL*Plus, and a text editor. Here's my usual command prompt tweak:

Image
Enabling the Quick Edit mode

Like shown on the picture above, I always enable the Quick Edit mode so if I can always copy paste back and forth from the text editor if I need to.


Image
Increasing the screen buffer

I also like to max out my screen buffer (like shown above) to backtrack the on-screen messages I get from running my scripts.

#5

Posted: Tue Apr 04, 2006 5:36 am
by Ace Pace
Thanks Dest, I'll try the telnet next time i'm on a LAN setup.