Editing Default Commands on Windows Command Prompt - windows

I am creating a Windows virtual machine and would like to edit the default commands for the command prompt like tree so that when that command is typed it will do what I want it to do. I found 'tree.com' in System32, but when I open it, it is gibberish. How might I be able to read and edit it?

Modifying basic Windows programs is not a good idea (in case you need them there not there anymore), but there's another approaches: doskey, based on UNIX aliases: this allows you to, when you enter tree, to start up another program instead. Help can be found under doskey /? and there are plenty of examples online.

Files with extension .com are compiled executables. There is nothing to edit in there.

Related

Powershell use a custom profile file

I know when I start powershell, I can edit the file pointed to by $profile and can put commands in there such as setting aliases on startup.
I am wondering if there is a standard way to start a shell and supply a option to load a different profile file. I tried doing powershell /? but only saw a way to turn off the profile entirely.
I am basically looking for something like powershell -profile-file myprofile.ps1 or a way to get a similar behavior.
Thanks.
Check out ConEmu , it emulates CMD, Bash, and Powershell and you can customize what it does when you start up a new console dialog. Might be one of my favorite dev tools ever.

I need help setting up Mercurial for windows for very uninformed users

I'm the uninformed user. I want to use mercurial for my personal use in terms of writing code and writing papers and have every change be accessible. I'm not a programmer by trade, I run a lot of matlab code and that's it as far as programming experience goes. I've installed the TortoiseHg with Windows Explorer "shell" integration all-in-one package. I already have python 2.7 installed too.
Next I went to this tutorial: https://www.mercurial-scm.org/wiki/TutorialInstall and I got lost right away. They say the mercurial program is called hg, so I type so in the search function and it comes up, I open it and a quick command window opens up and closes in a fraction of a second and that's it, nothing else happens. I read a bit further into the tutorial and they say that you have to type hg in the prompt. I tried windows powershell and this did work but I don't know if I was supposed to be doing this from within some hg prompt or something.
I went to the next step of the tutorial and they go through the steps of making a repository. I blindly typed the commands they have setup and it worked until I typed "ls -a" saying that it's not a recognized cmdlet.
I don't know what I'm doing and I need a better resource that helps me get this set up and running as I don't understand why even opening "hg" does apparently nothing or if even I should be using powershell for the tutorial.
Mercurial is mainly used by people who are programmers by trade...so all the tutorials are written for programmers, and therefore assume a certain understanding of how command line applications work.
I suspect you're not that familiar with the command line, so first of all, I second user694733's comment:
For a beginner, the TortoiseHG GUI is way easier to get started.
(and they have excellent documentation as well)
Anyway, here's why the command line didn't work like you expected:
hg is a command line application. When you directly start it from Windows (which you did by typing hg in the Windows start menu), it behaves like you described: it pops up and immediately disappears. You need it to start from the Windows command line instead.
There are two different command lines in Windows:
a) Windows PowerShell, which you already used
b) the "classic" Windows command line, which you can open by typing cmd into the search box in the Windows start menu
There's no special "hg prompt", it's just that you're supposed to run hg in one of the two command line interfaces I listed above. It doesn't matter which one you use - hg behaves the same in both.
it worked until I typed "ls -a" saying that it's not a recognized cmdlet.
Mercurial does not only work on Windows, but on other operating systems as well (Linux and Mac OS, for example).
The hg commands are the same everywhere, but everything else is different depending on your operating system. For example, ls is the Linux command to list the content of a directory. In Windows, it's dir instead.
Most, if not all, of the Mercurial developers don't use Windows, so their tutorials are not written with Windows in mind.
You should really start with TortoiseHG, as mentioned above (its documentation is Windows friendly, too) or if you really want to use the command line, I'd suggest a different tutorial, Hg Init, which was written by a Windows guy (Joel Spolsky, the CEO of Stack Exchange, the company that runs Stack Overflow).

.bat Set FontSize - Windows Command Line

