Google

Apr 19, 2013

Handy DOS commands for Java developer


Q. How will you copy files more robustly in DOS?
A. Using the Robocopy (stands for Robust File Copy) or Xcopy command line utilities. Check for its options with "robocopy /?".

Q. How will you remotely connect to a remote Windows or NT server?
A. You can use the "mstsc" command from the run window. This will allow you to connect to a remote box.



Q. In DOS, how to recursively delete subversion or (.SVN) folders?
A. In DOS (i.e. Windows), you can recursively delete the .svn folder with the following command

for /d /r . %d in (.svn) do @if exist "%d" rd /s/q "%d"

For example:

C:\projects\myapp-parent\trunk>for /d /r . %d in (.svn) do @if exist "%d" rd /s/q "%d"


Note: In Windows under  file explore, the hidden files might not be displayed by default. ".svn" is a hidden file, and to turn it on you need to click on Tools --> Folder Options and then select "View" and ensure that "Show hidden files and folders" is selected.
Q. How will you list  the ip address of your machine?
A.Use the ipconfig command


C:\ipconfig


Ethernet adapter Local Area Connection:

   Connection-specific DNS Suffix  . : dhcp.mydomain.suffix

   IPv4 Address. . . . . . . . . . . : 10.102.191.2

   Subnet Mask . . . . . . . . . . . : 255.255.255.0

   Default Gateway . . . . . . . . . : 10.102.199.1


Q. How will you list  your computer name?
A. use the hostname command.

Q. How will you list the environment properties?
A. You type the set command. This will display all the environment variables.

If you want to list the PATH variable then type

c:\set path


For variables starting with user or lib, you can type

c:\set user 

c:\set lib


and so on. if you want to send the output to a file

c:\set lib > file.txt

and then you can view the file

c:\type file.txt

c:\notepad file.txt


If you want a particular environment variable like "path" then try

c:\echo %path%

c:\echo %JAVA_HOME%


Q. How will you get the name of your computer?
A. With the hostname command.

Q. How will you check if a remote host is reachable?
A. ping

Q. How will you check for the network statistics like what ports are established, etc?
A. With netstat command. To get all possible optional parameters get help with "netstat /?"


Q. Can you list some handy commands useful for developers?
A.

1. assoc command to find out  to what application a particular file extension is mapped to.

c:\>assoc .zip
.zip=WinZip

c:\>assoc .doc
.doc=Word.Document.8

2.tree command  to view your maven directory or project directory structure. You could pipe this command to a txt file.

c:\projects\my-app>tree > x.txt
c:\projects\my-app>type x.txt


3. fc to compare two files.

c:\projects\aes-gui>fc file.txt file2.txt

4. tasklist to list all the tasks with PID, Mem Usage, etc.

5.  The net command can be used to map a network drive.

c:\projects\aes-gui>net use z: \\remotecomputer\folder
To display all the network drives try
c:\projects\aes-gui>net use 

Labels:

1 Comments:

Anonymous Six months industrial training in Chandigarh said...

I really enjoyed this post. You describe this topic very well. I really enjoy reading your blog and I will definitely bookmark it! Keep up the interesting posts!

8:52 PM, May 23, 2013  

Post a Comment

Subscribe to Post Comments [Atom]

<< Home