-->

9 Command Prompt TRICKS & SECRETS in Windows [MUST WATCH]
9 Command Prompt TRICKS & SECRETS in Windows [MUST WATCH]

Introduction:


How's it going, guys? I'm Shubh Rajput and today we're gonna be taking a look at the good, old Command Prompt Tricks and Secrets in Windows. And you may know, this is a very useful tool but there are a lot of features that are pretty much unknown and dare I say our Command Prompt tricks and secrets that make it even more useful.


Now, this is going to be in Windows 10, particularly. That's what I'm using. But a lot of these are gonna carry over in previous versions as well, I've got about 9 of these. So let's get started.

Customize Text

When you start Command Prompt, it probably says the path of the current folder you're in, like C. And then, either the user directory or maybe system 32, if you're running as an administrator. So, the first Command Prompt tricks is you can customize any of that text to whatever you want. You can do this by typing in:

Prompt ‘YOUR TEXT’

Now, that will be the text that shows up, before whatever command you type in.

special codes

Having just some random word there is not going to be very useful. So, you can use this command to show special codes that you can use:

Prompt / ?

You can use this to not just have words but also dynamic information there as well such as a Timestamp or the version of Windows and stuff like that.

For example, maybe we don't want it to just show the file path. But we also want to have it as a timestamp. To do this, you can look at the special codes and what we would want to type in is:

Prompt $T $B $P$G

In which,


  • ‘T’ is the current timestamp code.
  • ‘$B’ is a vertical line.
  • ‘$P’ command will show the current path, just like it usually does.
  • ‘$G’ command to show the greater than sign.

After we do that, now it shows the Timestamp and then the divider line and then the file path like it did before. So, a little bit more useful.

Revert to default

Also, If you ever mess it up and you want to go back, you can simply revert to the default by typing in:

Prompt

And nothing after that. And it will automatically go back. So you could also use this as some sort of prank.

If you want to mess with your friends, you could have it say, ‘CATASTROPHIC ERROR’ or something like that. And then they won't know what's wrong with it. Might be kind of funny as long as you know how to put it back.

Setting up permanently

One thing to keep in mind though is that when you use this command, it will reset once you restart the command prompt. If you wanted to have that by default and always show your customized one when you start a command prompt, you have to do a quick Registry edit.



Warning

Now, I'm gonna show you how to do that. But, as usual, if you are not experienced with the registry editor at all, be very careful and maybe even avoid this trick because messing with that registry and deleting something could ruin your entire version of Windows and you'll have to reinstall it. So, just be very careful here.


Steps to do:

  1. So, open up the Registry editor by searching it in the start menu.
  2. Under Computer, click on ‘Hkey_current_user’.
  3. Then, software, then Microsoft and then, Command Processor.
  4. Now, on the Right side, after you enter that little folder.
  5. You're going to Right-click and select New.
  6. Then, select String value and you want to name this ‘Autorun’.
  7. After you create that, you're going to Right-click on that Autorun key and click ‘Modify’.
  8. Then, when it says ‘Value data’, you're gonna type in whatever command you want to autorun, as Command prompt starts up.

So in this case, if we want the prompt command to always have a certain format that we customized like the one, we just made. All we have to do is paste in that timestamp prompt code that we created before.

Now, when we start up the command prompt, it automatically shows that customized prompt there and this doesn't just have to be the prompt command, you could have this as any command, you want to run automatically when you start command prompt, so use it wisely.

Customize Title

This is another kind of useful. So, instead of customizing the prompt maybe you want to customize the title that shows up in the title bar of the command prompt and to do that, you just type in:

Title ‘YOUR TEXT’

Again, this will reset after you close the command prompt. But if you want, you can put it in that auto-run command in the registry and it will change it permanently.

Command info

I'm sure, you know about this one, you just type in ‘Help’, and then it will list a bunch of very common command prompt commands that you can choose from. But, you can also access help by typing in:

‘YOUR COMMAND’ /?

That will bring up a bunch of information about that command and this doesn't necessarily have to be one of the commands that are built into the command prompt.

For example, You could have one that's like SFC (System file checker), and that's not gonna appear when you type in ‘Help’ but you can still use the /? command to show information about it. Such as syntax, some arguments, parameters in it, and that sort of thing.

commands history

We have a couple of commands through which you can access command history that you might have typed in and you want to either repeat these or to see what you typed in before.

Using arrow keys

The first of which is simply using the arrow keys. If you use the up and down arrow keys, it will scroll through previous commands you did. So, you can just press ENTER to do it again.

Command-List

You can also get a list of previous commands you typed in, in that instance, since you've started command prompt, by typing in:

Doskey /history

Then, it will output a list of all the commands, you've recently typed in.

History shortcut

Finally, another good shortcut is simply pressing F7 and this will bring up not only a list of previous commands but it'll also let you select them directly and then press ENTER, and then it will paste it.

So, if you don't have to keep scrolling through using the arrow keys, you can just select it right there, pretty useful.

Multi commands on a single line

If you want to have multiple commands executed on the same line. So, you can do this by typing in ‘&&’ or ‘+’ between the commands.

For example, if we want to customize the title and the prompt at the same time, you could do this by typing in this command.

Prompt ‘YOUR TEXT’ && Title ‘YOUR TEXT’

When you hit Enter, it'll do both at the same time and you can also use this when you're doing that Registry autorun command. If you want to have it execute multiple things you can combine them with ‘&&’ and it'll do it all at once.

output into clipboard

This is a useful one that allows you to put the output of a command on to the clipboard. So, you already executed a command and you want to go back and copy at this time, you'd simply type in:

‘YOUR COMMAND’ | Clip

So, it'll look like this. Now, when you execute that command, it'll be copied to the clipboard and you can paste it anywhere.

output into file

The next one is that you can output a result into a file, not just the clipboard and you do this by using this command:

‘YOUR COMMAND’ > ‘FileName.txt’

Then, it will output that to a text file that is located in your default library folder for that user. Keep in mind, if that file already exists, it will overwrite that file.

appending

But, if you want to append the text results on to the file. So, maybe you already have a file.txt and you want to add the results onto that, you can use ‘>>’ and it will simply append the results to the end of it.

specify location

For both of these commands, if you want, you can specify the file location. So, it doesn't just go to the default one and that's simply by doing the ‘>’ and then typing out the entire file path, under double inverted comma(“...”), and then it'll go to that file location.

Abort command

So, the 8th Command Prompt tricks are a very simple shortcut and that is ‘Ctrl C’. Now, normally if you're in Windows, this always does a copy command but in command prompt, it's special and it aborts the currently running program or command.

So, if you're running something, it's taken too long or you didn't mean to run it and it's kind of frozen, you could press ‘Ctrl C’ and it should abort that command and then bring you the prompt, again.

So, if ‘Ctrl C’ doesn't do a copy and paste, how do you do a copy and paste? Well, that's the next tip.

Copy & paste

This is at least in Windows 10 and I think 8 as well. You highlight whatever text you want in the command prompt, using your mouse and then to copy, you actually Right-click, and then it'll Unselect, but now that text will be on the clipboard and to paste you just do ‘Ctrl V’ and it will paste it.

Conclusion:

So, these are some command prompt tricks and secrets that you should use. I hope you like it. Please share this post with all your friends and keep supporting me.

Check my recent posts and I’ll see you in the next one.

Bye...

1Comments

Don't try to spam...

  1. Thanks so much for sharing all of this great information! 9 Command Prompt TRICKS & SECRETS in Windows [MUST WATCH] is the best article... I’ve decided to comment more for my business and this information is exactly what I needed to learn. Thanks!
    Best PUBG Names

    ReplyDelete

Post a Comment

Don't try to spam...

Previous PostNext Post