Intro:
I swear have searched around for sometime before posting, but have been unable to find an answer for this..
Question:
Regarding Windows Command Line:
is there some way to set the font/text-size via an actual windows command line in a .bat file?
-Not through going to Properties -> etc. (I understand that quite sufficiently :P)
--Plz no PowerShell.
Additional Notes:
Reason: Thinking of business system based Command Line front-end, PHP back-end.
Thanks in advance.
Without using PowerShell, the only way I can think of would be to modify the registry values under HKCU\Console. See the relevant Technet documentation. However, changes made to the registry values will not update already running console windows. You won't see your changes until you spawn a new console.
As far as how to make changes to the registry, reg /help for more info.

windows: command line used to launch a program

How can I find out the command line options a program was launched with under windows?
try: http://www.bleepingcomputer.com/tutorials/tutorial132.html
in short:
use the Process Explorer utility created by Sysinternals (now owned by Microsoft; which is probably why vista and windows 7 now have a similar functionality already present in task manager)
On vista... You can
go to the task manager
Click View --> Select Columns
Add the command line column.
To do this programatically, run "tasklist -v" to a file and then split up the file.
If you are trying to get the command line of another process programmatically you should probably read Why is there no supported way to get the command line of another process?:
Commenter Francisco Moraes wonders
whether there is a supported way of
getting the command line of another
process. Although there are
certainly unsupported ways of doing
it or ways that work with the
assistance of a debugger, there's
nothing that is supported for
programmatic access to another
process's command line, at least
nothing provided by the kernel. (The
WMI folks have come up with
Win32_Process.CommandLine. I have
no idea how they get that. You'll have
to ask them yourself.)
If you are trying to retrieve the command line of your own process you can use GetCommandLine.
Try running the .exe but with the /? flag.

Third-party windows command-line program?

Looking for a better Windows XP command-line interface. The Visual Studio Command Prompt isn't near as nice as the Linux/OSX terminals.
Thoughts?
edit:
Answers: Console on Sourceforge, and the Windows Powershell. Thanks, I'll go dig them up and evaluate them.
The Cygwin package is too much overhead for what I want.
edit2:
Looks like the Windows Powershell for now. Its copy&paste functionality isn't great, but MS supports it.
Take a look at Console2 http://sourceforge.net/projects/console/
It's features:
"multiple tabs, text editor-like text selection, different background types, alpha and color-key transparency, configurable font, different window styles"
As has your question been tagged, have you tried Windows PowerShell? It's paradigm is based on unix's pipes but instead of outputting text the processes output .Net objects.
cygwin? www.cygwin.com. Or mingwin?
Cygwin
This is an answer extending line.
I'm not clear on what you mean by Linux/OSX command prompts being "nice". If you just mean that they provide more utilities, I usually install Windows Services for Unix to add common programs like grep and vi.
I see you put "powershell" as one of your tags. Maybe you could help direct our answers by explaining what you don't like about PowerShell as a replacement for cmd.exe?
I use Take Command from JP Software
Cygwin is a good alternative. You can run Bash or other shells on Windows. You get most of your classic Linux/UNIX commands, shell scripting, etc. You even get the GNU compilers and can avoid Visual Studio if you wish. From Cygwin, you can access your regular Windows programs, drives, etc so there's rarely a reason to go back to cmd.exe.
If you are just looking to automate tasks via shell scripts (not interactive shell), then you should look at Windows Scripting Host. WSH is a feature-rich scripting environment for Windows that comes pre-installed on all modern versions of Windows.
I've been combining putty, cygwin, screen, and zsh(not bash) lately. I like a lot of the features of zsh, like autocd which and auto-pushd, which put the directories you change into onto the directory stack without having to type pushd. I also like that fact that multiple shells share history, and don't overwrite each other. Screen lets me run multiple zsh shells in one putty window. You can get zsh and screen from the cygwin site. I run: putty -cygterm screen
You'll also need the patched version of putty that has the -cygterm support.
GitBash by git is also a good option. It can be configured to be used in unix like environment.
It can be downloaded from here http://msysgit.github.io/

Resources