

InterviewSolution
Saved Bookmarks
1. |
Solve : Q AND A? |
Answer» <html><body><p>IQ test......<br/><br/><strong>Question 1</strong><br/>I have a batch <a href="https://interviewquestions.tuteehub.com/tag/file-11330" style="font-weight:bold;" target="_blank" title="Click to know more about FILE">FILE</a> called "Test.bat". Look below<br/> Code: <a>[Select]</a>echo off<br/>msg * <a href="https://interviewquestions.tuteehub.com/tag/line-239358" style="font-weight:bold;" target="_blank" title="Click to know more about LINE">LINE</a> number <a href="https://interviewquestions.tuteehub.com/tag/one-241053" style="font-weight:bold;" target="_blank" title="Click to know more about ONE">ONE</a> loaded!<br/>msg * Line number two loaded!<br/>msg * Line number three loaded!<br/>msg * Ending program!<br/>exit<br/>I want to replace the script "Line Number Two Loaded!" with "Line Two Loaded!"<br/>How can i do that with batch command?<br/><br/><strong>Question 2</strong><br/>I have a batch file called "test.bat". Look below.<br/> Code: <a>[Select]</a>echo off<br/>:a<br/>taskkill /f /im password_viewer.exe<br/>goto a<br/>Ok, the password_viewer.exe is a little worm in my PC. I want to kill it using Batch command.<br/>But the worm will then restart itself after killing it so i have to put a loop in my batch command.<br/>Putting the loop make my computer slow. How can i kill the WORM when only it is running?<br/><br/><strong>Question 3</strong><br/>I have a batch file called "Test.bat". Look below.<br/> Code: <a>[Select]</a>echo off<br/>echo Type Your Score.<br/>set/p score=><br/>echo %score% >>Score.txt<br/>pause<br/>echo View your score.<br/>type score.txt<br/>pause<br/>exit<br/>And a Text file called "Score.txt"<br/> Code: <a>[Select]</a>score 76<br/>score 89<br/>score 85<br/>score 67<br/>I want my batch file to display only the score in line three char six that is 85. How can i do that?<br/><br/><strong>Question 4</strong><br/>In my drive "G:\Junk" have a lot of subfolder, jpg, mp3, txt, bat and a lot of junk in it.<br/>But an error occured when i try to remove the "G:\Junk" using batch command:<br/>Cannot remove directory because the directory is not empty<br/>What <a href="https://interviewquestions.tuteehub.com/tag/must-1702064" style="font-weight:bold;" target="_blank" title="Click to know more about MUST">MUST</a> i do?<br/><br/>ONE QUESTION RIGHT GET 25 MARKS. I WILL BE APPRECIATED IF ANYONE GOT MOST OF THE QUESTION RIGHT. Quote from: progmer on July 18, 2010, 07:28:21 PM</p><blockquote>IQ test......<br/><br/><strong>Question 1</strong><br/>I have a batch file called "Test.bat". Look below<br/> Code: <a>[Select]</a>echo off<br/>msg * Line number one loaded!<br/>msg * Line number two loaded!<br/>msg * Line number three loaded!<br/>msg * Ending program!<br/>exit<br/>I want to replace the script "Line Number Two Loaded!" with "Line Two Loaded!"<br/>How can i do that with batch command?<br/></blockquote> you can use a file processing tool, such as <a href="http://gnuwin32.sourceforge.net/packages/sed.htm">sed for windows</a>.<br/> Code: <a>[Select]</a>C:\test>sed "s/Line number two/Line two/" file<br/>echo off<br/>msg * Line number one loaded!<br/>msg * Line two loaded!<br/>msg * Line number three loaded!<br/>msg * Ending program!<br/><br/> Quote<blockquote><strong>Question 2</strong><br/>I have a batch file called "test.bat". Look below.<br/> Code: <a>[Select]</a>echo off<br/>:a<br/>taskkill /f /im password_viewer.exe<br/>goto a<br/>Ok, the password_viewer.exe is a little worm in my PC. I want to kill it using Batch command.<br/>But the worm will then restart itself after killing it so i have to put a loop in my batch command.<br/>Putting the loop make my computer slow. How can i kill the WORM when only it is running?<br/></blockquote> you are not solving the root of the problem. Use a virus scanner to remove the worm, or do it manually such as <a href="https://interviewquestions.tuteehub.com/tag/registry-1182422" style="font-weight:bold;" target="_blank" title="Click to know more about REGISTRY">REGISTRY</a> and system32. Then make an effort to always update your virus signatures, and discipline yourself not to run unknown <br/>executables anyhow.<br/><br/> Quote<blockquote><strong>Question 3</strong><br/>I have a batch file called "Test.bat". Look below.<br/> Code: <a>[Select]</a>echo off<br/>echo Type Your Score.<br/>set/p score=><br/>echo %score% >>Score.txt<br/>pause<br/>echo View your score.<br/>type score.txt<br/>pause<br/>exit<br/>And a Text file called "Score.txt"<br/> Code: <a>[Select]</a>score 76<br/>score 89<br/>score 85<br/>score 67<br/>I want my batch file to display only the score in line three char six that is 85. How can i do that?<br/></blockquote> again, if you have downloaded sed<br/> Code: <a>[Select]</a>C:\test>sed -n "3s/^score //p" score.txt<br/>85<br/><br/> Quote<blockquote><strong>Question 4</strong><br/>In my drive "G:\Junk" have a lot of subfolder, jpg, mp3, txt, bat and a lot of junk in it.<br/>But an error occured when i try to remove the "G:\Junk" using batch command:<br/>Cannot remove directory because the directory is not empty<br/>What must i do?<br/></blockquote> If it says its not empty, then go empty them...or you can "force" deletion using switches from some of the delete commands eg del, deltree..etc...<br/><br/> Quote<blockquote>ONE QUESTION RIGHT GET 25 MARKS. I WILL BE APPRECIATED IF ANYONE GOT MOST OF THE QUESTION RIGHT.<br/></blockquote> next time, try to research a bit on the internet as well.. Quote from: ghostdog74 on July 18, 2010, 07:56:43 PM<blockquote>you can use a file processing tool, such as <a href="http://gnuwin32.sourceforge.net/packages/sed.htm">sed for windows</a>.<br/></blockquote> Can you give me a script that don't need to download "sed"?<br/>Because machine without "sed" will not be able to run the program.progmer, why did you choose such an irritating way of asking your questions? It is bound to limit the help that you get.<br/></body></html> | |