Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

Useful Commands in BAT/DOS


Useful Commands in BAT/DOS

By ghostghost | 7417 Reads |
0     0

                        Usefull commands in BAT/DOS
                                by DeatoX

// Shutdown

The famous shutdown command

The shutdown command is a command which make is possible to shutdown the computer, The name says it all.

Example:

shutdown -s -m 127.0.0.1 -t 99 -c hello

In this case it would shutdown the computer ur sitting on "127.0.0.1" in 99 seconds, and leave the comment hello in the shutdown screen. You can use this command at LANs etc or over the network, simply replace the 127.0.0.1 with someone elses IP. If someone does this at you go quick to start/run/cmd and type shutdown -a.

Syntaxes:

shutdown - shutdown, always start this function with it

-s It means that the computer is gonna be turned off, you could use -r, -r is for restarting

-m declares the targeted computers ip adress

-t time in seconds untill the shutdown

-c a comment in the shutdown window.

// Looping

In order to loop the program in a bat file simply enter these commands:

Example:

:1 echo hello! goto:1

Now u declared an function which in this case is 1, and once the program comes to goto:1 is simply goes back to the function :1. And there you got an loop =) If you replace echo hello! with ur bat files name it loops that bat, and eventually the computer crashes or freezez whe its to many windows on the screen.

Syntaxes:

1 - the 1 is the variable goto - the goto function goes back/forward to a deklared variable, in this case it was 1.

// AT commands

AT commands is really useable to schedule tasks in the computer, With this command you can make so when the times 11:00 etc the computer will go off.

Example: at 11:10 cmd /c shutdown -s

That will result in that, when the time is 11:10 on hes computer it will go off, You can add several of these entries =), But when their jobs done they dissapear. If you want to delete all the tasks, If you got them in your computer simply type in at /del and it will delete all AT entries.

Syntaxes:

at - at, always start this function with it 11:10 - The time when the thing will happend cmd - cmd /c - loads cmd

//Shutdown programs/processes

For this task we will use the taskkill command, Which makes it possible to kill tasks in the computer.

Example: taskkill /f /im explorer.exe

This will result in that the procces explorer.exe will be closed "killed" and the desktop dissapears, Of course you can take other things such as taskkill /f /im iexplorer.exe

Syntaxes:

taskkil - the command taskkil, always start this function with it /f - Forces the process to shutdown /im - just put it in ;P

// MSG

The msg command sends an message over the network, Its pretty much the same as net send.

Example: msg john14 hello!

It will send an message to john14 with the message hello.

Syntaxes:

msg - the command msg, always start this function with it john14 - here you put in the username, for example john14 as i wrote hello! - the message


                          NET Commands (just some)

// Net send

Net send is used to send messages across the network to eachother

Example: net send * hello

This would give an message across the hole network with the letters "Hello", Wouldent it be nice to combine these and the looping i descibed earlier =)? If you dont have this activated (messenger service) simply go to start/run/services.msc Look for the service messenger click on it, then press activate. If you want to send an private message to somebody use net send "hes username" "message" theres actually another net send type command called "msg" I will explain it later.

Syntaxes:

net send - net send, always start this function with it

    • Sends a message to all hello - the message

// Net use, net view

            -Mounting drives-
  1. Finding computers on your network

If you want to find shares on your network the net view command is good, type in net view in start/run/cmd, It will then make a list of all availible computers in your network, It can look like this:

C:\docu<i></i>ments and Settings\User

Server Name Remark

\\johnscomp \\qxR5

Well, why not explore Johns shares? To do this we type in net view \\johnscomp which will show hes shares. If the target dont got any shares it will be standing this: The list is empty. Well suggest he has some shares, It can look like this:

C:\docu<i></i>ments and Settings\User

Shared resources at \\johnscomp Sharename Type Comment

My music Disk My music My games Disk My games

Okey, now you found hes shares, now its time to mount them, In order to mount we will need net use.

  1. Mount the shares

Ok, Now it is time to mount hes shares, we will use the command net use.

net use "drive": \\johnscomp\"hes share"

Ok, to the syntax part, first we have the "drive" put in the desired drive that you want hes share to be mounted on with a : at the end, If you want to random an drive type in * instead of any drive such as: f,g,t,u,y.

So i you want to mount hes share My music, we could type in:

net use f: \\johnscomp\My music

And hes share is now mounted, to acces it simply go to My computer and u will see it in the drives list, or you could type in F: in start/run/cmd to acces hes shared folder. With this command you could mount hes C:\ drive, but for this you will need hes username and password. Lets say you have hes username and password then type in this:

net use f: \\johnscomp\C$ "here goes the password" /u:"here goes the username"

And done! You have mounted hes C:\ drive, and you can now acces all his files on hes C:\drive. Whenever its an $ tag after the share its an hidden share. If you want to connect to someones computer with anonymous acces type in this:

net use \\target\IPC$

That will make an anonymous connection between you machine and hes machine, IPC stands for Inter-Process Communication. Well to take advantage of this we will use the command net session. Well time to get some information =). Type in "net session \\target", It will give you information about, the targets username, what OS he got etc. To exit the connection write net session /delete.

Comments
ghost's avatar
ghost 18 years ago

I didnt now how to mount or kill procceses thanks ;)

ghost's avatar
ghost 18 years ago

Nicely written ;)

ghost's avatar
ghost 18 years ago

Warning: Im a noob. Where are you suposed to write these commandes in? Command prompt?:)

ghost's avatar
ghost 18 years ago

yes cmd…

ghost's avatar
ghost 18 years ago

afraid shutting down compters remotly is only in XP so if your school has Nt etc won't be able to do that.

ghost's avatar
ghost 17 years ago

awesome article man thanx i will probably use this during school:ninja: :D

Night_Stalker's avatar
Night_Stalker 17 years ago

dude cool articale i crashed my dads comp. and 7 @ my school