Explore topic-wise InterviewSolutions in Microsoft.

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your Microsoft knowledge and support exam preparation. Choose a topic below to get started.

8851.

Solve : Multi Open Folder in a Local Area Network?

Answer» <html><body><a href="https://interviewquestions.tuteehub.com/tag/multi-549982" style="font-weight:bold;" target="_blank" title="Click to know more about MULTI">MULTI</a> Open folder.<br/>What can I use to open a folder in one of my pc :<br/><br/>Example :<br/><br/>c:\folder1\folder2<br/><br/>and the rest of my pc in the local area network ?<br/><br/>By example<br/><br/>c:\folder1\folder2<br/><br/>\\pm-7fg7fjkl432a\folder1\folder2<br/>\\jose-a0555092b\folder1\folder2<br/><br/>where pm-7fg7fjkl432a is the equipment <a href="https://interviewquestions.tuteehub.com/tag/name-237998" style="font-weight:bold;" target="_blank" title="Click to know more about NAME">NAME</a>.<br/><br/>Best Regards<br/><br/><br/>A sort of a rules folder launcher.<br/>May be with possible selection of several rules pre-established<br/><br/>I usually have the same folders in my three pc, but not all folders.<br/><br/>I would like to get a initial folder selection. I can <a href="https://interviewquestions.tuteehub.com/tag/introduce-499570" style="font-weight:bold;" target="_blank" title="Click to know more about INTRODUCE">INTRODUCE</a> in the batch file the name of the <a href="https://interviewquestions.tuteehub.com/tag/computers-21658" style="font-weight:bold;" target="_blank" title="Click to know more about COMPUTERS">COMPUTERS</a> in the local area network<br/>And the program search and open the folders with the same name and path in the LAN. <br/><br/>Trying to figure out what you want to do... what about mapping the path to a drive letter such as <br/><br/>\\pm-7fg7fjkl432a\folder1\folder2 mapped as say Y:\&gt;<br/>\\jose-a0555092b\folder1\folder2 mapped as say Z:\&gt;<br/><br/>You then would be able to go to specific system by drive letter.It's a splendid idea. <br/><br/>Best Regards<br/><br/></body></html>
8852.

Solve : batch file wont back to prompt?

Answer» <html><body><p>hi there<br/>'<br/>cd\<br/>cd windows<br/>and there is no <a href="https://interviewquestions.tuteehub.com/tag/wait-1448592" style="font-weight:bold;" target="_blank" title="Click to know more about WAIT">WAIT</a> for type commands such as dir , copy , ...<br/>its end immediately-i want <a href="https://interviewquestions.tuteehub.com/tag/batch-893737" style="font-weight:bold;" target="_blank" title="Click to know more about BATCH">BATCH</a> file wait for my commands-<br/>can i do this?<br/>by the way thankuopen a command window:<br/>start|run<br/>then type <a href="https://interviewquestions.tuteehub.com/tag/cmd-920083" style="font-weight:bold;" target="_blank" title="Click to know more about CMD">CMD</a> and either press return or click OK<br/>If you are running a batch file from Windows Explorer by double <a href="https://interviewquestions.tuteehub.com/tag/clicking-918872" style="font-weight:bold;" target="_blank" title="Click to know more about CLICKING">CLICKING</a> it, it will just vanish when it has completed all the commands. It sounds like what you want is a command prompt window, so do what gpl said.<br/>add cmd at end</p></body></html>
8853.

Solve : administrative level command prompt?

Answer» <html><body><p>HI,<br/>My internet explorer8 runs slow,Ive read that opening up the <a href="https://interviewquestions.tuteehub.com/tag/administrative-850216" style="font-weight:bold;" target="_blank" title="Click to know more about ADMINISTRATIVE">ADMINISTRATIVE</a> level command prompt and typing regsvr32actprxy.dll then pressing enter will work, I did type cmd in run window but I didn't see enter. How do I open the administrative level command prompt??This "tweak" can only be done in Vista and Windows 7. <br/><br/><a href="https://interviewquestions.tuteehub.com/tag/quote-1175222" style="font-weight:bold;" target="_blank" title="Click to know more about QUOTE">QUOTE</a> from: hollymwebster on July 20, 2011, 10:20:38 AM</p><blockquote>How do I open the administrative level command prompt?</blockquote><br/>Type cmd in the Start menu Search <a href="https://interviewquestions.tuteehub.com/tag/box-401352" style="font-weight:bold;" target="_blank" title="Click to know more about BOX">BOX</a>, right-click the Cmd.exe shortcut, and then choose Run As Administrator.<br/><br/>Quote from: hollymwebster on July 20, 2011, 10:20:38 AM<blockquote>typing regsvr32actprxy.dll</blockquote><br/>1. You need a space between regscr32 and actprxy.dll like this regsvr32 actxprxy.dll <br/><br/>2. It probably won't do anything.<br/><br/>Quote from: hollymwebster on July 20, 2011, 10:20:38 AM<blockquote>I didn't see enter.</blockquote><br/>This is Enter. You press it with your finger.<br/><br/><br/>open start and type cmd and press CTRL+SHIFT+ENTER</body></html>
8854.

Solve : how to install dos using bios??

Answer» <html><body><p>hey ,i <a href="https://interviewquestions.tuteehub.com/tag/really-1178981" style="font-weight:bold;" target="_blank" title="Click to know more about REALLY">REALLY</a> need some help here..., i dont know how to install this ms-dos os. i've downloaded ms-dos 6.2 or something &amp; i've burned it into a <a href="https://interviewquestions.tuteehub.com/tag/cd-236847" style="font-weight:bold;" target="_blank" title="Click to know more about CD">CD</a>.. what next?It must be an illegal copy since MS-DOS only comes legally on floppy disks. No help with piracy.<br/>to install a os from a compact disk go into the bios and set your cd-rom drive to boot <a href="https://interviewquestions.tuteehub.com/tag/first-461760" style="font-weight:bold;" target="_blank" title="Click to know more about FIRST">FIRST</a>, insert disk and restart and follow prompts, NOTE: i dont think ms-dos can be installed from a cdQuote from: a117yogi on June 03, 2011, 01:29:29 PM</p><blockquote>to install a os from a compact disk go into the bios and set your cd-rom drive to boot first, insert disk and restart and follow prompts, NOTE: i dont think ms-dos can be installed from a cd<br/></blockquote>If you have a legal copy of MS-DOS, it must be installed to a <a href="https://interviewquestions.tuteehub.com/tag/small-1212368" style="font-weight:bold;" target="_blank" title="Click to know more about SMALL">SMALL</a> drive that has a format compatible with that version of DOS. And the drive must be the active drive.<br/>Hard to give more <a href="https://interviewquestions.tuteehub.com/tag/specific-250096" style="font-weight:bold;" target="_blank" title="Click to know more about SPECIFIC">SPECIFIC</a> instructions without knowing your system details. But way would you want to install DOS 6.22 anyway? Topic Closed.</body></html>
8855.

Solve : MS-DOS 6.2 Step-up Files?

Answer» <html><body><p>An older MS-DOS computer can step up to MS-DOS 6.2 free.<br/>Quote</p><blockquote>MS-DOS 6.2 Step-up <a href="https://interviewquestions.tuteehub.com/tag/files-20889" style="font-weight:bold;" target="_blank" title="Click to know more about FILES">FILES</a> - Download.com<br/># Quick specs<br/># Version: 1<br/># Date added: August 24, 2007<br/># Price: Free<br/># Operating system:<br/># Total Downloads: 22,447<br/># Downloads last week: <a href="https://interviewquestions.tuteehub.com/tag/78-242737" style="font-weight:bold;" target="_blank" title="Click to know more about 78">78</a><br/>Read more: MS-DOS 6.2 Step-up Files - Free software downloads and software reviews - CNET Downloads <a href="https://download.cnet.com/MS-DOS-6-2-Step-up-Files/3000-2072_4-10729964.html#ixzz1OGpgb038">http://download.cnet.com/MS-DOS-6-2-Step-up-Files/3000-2072_4-10729964.html#ixzz1OGpgb038</a><br/></blockquote>The above was quoted today. Apparently 78 people last week did the download. No explanation of why they would do this.<br/>Is it legal? On y if you have a computer.<br/>No, it's totally illegal, Microsoft is trying to trick people by putting <a href="https://support.microsoft.com/kb/117417">this</a> up.Quote from: BC_Programmer on June 03, 2011, 09:03:36 PM<blockquote>No, it's totally illegal, Microsoft is trying to trick people by putting <a href="https://support.microsoft.com/kb/117417">this</a> up.<br/></blockquote><em>It's a conspiracy</em> Quote from: Geek-9pm on June 03, 2011, 08:36:59 PM<blockquote>An older MS-DOS computer can step up to MS-DOS 6.2 free.</blockquote><br/>Not <a href="https://interviewquestions.tuteehub.com/tag/quite-1175131" style="font-weight:bold;" target="_blank" title="Click to know more about QUITE">QUITE</a>. It's 6.22 (the last MS-DOS) that they can step up to. And only from a lower version 6.xx. That is, to use the MS-DOS 6.22 Step-Up, your computer <a href="https://interviewquestions.tuteehub.com/tag/must-1702064" style="font-weight:bold;" target="_blank" title="Click to know more about MUST">MUST</a> be running MS-DOS 6, 6.2, or 6.21. (I told you this about 2 weeks ago.) It's been available since at least 1999. Don't get the Step-Up confused with MS-DOS 6.x upgrade for older <a href="https://interviewquestions.tuteehub.com/tag/versions-244825" style="font-weight:bold;" target="_blank" title="Click to know more about VERSIONS">VERSIONS</a> of MS-DOS (3.0 to 5.0) which you had to pay for. <br/><br/>Quote<blockquote>No explanation of why they would do this.</blockquote><br/>None needed. They have MS-DOS 6, 6.2 or 6.21 installed and they want to update as much as they can.<br/><br/>Quote<blockquote>Is it legal? On y if you have a computer.</blockquote><br/>I don't really see the point of these remarks. Is this some kind of running joke?<br/><br/>You do realise that this isn't a complete MS-DOS install set? You may as well think of it as a "Service Pack" for the versions of MS-DOS 6 before 6.22.<br/><br/><br/><br/><br/></body></html>
8856.

Solve : How do you add line breaks when writing to a notepad file??

Answer» <html><body><p>How do you add <a href="https://interviewquestions.tuteehub.com/tag/line-239358" style="font-weight:bold;" target="_blank" title="Click to know more about LINE">LINE</a> <a href="https://interviewquestions.tuteehub.com/tag/breaks-903929" style="font-weight:bold;" target="_blank" title="Click to know more about BREAKS">BREAKS</a> when using <a href="https://interviewquestions.tuteehub.com/tag/dos-432778" style="font-weight:bold;" target="_blank" title="Click to know more about DOS">DOS</a> to write to a text document?<br/><br/>Example:<br/><br/>echo blahblah blah &gt; test.txt<br/>(Insert line break here)<br/>echo blahblah &gt; test.txtCode: <a>[Select]</a>echo blahblah blah &gt; test.txt<br/>REM (Insert line break here)<br/>echo blahblah &gt;&gt; test.txt<br/><br/>Code: <a>[Select]</a>echo. &gt;&gt;text.txt<br/>Quote from: Geek-9pm on July <a href="https://interviewquestions.tuteehub.com/tag/24-240258" style="font-weight:bold;" target="_blank" title="Click to know more about 24">24</a>, 2011, 05:46:18 PM</p><blockquote>Code: <a>[Select]</a>whatever<br/></blockquote><br/>rolls eyes<br/></body></html>
8857.

Solve : How do you add several requirments to one "if" command??

Answer» <html><body><p>I couldn't find the right way to say this, but:<br/><br/>if %var%==(several variables here)<br/><br/>so like:<br/><br/>if %var%==a,b,c,d,e,<a href="https://interviewquestions.tuteehub.com/tag/f-236701" style="font-weight:bold;" target="_blank" title="Click to know more about F">F</a>,g<br/><br/>I just don't know how you would put it.<br/><br/>Thanks.You can nest the if statements.<br/>1. In Batch nested nIFs are used often.<br/>2. You and use the AND operator.<br/>3. You can aggregate results.<br/>(pseudo code)<br/>set got to zero<br/>if var is a bump got<br/>if var is b bump got<br/>if var is c bump got<br/>if got is 3 say 'got all'<br/>If got is 0 say 'got nada'<br/><br/>But I don't think that is what you want. <br/><br/>Do you want a CASE block? It is not native to batch files.<br/>(pseudo code)<br/>CASE BEGIN<br/> var = a goto isa<br/> var = b goto isb<br/> var = c goto isc<br/>END CASE<br/><br/>You would have more tools in a script language like Vb script.<br/>Code: <a>[Select]</a> Select Case testexpression<br/> [Case expressionlist-n<br/> [statements-n]] . . .<br/> [Case Else<br/> [elsestatements-n]]<br/> End Select<br/>I'm sort of new, but really I just want to be <a href="https://interviewquestions.tuteehub.com/tag/able-361137" style="font-weight:bold;" target="_blank" title="Click to know more about ABLE">ABLE</a> to have several possibilities on one "if" <a href="https://interviewquestions.tuteehub.com/tag/command-11508" style="font-weight:bold;" target="_blank" title="Click to know more about COMMAND">COMMAND</a>.<br/><br/>I'm sorry if that doesn't make sense.<br/><br/>So like:<br/><br/>on "if %var%==1,2,3,4,5"<br/><br/>if either 1 through 5 is entered, it will execute a command <br/><br/>but is that the correct format for the command, or do I have to use an "and" command?<br/><br/>if so, Can I have some examples?<br/><br/><br/><br/><br/>Thanks a bunch. AS has been said, batch does not have a multiple - If command, nor a CASE <a href="https://interviewquestions.tuteehub.com/tag/statement-16478" style="font-weight:bold;" target="_blank" title="Click to know more about STATEMENT">STATEMENT</a>. You have to get crafty.<br/><br/>If a,b,c,d,e are consecutive numbers e.g. 1 to 5 then you can do this<br/><br/>if %var% GTR 0 (<br/>if %var% LSS <a href="https://interviewquestions.tuteehub.com/tag/6-237686" style="font-weight:bold;" target="_blank" title="Click to know more about 6">6</a> (<br/>goto pass<br/>)<br/>)<br/>echo Bad value!<br/>goto end<br/><br/>:pass<br/>echo Good value!<br/>:end<br/><br/>Otherwise you must test for the values individually<br/><br/><br/>if "%var%"=="a" goto pass<br/>if "%var%"=="b" goto pass<br/>if "%var%"=="c" goto pass<br/>if "%var%"=="d" goto pass<br/>if "%var%"=="e" goto pass<br/>echo Bad value!<br/>goto end<br/><br/>:pass<br/>echo Good value!<br/>:end<br/><br/>Or you could use some FOR loop trickery but I won't put that here. Bill's around!<br/><br/><br/></p></body></html>
8858.

Solve : move the files from one folder to another in VSS using MS-DOS commands?

Answer» <html><body><p>Hi,<br/><br/>move the files from one folder to another in VSS using MS-DOS commands<br/><br/>For Ex, I have file in the path in VSS $/BaseReleasesFolder/subfolder/ASP coder/test.asp file to $/BaseReleasesFolder/subfolder/C# coder path folder, in this how to cove the Test.asp file to the other folder.<br/><br/>Appriciate your <a href="https://interviewquestions.tuteehub.com/tag/support-771795" style="font-weight:bold;" target="_blank" title="Click to know more about SUPPORT">SUPPORT</a>,<br/><br/>Thanks,<br/><a href="https://interviewquestions.tuteehub.com/tag/divakar-440997" style="font-weight:bold;" target="_blank" title="Click to know more about DIVAKAR">DIVAKAR</a>. Are you trying to <a href="https://interviewquestions.tuteehub.com/tag/create-427332" style="font-weight:bold;" target="_blank" title="Click to know more about CREATE">CREATE</a> a batch file, or a VSS whatever?<br/>'Cause in a batch file, you <a href="https://interviewquestions.tuteehub.com/tag/would-3285927" style="font-weight:bold;" target="_blank" title="Click to know more about WOULD">WOULD</a> use the move command.<br/>Look here: MS-DOS Move Command<a href="https://msdn.microsoft.com/en-us/library/asxkfzy4%28v=vs.80%29.aspx">http://msdn.microsoft.com/en-us/library/asxkfzy4%28v=vs.80%29.aspx</a></p></body></html>
8859.

Solve : Batch script for every file found in a given directory.?

Answer» <html><body><p>Hello guys,<br/><br/>I have a <a href="https://interviewquestions.tuteehub.com/tag/kodak-534162" style="font-weight:bold;" target="_blank" title="Click to know more about KODAK">KODAK</a> Zi8 pocket <a href="https://interviewquestions.tuteehub.com/tag/camcorder-7660803" style="font-weight:bold;" target="_blank" title="Click to know more about CAMCORDER">CAMCORDER</a> and i'm using a command line tool ffmpeg to remux the mov files to mp4, this works <a href="https://interviewquestions.tuteehub.com/tag/like-537196" style="font-weight:bold;" target="_blank" title="Click to know more about LIKE">LIKE</a> it should but i'm trying to automate the proces for all *.mov files found in a given directory.<br/><br/>At this moment i'm using:<br/><br/><a href="https://interviewquestions.tuteehub.com/tag/code-25512" style="font-weight:bold;" target="_blank" title="Click to know more about CODE">CODE</a>: <a>[Select]</a>@echo off<br/>ffmpeg -y -i %1.mov -acodec copy -vcodec copy %1.mp4<br/>I have to use this for all my mov files. How can I adjust the script so that it scans a given directory for mov files and <a href="https://interviewquestions.tuteehub.com/tag/runs-246860" style="font-weight:bold;" target="_blank" title="Click to know more about RUNS">RUNS</a> the ffmpeg tool on each of them automatically?<br/><br/>Many thanksCode: <a>[Select]</a>for /f "delims=" %%A in ('dir /b *.mov') do ffmpeg -y -i "%%~dpnxA" -acodec copy -vcodec copy "%%~dpnA.mp4"Many thanks! <br/><br/>This seems to be working as it should!<br/><br/></p></body></html>
8860.

Solve : File Rename?

Answer» <html><body><p>Hi All,<br/>I need to rename over 200 files. Right now they are named LLLL1.YYYYMMDD they need to end up with not changing the date <a href="https://interviewquestions.tuteehub.com/tag/stamp-248975" style="font-weight:bold;" target="_blank" title="Click to know more about STAMP">STAMP</a> at the end but only changing the front part so LLLL1.20100807 would end up being V0116.20100807 and the <a href="https://interviewquestions.tuteehub.com/tag/next-578185" style="font-weight:bold;" target="_blank" title="Click to know more about NEXT">NEXT</a> would be V0116.20100808....etc.<br/><br/>Any help doing this would be great.<br/><br/>Thanks<br/><br/>Hi All,<br/>I found a free download that can rename files and was easy to run. I am all set.<br/><br/>Thanks<br/><a href="https://interviewquestions.tuteehub.com/tag/ok-1127144" style="font-weight:bold;" target="_blank" title="Click to know more about OK">OK</a>...<br/><br/>Don't tell us what it was...<br/><br/> You are right Patio. I should have posted a link or something about it.<br/><br/><a href="http://www.bulkrenameutility.co.uk/Main_Intro.php">http://www.bulkrenameutility.co.uk/Main_Intro.php</a><br/><br/>It looks like a pain to learn but comes with a ok help file. I was able to download it and rename about 250 files in under 10 mins. <br/><br/>And its for free! <br/><br/><br/>Nice...<br/>And i wasn't pickin on you Spoiler... Poetry... Stan <a href="https://interviewquestions.tuteehub.com/tag/mann-554219" style="font-weight:bold;" target="_blank" title="Click to know more about MANN">MANN</a>... evading a ban! <a href="https://interviewquestions.tuteehub.com/tag/goodbye-1009860" style="font-weight:bold;" target="_blank" title="Click to know more about GOODBYE">GOODBYE</a> Bill.<br/><br/><br/><br/><br/><br/>this should work:<br/><br/>ren LLLL1.* V0116.*More poetry: Spoil Name, you're banned! For shame! So long, Bill.<br/><br/><br/></p></body></html>
8861.

Solve : Problem with script to replace substrings in file, *censored* truncating!?

Answer» <html><body><p>Hi, so I have created a batch file to replace each occurence of the <a href="https://interviewquestions.tuteehub.com/tag/substring-11353" style="font-weight:bold;" target="_blank" title="Click to know more about SUBSTRING">SUBSTRING</a> "sid" in a reg file with the usersid.<br/>The only problem is some of the <a href="https://interviewquestions.tuteehub.com/tag/data-25577" style="font-weight:bold;" target="_blank" title="Click to know more about DATA">DATA</a> gets truncated.<br/>Consider this batch file:<br/><br/>@echo off<br/>;Get sid from file<br/>set /p usersid= <br/>SETLOCAL DISABLEDELAYEDEXPANSION<br/>FOR /F %%L IN (sandboxie.reg) DO (<br/> SET "line=%%L"<br/> SETLOCAL ENABLEDELAYEDEXPANSION<br/> ECHO !line:sid=%usersid%!&gt;&gt;out.reg<br/> ENDLOCAL<br/>)<br/>ENDLOCAL<br/><br/><br/><strong>out.reg:</strong><br/><br/>[HKEY_USERS\S-1-5-21-789336058-1580436667-515967899-500_Classes\*\shell\sandbox]<br/>"Icon"="\"C:\\Program<br/>[HKEY_USERS\S-1-5-21-789336058-1580436667-515967899-500_Classes\*\shell\sandbox\command]<br/>[HKEY_USERS\S-1-5-21-789336058-1580436667-515967899-500_Classes\*\shell\sandbox\command]<br/>@="\"C:\\Program<br/>[HKEY_USERS\S-1-5-21-789336058-1580436667-515967899-500_Classes\Folder]<br/>[HKEY_USERS\S-1-5-21-789336058-1580436667-515967899-500_Classes\Folder\shell]<br/>[HKEY_USERS\S-1-5-21-789336058-1580436667-515967899-500_Classes\Folder\shell\sandbox]<br/>[HKEY_USERS\S-1-5-21-789336058-1580436667-515967899-500_Classes\Folder\shell\sandbox]<br/>@="Run<br/>[HKEY_USERS\S-1-5-21-789336058-1580436667-515967899-500_Classes\Folder\shell\sandbox]<br/>"Icon"="\"C:\\Program<br/>[HKEY_USERS\S-1-5-21-789336058-1580436667-515967899-500_Classes\Folder\shell\sandbox\command]<br/>[HKEY_USERS\S-1-5-21-789336058-1580436667-515967899-500_Classes\Folder\shell\sandbox\command]<br/>@="\"C:\\Program<br/><br/><strong>sandboxie.reg:</strong><br/><br/>[HKEY_USERS\sid_Classes\*\shell\sandbox\command]<br/>@="\"C:\\Program Files\\Sandboxie\\Start.exe\" /box:__ask__ \"%1\" %*"<br/><br/>[HKEY_USERS\sid_Classes\Folder]<br/><br/>[HKEY_USERS\sid_Classes\Folder\shell]<br/><br/>[HKEY_USERS\sid_Classes\Folder\shell\sandbox]<br/><br/>[HKEY_USERS\sid_Classes\Folder\shell\sandbox]<br/>@="Run &amp;Sandboxed"<br/><br/>[HKEY_USERS\sid_Classes\Folder\shell\sandbox]<br/>"Icon"="\"C:\\Program Files\\Sandboxie\\Start.exe\""<br/><br/>[HKEY_USERS\sid_Classes\Folder\shell\sandbox\command]<br/><br/>[HKEY_USERS\sid_Classes\Folder\shell\sandbox\command]<br/>@="\"C:\\Program Files\\Sandboxie\\Start.exe\" /box:__ask__ Explorer.exe \"%1\""<br/><br/><br/>As you can see, the string: @="\"C:\\Program Files\\Sandboxie\\Start.exe\" /box:__ask__ Explorer.exe \"%1\""<br/>gets truncated to: @="\"C:\\Program<br/>in out.reg<br/><br/><strong>How do I fix the script to get proper output?</strong>Same truncation will <a href="https://interviewquestions.tuteehub.com/tag/occur-583012" style="font-weight:bold;" target="_blank" title="Click to know more about OCCUR">OCCUR</a> on any line containing a space.<br/><br/>Space is one of the default delimiters in a For loop so as soon as the space after Program is encountered that's the end of the line.<br/><br/>Suggest you use For /f "tokens=*" .....etc so that the text line is <a href="https://interviewquestions.tuteehub.com/tag/treated-1426908" style="font-weight:bold;" target="_blank" title="Click to know more about TREATED">TREATED</a> as one and not delimited.<br/><br/>Welcome to the CH forums &amp; hope this helps.Appreciate! That worked Thanks for coming back to <a href="https://interviewquestions.tuteehub.com/tag/report-25448" style="font-weight:bold;" target="_blank" title="Click to know more about REPORT">REPORT</a> your success..</p></body></html>
8862.

Solve : ANSI esc Code help. Input on bottom, output on top.?

Answer» <html><body><p>I am modding my MS-DOS 7.10 prompt to look like the colsoles in Fallout 3, the RobCo Unified Operating System. The input is on the bottom, and the <a href="https://interviewquestions.tuteehub.com/tag/output-344913" style="font-weight:bold;" target="_blank" title="Click to know more about OUTPUT">OUTPUT</a> in in the middle, after the standard watermark thingy. This is what I have in autoexec.bat.<br/>Code: <a>[Select]</a>PROMPT $e[=3l$e[25;1H$e[0;32;40m$gWhen I enter a command, the output goes to the bottom, the page refreshes, and the output dissapears. I want the output to go to the top. How?<br/>All answers appreciated.<br/>Quote</p><blockquote>All answers appreciated.</blockquote>Sorry, I don't know. <br/>- However,<br/>In the search box on the upper right, <a href="https://interviewquestions.tuteehub.com/tag/type-238192" style="font-weight:bold;" target="_blank" title="Click to know more about TYPE">TYPE</a> in ANSI and click the search bottom. This site has a collection of over 100 articles or threads on the use of <strong>ANSI</strong> for <a href="https://interviewquestions.tuteehub.com/tag/making-1085093" style="font-weight:bold;" target="_blank" title="Click to know more about MAKING">MAKING</a> special console layouts or in in DOS. Including color, <a href="https://interviewquestions.tuteehub.com/tag/text-11613" style="font-weight:bold;" target="_blank" title="Click to know more about TEXT">TEXT</a> size and <a href="https://interviewquestions.tuteehub.com/tag/even-976335" style="font-weight:bold;" target="_blank" title="Click to know more about EVEN">EVEN</a> graphics.<br/>Like This...<br/>Also, have you looked over this resource?<br/><a href="https://en.wikipedia.org/wiki/ANSI_escape_code">http://en.wikipedia.org/wiki/ANSI_escape_code</a><br/><br/>Is this for some kind of presentation or prototype?Well, I have figured out my problem. When the prompt refreshes, it clears the screen with the $e[3l. I have removed that and it's working fine. And I had already read almost all documentation on ANSI. I was refered by another person on Tom's Hardware.</body></html>
8863.

Solve : create an exact copy with date in batch file?

Answer» <html><body><p>Hi,<br/><br/>I have a question and try to make it simple. I want to create a batch for backup purposes.<br/><br/>The source is C:\Data<br/><br/>The destination is E:\<br/><br/>I'd like to create a directory called Data in E drive with the date next to it, for example Data 20 September 2011. The format of the date does not really matter.<br/><br/>So far I have got the following<br/>@<a href="https://interviewquestions.tuteehub.com/tag/echo-11626" style="font-weight:bold;" target="_blank" title="Click to know more about ECHO">ECHO</a> off<br/>robocopy "C:\Data" "E:\..." /MIR<br/>pause<br/><br/>I want to be able to make another exact copy of the folder "Data" and call it "Data" with date attached to it.<br/><br/>Any help would be greatly appreciated.<br/><br/>Thank youuse %date% variable wherever you want<br/><br/>robocopy "C:\Data" "E:\Data%date%\" /MIR<br/><br/>should work, if not its something like thatQuote from: a117yogi on June 03, 2011, 02:01:04 PM</p><blockquote>use %date% variable wherever you want</blockquote><br/>This is nonsense if %date% contains slashes. Like "03/06/2011". Which is what %date% says here.<br/><br/>Quote<blockquote>should work, if not its something like that</blockquote><br/>Please do not post wild guesses. Or "something like that". Just tested solutions. Ones that work. <br/>for /f "tokens=1-5 delims=/ " %%d in ("%date%") do robocopy "C:\Data" "E:\data-%%e-%%f-%%g" /MIR<br/><br/>better?Quote from: a117yogi on June 03, 2011, 03:32:24 PM<blockquote>for /f "tokens=1-5 delims=/ " %%d in ("%date%") do robocopy "C:\Data" "E:\data-%%e-%%f-%%g" /MIR<br/><br/>better?<br/></blockquote><br/>OK, but why don't you address the issue of differing local date formats?<br/>This getdate batch comes in handy to determine the date fields without having to read the <a href="https://interviewquestions.tuteehub.com/tag/registry-1182422" style="font-weight:bold;" target="_blank" title="Click to know more about REGISTRY">REGISTRY</a>:<br/>Here is my version of GetDate.bat. I've tried it in all the 'English' date formats in XP, Vista, Win7.<br/>If you pass the name of an environment variable ( no %'s in the argument) it will get set to the current date.<br/>yyyymmdd is returned in the errorlevel as a number but it can be used as %ymd% for an 8 digit date with no separaters.<br/><br/>Code: <a>[Select]</a>@echo off&amp;SetLocal EnableDelayedExpansion&amp;goto :start<br/>:GetDate.bat [EnVar]<br/>echo.GetDate [EnVar] Sets date into environment variable, EnVar as: mm-dd-yyyy<br/>echo.Usage: GetDate mdy^&amp;set ymd=%%errorlevel%%, ^(use %% rather than ^^! in command line)<br/>echo.Usage: GetDate mdy^&amp;set ymd=^^!errorlevel^^!, ^(use ^^! rather than %% in script^)<br/>echo.If no argument passed it echo's the date in mm-dd-yyyy format<br/>echo.Returns yyyymmdd in errorlevel regardless if Envar is passed as argument or not<br/>echo.Works on any NT/2K/XP/Vista/Win7 machine independent of regional date settings<br/>EndLocal&amp;exit /b<br/>:start<br/>set p1=%~1&amp;if /i !p1! equ /? goto :GetDate<br/>for /f "tokens=1-4 delims=/-. " %%a in ("%date%") do call :s_fixdate %%a %%b %%c %%d<br/>if /i 1%yy% lss 20 set "yy=0%yy%"<br/>if /i %yy% lss 80 (set yy=20%yy%) else (if %yy% lss 100 set yy=19%yy%)<br/>if defined p1 EndLocal&amp;call set "%~1=%mm%-%dd%-%yy%"&amp;exit /b %yy%%mm%%dd%<br/>EndLocal&amp;echo.%mm%-%dd%-%yy%&amp;exit /b %yy%%mm%%dd%<br/><br/>:s_fixdate<br/>if /i "%1:~0,1%" gtr "9" shift<br/>for /f "skip=1 tokens=<a href="https://interviewquestions.tuteehub.com/tag/2-236987" style="font-weight:bold;" target="_blank" title="Click to know more about 2">2</a>-4 delims=(-)" %%e in ('date^&lt;nul') do (<br/> set %%e=%1&amp;set %%f=%2&amp;set %%g=%3<br/>)<br/>exit /b<br/><br/>I have some other groovy command line and script friendly date and date math routines if anyone is interested.<br/><br/>carlsomoQuote from: Salmon Trout on June 03, 2011, 05:02:54 PM<blockquote>OK, but why don't you address the issue of differing local date formats?<br/></blockquote><br/>he said format is not a problem, read first postQuote from: a117yogi on June 04, 2011, 08:48:55 PM<blockquote>he said format is not a problem, read first post<br/></blockquote><br/>I'm talking about your "solution" which does not work for every local date format.Here is the updated solution to get the current date set in mm-dd-yyyy<br/>This is a batch file that does not have to read the registry<br/>if you pass a variable name as argument it gets set to the date in mm-dd-yyyy<br/>errorlevel is set to yyyymmdd<br/><br/>It can now handle the 05-Jun-11 format with minor modifications to what i posted prior.<br/><br/>Code: <a>[Select]</a>@echo off&amp;SetLocal EnableDelayedExpansion&amp;goto :start<br/>:GetDate [EnVar]<br/>echo.GetDate [EnVar] Sets date into environment variable, EnVar as: mm-dd-yyyy<br/>echo.Usage: GetDate mdy^&amp;set ymd=%%errorlevel%%, ^(use %% rather than ^^! in command line)<br/>echo.Usage: GetDate mdy^&amp;set ymd=^^!errorlevel^^!, ^(use ^^! rather than %% in script^)<br/>echo.If no argument passed it echo's the date in mm-dd-yyyy format<br/>echo.Returns yyyymmdd in errorlevel regardless if Envar is passed as argument or not<br/>echo.Works on NT/2K/XP/Vista/Win7 machines independent of most regional date settings<br/>EndLocal&amp;exit /b<br/>:start<br/>set p1=%~1&amp;if /i !p1! equ /? goto :GetDate<br/>for /f "tokens=1-4 delims=/-. " %%a in ("%date%") do call :s_fixdate %%a %%b %%c %%d<br/>if /i 1%yy% lss 20 set "yy=0%yy%"<br/>if /i %yy% lss 80 (set yy=20%yy%) else (if %yy% lss 100 set yy=19%yy%)<br/>if defined p1 EndLocal&amp;call set "%~1=%mm%-%dd%-%yy%"&amp;exit /b %yy%%mm%%dd%<br/>EndLocal&amp;echo.%mm%-%dd%-%yy%&amp;exit /b %yy%%mm%%dd%<br/><br/>:s_fixdate<br/>if /i "%1:~0,1%" gtr "9" shift<br/>for /f "skip=1 tokens=2-4 delims=(-)" %%e in ('date^&lt;nul') do (<br/> set %%e=%1&amp;set %%f=%2&amp;set %%g=%3<br/>)<br/>if /i "%mm:~0,1%" gtr "9" call :month_convert mm<br/>exit /b<br/><br/>:month_convert<br/>SetLocal<br/>set "months=Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec"<br/>call set "month=%%%~1%%"<br/>for /l %%a in (1,1,12) do (<br/> set/a mon=%%a<br/> call :month_assign !mon!<br/> if /i !errorlevel! equ 0 (<br/> if /i 1!mon! lss 20 set "mon=0!mon!"<br/> goto :out<br/> )<br/>)<br/>:out<br/>EndLocal&amp;call set "%~1=%mon%"&amp;exit /b<br/><br/>:month_assign mnum<br/>set/a mnum=%~1<br/>for /f "tokens=%mnum%" %%m in ("%months%") do if /i %month% equ %%m exit /b 0<br/>exit /b 1<br/>Quote<blockquote>@echo off&amp;SetLocal EnableDelayedExpansion&amp;goto :start<br/>:GetDate [EnVar]<br/>echo.GetDate [EnVar] Sets date into environment variable, EnVar as: mm-dd-yyyy<br/>echo.Usage: GetDate mdy^&amp;set ymd=%%errorlevel%%, ^(use %% rather than ^^! in command line)<br/>echo.Usage: GetDate mdy^&amp;set ymd=^^!errorlevel^^!, ^(use ^^! rather than %% in script^)<br/>echo.If no argument passed it echo's the date in mm-dd-yyyy format<br/>echo.Returns yyyymmdd in errorlevel regardless if Envar is passed as argument or not<br/>echo.Works on NT/2K/XP/Vista/Win7 machines independent of most regional date settings<br/>EndLocal&amp;exit /b<br/>:start<br/>set p1=%~1&amp;if /i !p1! equ /? goto :GetDate<br/>for /f "tokens=1-4 delims=/-. " %%a in ("%date%") do call :s_fixdate %%a %%b %%c %%d<br/>if /i 1%yy% lss 20 set "yy=0%yy%"<br/>if /i %yy% lss 80 (set yy=20%yy%) else (if %yy% lss 100 set yy=19%yy%)<br/>if defined p1 EndLocal&amp;call set "%~1=%mm%-%dd%-%yy%"&amp;exit /b %yy%%mm%%dd%<br/>EndLocal&amp;echo.%mm%-%dd%-%yy%&amp;exit /b %yy%%mm%%dd%<br/><br/>:s_fixdate<br/>if /i "%1:~0,1%" gtr "9" shift<br/>for /f "skip=1 tokens=2-4 delims=(-)" %%e in ('date^&lt;nul') do (<br/> set %%e=%1&amp;set %%f=%2&amp;set %%g=%3<br/>)<br/>if /i "%mm:~0,1%" gtr "9" call :month_convert mm<br/>exit /b<br/><br/>:month_convert<br/>SetLocal<br/>set "months=Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec"<br/>call set "month=%%%~1%%"<br/>for /l %%a in (1,1,12) do (<br/> set/a mon=%%a<br/> call :month_assign !mon!<br/> if /i !errorlevel! equ 0 (<br/> if /i 1!mon! lss 20 set "mon=0!mon!"<br/> goto :out<br/> )<br/>)<br/>:out<br/>EndLocal&amp;call set "%~1=%mon%"&amp;exit /b<br/><br/>:month_assign mnum<br/>set/a mnum=%~1<br/>for /f "tokens=%mnum%" %%m in ("%months%") do if /i %month% equ %%m exit /b 0<br/>exit /b 1<br/></blockquote><br/>Zowie! There is enough code here to launch a space shuttle.<br/><br/>I was able to clean up the code and run it, but I'm unsure of my results or what to do with them. The code set an environmental variable with todays date (mm-dd-yyyy). With all due respect, can't this be done by parsing the %date% variable?<br/><br/>Quote<blockquote>This getdate batch comes in handy to determine the date fields without having to read the registry:<br/></blockquote><br/>Why not use the registry? The registry serves as a database for all the system settings, so why not go the source for this information?<br/><br/>The founder of KISS University must be spinning in his grave. Quote from: Sidewinder on June 06, 2011, 08:18:02 AM<blockquote>Why not use the registry? The registry serves as a database for all the system settings, so why not go the source for this information?</blockquote><br/>You mean like this?<br/><br/>Code: <a>[Select]</a>for /f "skip=2 tokens=3 delims= " %%A in ('reg query "HKEY_USERS\.DEFAULT\Control Panel\International" /v sShortDate') do echo %%A<br/>Quote<blockquote>The founder of KISS University must be spinning in his grave.</blockquote><br/>But his alumni are still around...<br/><br/>I was at the Advanced Studies School of that University, but I never abbreviate it.<br/><br/>The above line returns this here in the UK:<br/><br/>Code: <a>[Select]</a>dd/MM/yyyy<br/>Lots of other goodies... sCurrency, sLanguage, sTimeFormat, etcthe registry related satement:<br/>Code: <a>[Select]</a>for /f "skip=2 tokens=3 delims= " %%A in ('reg query "HKEY_USERS\.DEFAULT\Control Panel\International" /v sShortDate') do echo %%A<br/>certainly gives you M/d/yyyy or whatever format but let's say you wish to create 'yyyymmdd.filename.jpg'<br/>one still has to assign date variables once the format is known. Thus there is more code work to do.<br/><br/>In the end I can put this in a script:<br/>Code: <a>[Select]</a>call getdate today_mdy&amp;set today_ymd=!errorlevel!<br/>ren "filename.ext" "%today_ymd%.filename.ext"<br/>echo "filename.ext" was renamed to" %today_ymd%.filename.ext" on %today_mdy%&gt;&gt;file_rename.log<br/><br/>this statement:<br/>Code: <a>[Select]</a>for /f "skip=1 tokens=2-4 delims=(-)" %%e in ('date^&lt;nul') do set %%e=%1&amp;set %%f=%2&amp;set %%g=%3<br/>where %1 thru %4 came from parsing %date% in whatever format the user has on their machine<br/>makes the assignments in all of the formats, excluding "Mon 06/06/2011" (and/11) and "06-Jun-2011"<br/>ie. mm=06 dd=06 and yy=2011 (or 11) regardless of MM/dd/yyyy, yy/MM/dd, or yyyy/MM/dd<br/>The 'shift' containing statement strips "Mon 06/06/2011" to "06/06/2011" in the M/d/yyyy and M/d/yy formats prior to the for loop. The 'if' statement following and the called code below it is necessary to change 'Jun' to '06' (and not '6')<br/><br/>Since I am an admin I don't have a problem accessing the registry but limitted users may not in all cases.<br/>I was aware of the registry keys holding the date format but I decided to avoid it and I don't think that lengthened the overall code by much and the desired result pops out in less than a second (0.24 on my machine).<br/><br/>I posted here because I had already written the batch code (that I use all the time) and I wished to help the fellow who made the original post. Then Salmon rightly pointed out the "06-Jun-2011" format wasn't covered so I covered it for completeness sake.<br/><br/>Now I can run date related batch code on mutliple machines with differing operating systems and obtain the date (in the formats I use) without worrying about the regional setting or user preference on any given machine.<br/><br/>Now it's my turn.... Please shorten the routine using registry keys or whatever to return the date in two <a href="https://interviewquestions.tuteehub.com/tag/useful-1441152" style="font-weight:bold;" target="_blank" title="Click to know more about USEFUL">USEFUL</a> formats. My goal at the outset was not to write the shortest code possible but to get the job done as I have had routines blow up when running into differing formats everywhere I go.<br/><br/>Respectfully, CarlAn alternative to using <strong>sShortdate</strong> would be using <strong>iDate</strong> and <strong>sDate</strong> in the <strong>HKCU\Control Panel\International</strong> registry key. The<strong> iDate</strong> defines three values and three date formats (0=mm/dd/yy, 1=dd/mm/yy, and 2=yy/mm/dd). The <strong>sDate</strong> value defines the separator which can be used as the delimeter in a <strong>for</strong> statement.<br/><br/>The only roadblock is that some machines display the day of week with the date command. This can be determined by using a regular expression in the <strong>findstr</strong> command. <br/><br/>Code: <a>[Select]</a>for /f "skip=2 tokens=3" %%a in ('reg query "HKEY_CURRENT_USER\Control Panel\International" /v iDate') do (<br/> set idate=%%a<br/>) <br/><br/>for /f "skip=2 tokens=3" %%a in ('reg query "HKEY_CURRENT_USER\Control Panel\International" /v sDate') do (<br/> set sdate=%%a<br/>) <br/><br/>:: If first <a href="https://interviewquestions.tuteehub.com/tag/character-242304" style="font-weight:bold;" target="_blank" title="Click to know more about CHARACTER">CHARACTER</a> of date is alpha, presume DOW<br/>::<br/>echo %date:~0,1% | findstr /r "[A-Z]" &gt; nul<br/><br/>if errorlevel 1 (<br/> for /f "tokens=1-3* delims=%sdate% " %%a in ('date /t') do (<br/> if %idate%==0 (set year=%%c &amp; set month=%%a &amp; set day=%%b)<br/> if %idate%==1 (set year=%%c &amp; set month=%%b &amp; set day=%%a)<br/> if %idate%==2 (set year=%%a &amp; set month=%%b &amp; set day=%%c)<br/> ) <br/>) else (<br/> for /f "tokens=1-4* delims=%sdate% " %%a in ('date /t') do (<br/> if %idate%==0 (set year=%%d &amp; set month=%%b &amp; set day=%%c)<br/> if %idate%==1 (set year=%%d &amp; set month=%%c &amp; set day=%%b)<br/> if %idate%==2 (set year=%%b &amp; set month=%%c &amp; set day=%%d)<br/> ) <br/>)<br/><br/>Once the date components (month, day, year) are isolated, it should be childs play to format them any which way.<br/><br/>Just a thought. VBScript hybrid...<br/><br/>Code: <a>[Select]</a>@echo off<br/>echo Wscript.echo eval(WScript.Arguments(0))&gt;evaluate.vbs<br/>for /f "delims=" %%A in ('cscript //nologo evaluate.vbs "FormatDateTime(Now, 0)"') do echo FormatDateTime(Now, 0) %%A<br/>for /f "delims=" %%A in ('cscript //nologo evaluate.vbs "FormatDateTime(Now, 1)"') do echo FormatDateTime(Now, 1) %%A<br/>for /f "delims=" %%A in ('cscript //nologo evaluate.vbs "FormatDateTime(Now, 2)"') do echo FormatDateTime(Now, 2) %%A<br/>for /f "delims=" %%A in ('cscript //nologo evaluate.vbs "FormatDateTime(Now, 3)"') do echo FormatDateTime(Now, 3) %%A<br/>for /f "delims=" %%A in ('cscript //nologo evaluate.vbs "FormatDateTime(Now, 4)"') do echo FormatDateTime(Now, 4) %%A<br/>for /f "delims=" %%A in ('cscript //nologo evaluate.vbs "Year (Date)"') do echo Year(Date) %%A<br/>for /f "delims=" %%A in ('cscript //nologo evaluate.vbs "Month(Date)"') do if %%A lss 10 (<br/> echo Month^(Date^) 0%%A<br/> ) else (<br/> echo Month^(Date^) %%A<br/> )<br/>for /f "delims=" %%A in ('cscript //nologo evaluate.vbs "Day (Date)"') do if %%A lss 10 (<br/> echo Day^(Date^) 0%%A<br/> ) else (<br/> echo Day^(Date^) %%A<br/> )<br/>Code: <a>[Select]</a>FormatDateTime(Now, 0) 07/06/2011 08:20:15 PM<br/>FormatDateTime(Now, 1) 07 June 2011<br/>FormatDateTime(Now, 2) 07/06/2011<br/>FormatDateTime(Now, 3) 08:20:16 PM<br/>FormatDateTime(Now, 4) 20:20<br/>Year(Date) 2011<br/>Month(Date) 06<br/>Day(Date) 07Thank you for the informative response. I've noticed that you give a lot of your time to help share your knowledge and respond to querries and conundrums. I wish more people had that attitude.</body></html>
8864.

Solve : Batch file: find and delete?

Answer» <html><body><p>Hi, I need to <a href="https://interviewquestions.tuteehub.com/tag/write-746491" style="font-weight:bold;" target="_blank" title="Click to know more about WRITE">WRITE</a> 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> that <a href="https://interviewquestions.tuteehub.com/tag/reads-620044" style="font-weight:bold;" target="_blank" title="Click to know more about READS">READS</a> a txt file that contains a number of file <a href="https://interviewquestions.tuteehub.com/tag/paths-1148968" style="font-weight:bold;" target="_blank" title="Click to know more about PATHS">PATHS</a>, then it should remove the chosen string from each line and copy into a new file e.g.<br/><br/>List.txt contains:-<br/>C:\Projects\file1.txt<br/>C:\Projects\file2.c<br/>etc...<br/><br/>New_list.txt contains:-<br/>file1.txt<br/>file2.c<br/>etc...<br/><br/>I apologize if this question has been answered before, I've tried looking at some code for find/replace but I could not follow it. <br/>Any help will be greatly appreciated.<br/>Thank you<br/>If you just want to isolate the filename and extension from a string which represents the full path you can use FOR with the ~n and ~x modifiers.<br/><br/>Code: <a>[Select]</a>If exist New_list.txt del New_list.txt<br/>for /f "delims=" %%A in (list.txt) do @echo %%~nxA &gt;&gt;New_list.txtThank you for the response, I need to keep certain subfolders <a href="https://interviewquestions.tuteehub.com/tag/along-858258" style="font-weight:bold;" target="_blank" title="Click to know more about ALONG">ALONG</a> with the filename and extension. I also need to specify the string to remove but it will be the same string throughout the file e.g.<br/><br/>C:\Users\Projects\Monday\file1.txt --&gt;Monday\file1.txt <br/>C:\Users\Projects\Monday\Last\New\file2.c --&gt; Monday\Last\New\file2.c<br/><br/>or<br/><br/>H:\Projects\Monday\file1.txt --&gt;Monday\file1.txt <br/><br/><br/>You can read in each file path and name in turn using FOR and then use the replace in string function to remove the unwanted part of the string.<br/><br/>Code: <a>[Select]</a>@echo off<br/>setlocal enabledelayedexpansion<br/>set RemoveString=C:\Users\Projects\<br/><br/>echo %RemoveString%Cat.txt &gt; list.txt<br/>echo %RemoveString%Dog.txt &gt;&gt; list.txt<br/>echo %RemoveString%Hat.txt &gt;&gt; list.txt<br/>echo %RemoveString%Cow.txt &gt;&gt; list.txt<br/><br/>echo String to remove: %RemoveString%<br/>echo.<br/><br/>echo Input file:<br/>type list.txt<br/>echo.<br/><br/>If exist New_list.txt del New_list.txt<br/>for /f "delims=" %%A in (list.txt) do (<br/> set inputline=%%A<br/> set outputline=!inputline:%RemoveString%=!<br/> echo !outputline! &gt;&gt; New_list.txt<br/> )<br/><br/>echo Output file:<br/>type New_list.txt<br/>echo.<br/>Output<br/><br/>Code: <a>[Select]</a>String to remove: C:\Users\Projects\<br/><br/>Input file:<br/>C:\Users\Projects\Cat.txt<br/>C:\Users\Projects\Dog.txt<br/>C:\Users\Projects\Hat.txt<br/>C:\Users\Projects\Cow.txt<br/><br/>Output file:<br/>Cat.txt<br/>Dog.txt<br/>Hat.txt<br/>Cow.txtThat's Perfect, Thank you</p></body></html>
8865.

Solve : .bat file to read a file,create a folder then move file into folder?

Answer» <html><body><p>I would really appreciate anybody's help here, What I'm trying to do is the following:<br/><br/>1. Read the titles from a <a href="https://interviewquestions.tuteehub.com/tag/number-238005" style="font-weight:bold;" target="_blank" title="Click to know more about NUMBER">NUMBER</a> of files within a directory.<br/>2. <a href="https://interviewquestions.tuteehub.com/tag/create-427332" style="font-weight:bold;" target="_blank" title="Click to know more about CREATE">CREATE</a> a <a href="https://interviewquestions.tuteehub.com/tag/folder-246959" style="font-weight:bold;" target="_blank" title="Click to know more about FOLDER">FOLDER</a> for each file based upon its name, but not its file extension.<br/>3. move each file into its own folder.<br/><br/>I would really like some help as i have over 50 GB of files and doing it individually would take me a year or two.....<br/><br/>Many thanksLet's say you have files in the folder named <br/><br/>dog.txt <br/>cow.jpg <br/>Man In The Moon.xls<br/>(etc)<br/><br/>(1) Is this what you <a href="https://interviewquestions.tuteehub.com/tag/want-1448756" style="font-weight:bold;" target="_blank" title="Click to know more about WANT">WANT</a> to do: make a folder called dog and move dog.txt into it, a folder called cow and move cow.jpg into that, make a folder called Man In The Moon and move Man In The Moon.xls into that, and keep going until all the files are done? Is that right? So instead of a folder full of files you will have a folder full of sub folders, each with one file in it?<br/><br/>(2) Will there be any files with different extensions but the same base name e.g. Horse.jpg Horse.txt Horse.doc, and if so what are you planning to do in that situation?<br/><br/><br/><br/><br/><br/>Salmon,<br/><br/>with respect to your first point that is what i need yes, and there may be multiple files which need copying into the same folder irrespective of file extension.Try this code. It should be placed in the folder in question, saved using a name of your choosing with a .bat extension. It will not include itself in the list of files to be processed and after it has run you should find that it is the only file left in the folder, all the others having been moved into subfolders.<br/><br/>Code: <a>[Select]</a>@echo off<br/><br/>REM Loop through every file in this folder<br/>REM Excluding this <a href="https://interviewquestions.tuteehub.com/tag/batch-893737" style="font-weight:bold;" target="_blank" title="Click to know more about BATCH">BATCH</a> file!<br/><br/>for /f "delims=" %%A in ( ' dir /b /a-d ^| find /v "%~nx0" ' ) do (<br/><br/> REM If a folder with the same base name<br/> REM does not exist, create it<br/> if not exist "%%~nA" md "%%~nA"<br/><br/> REM Move the file into the folder<br/> REM and show message to user<br/> echo Moving file: %%A to folder: %%~nA<br/> move "%%A" "%%~nA"<br/><br/> )<br/><br/>REM Complete<br/>echo Done<br/>echo.<br/>Pause<br/></p></body></html>
8866.

Solve : .bat file that reads from a existing .txt file and creates a new .txt file?

Answer» <html><body><p>Hello everyone. <br/><br/>I am trying to make a .bat file that reads the individual lines of a .txt file, and then, <a href="https://interviewquestions.tuteehub.com/tag/creates-427342" style="font-weight:bold;" target="_blank" title="Click to know more about CREATES">CREATES</a> a new .txt file. I am doing this because i am trying to automate an extremely repetitive scheduling task. <br/><br/>For example, I have a file named project.txt which has several lines, and it looks like this:<br/><br/>Firstidea<br/>Secondidea<br/>Thirdidea<br/>Fourthidea<br/>Fifthidea<br/>Sixthidea<br/>Seventhidea<br/>…..(and so on)<br/><br/>Im trying to make a .bat file that will read the file above and create a new file, called projectschedule.txt, that will look like this:<br/><br/><br/><br/> 4<br/> firstidea<br/><br/><br/> <a href="https://interviewquestions.tuteehub.com/tag/1-236780" style="font-weight:bold;" target="_blank" title="Click to know more about 1">1</a><br/> <br/><br/><br/> 0<br/> <br/><br/><br/> 4<br/> secondidea<br/><br/><br/> 1<br/> <br/><br/><br/> 0<br/> <br/><br/><br/> 4<br/> thirdidea<br/><br/><br/> 1<br/> <br/><br/><br/> 0<br/> <br/><br/><br/>…….And so on. <br/><br/><br/>So, the section from will reference the first line of the project.txt file. <br/>The section of will reference the 2nd line of the project.txt file<br/>The section of will reference the 3rd line of the project.txt file <br/>The section of will reference the <a href="https://interviewquestions.tuteehub.com/tag/4th-319068" style="font-weight:bold;" target="_blank" title="Click to know more about 4TH">4TH</a> line of the project.txt file<br/>The section of will reference the 5th line of the project.txt file<br/><br/>And so on for each line in the project.txt file. <br/><br/><br/>The project.txt file that the .bat file will be referencing can have hundreds of lines. How can I make a for loop to reference each individual line of the project.txt file to make an output file called projectschedule.txt that looks similar to above? <br/><br/>I am thinking that the loop will look something like this:<br/><br/>@<a href="https://interviewquestions.tuteehub.com/tag/echo-11626" style="font-weight:bold;" target="_blank" title="Click to know more about ECHO">ECHO</a> off<br/>setlocal enabledelayedexpansion<br/>cd /d "C:\Users\John\Desktop\schedule"<br/>set /a sched=0<br/> for /f "delims=" %%A in (project.txt) do (<br/> echo &gt; projectschedule.txt<br/> echo 4 &gt;&gt; projectschedule.txt<br/> echo firstidea &gt;&gt; projectschedule.txt<br/> echo &gt;&gt; projectschedule.txt<br/> echo &gt;&gt; projectschedule.txt<br/> echo 1 &gt;&gt; projectschedule.txt<br/> echo &gt;&gt; projectschedule.txt<br/> echo &gt;&gt; projectschedule.txt<br/> echo &gt;&gt; projectschedule.txt<br/> echo 0 &gt;&gt; projectschedule.txt<br/> echo &gt;&gt; projectschedule.txt<br/> echo &gt;&gt; projectschedule.txt<br/>sched=!sched!+<a href="https://interviewquestions.tuteehub.com/tag/3-236794" style="font-weight:bold;" target="_blank" title="Click to know more about 3">3</a><br/>)<br/><br/><br/>I am new to batch, and i had a lot of help developing a similar batch from a forum a member named Salmon Trout. <br/><br/>The code above does not work. Part of the reason is because my output text needs to have &lt; and &gt; symbols. <br/><br/><br/>-----echo firstidea &gt;&gt; projectschedule.txt<br/>Also, the string above is the 8th line of the large code above. This string of code needs output the next consecutive line of the project.txt file each time it is looped through. Currently, the code above will only output"firstidea" every time it is looped through. <br/><br/><br/><br/>Any ideas or help would be greatly appreciated. Hello,<br/><br/>Thank you for the input. <br/><br/>The code you sent above works great!<br/><br/>The line that helped out the most was <br/><br/> echo ^%%i^ &gt;&gt; projectschedule.txt<br/>inside of the do() loop, as i did not know how to reference each invidiviual line of the project.txt file as the loop was running. <br/><br/>Thanks again!</p></body></html>
8867.

Solve : Help!Extract content from .xml files?

Answer» <html><body><p>Hi, everyone, <br/>i am trying to build an <a href="https://interviewquestions.tuteehub.com/tag/english-273" style="font-weight:bold;" target="_blank" title="Click to know more about ENGLISH">ENGLISH</a>-chinese bilingual corpus. I have downloaded about 1000 internet pages containing English news and its translations. I have saved them as .xml files which reads like:<br/><br/> <br/>- <br/>- <br/>- <br/>- <br/> gate.SourceURL <br/> <a href="http://www.freexinwen.com/chinese/eng/news_bilingual/news/news_010107.asp">http://www.freexinwen.com/chinese/eng/news_bilingual/news/news_010107.asp</a> <br/> <br/>- <br/> MimeType <br/> text/html <br/> <br/> <br/>- <br/>- <br/> <br/> 看新闻学英语 <br/> <br/> <br/> 01-01-07 <br/> <br/> <br/> <br/> 亚洲领导人迎2007承诺促进国际合作 (Asian Leaders Usher in 2007 with Pledges for International Cooperation) <br/> <br/> <br/> <br/> 几个亚洲国家政府领导人在2007到来之际承诺促进国际合作并发表政策讲话。 <br/> <br/> <br/> 在日本,安倍晋三首相承诺要改进和中国及韩国的关系。日本与这两国的关系近年来出现紧张,原因是它们认为日本歪曲了上世纪前半叶日本军国主义的历史。 <br/> <br/> <br/> 在中国,国家主席胡锦涛承诺将建设“和谐社会”,并和其它国家共同解决减少污染和促进经济增长等其它问题。胡锦涛还强调将寻求和台湾实现和平统一。台湾总统陈水扁表示, 台湾的主权由台湾人民决定。他宣称台湾“绝对不属于”中国。 <br/> <br/> <br/> <br/> Several Asian government leaders have welcomed 2007 with new pledges for international cooperation and policy speeches. <br/> <br/> <br/> In Japan, Prime Minister Shinzo Abe pledged to improve relations with China and South <a href="https://interviewquestions.tuteehub.com/tag/korea-343860" style="font-weight:bold;" target="_blank" title="Click to know more about KOREA">KOREA</a>. Japan's relationship with those countries has been strained in recent years because of their perception that Japan misrepresents the history of its military expansionism in the <a href="https://interviewquestions.tuteehub.com/tag/first-461760" style="font-weight:bold;" target="_blank" title="Click to know more about FIRST">FIRST</a> half of the last century. <br/> <br/> <br/> In China, President Hu Jintao pledged to pursue social harmony at home, and to work with other countries to <a href="https://interviewquestions.tuteehub.com/tag/address-239902" style="font-weight:bold;" target="_blank" title="Click to know more about ADDRESS">ADDRESS</a> common issues, such as pollution and economic growth. <a href="https://interviewquestions.tuteehub.com/tag/mr-239393" style="font-weight:bold;" target="_blank" title="Click to know more about MR">MR</a>. Hu also stressed that he intends to pursue peaceful reunification with Taiwan. Taiwan's President Chen Shui-bian said the island's sovereignty was a matter for its people. He declared that the island "definitely does not belong" to China. <br/> <br/> <br/> <br/><br/>How can i extract only the Chinese and English from the 1000 .xml files and convert them into individual .txt files? <br/>Many thanks! <br/>Please don't post the same question more than once. Thank you. I deleted the duplicate post.i am sorry, admin. I won't do it anymore. Could anyone offfer me some tips on how to do it? Welcome to the CH forums.<br/><br/>Here's a small trial script which should get you going but I don't know how to actually display Chinese characters and English text from the same .txt file, there's gotta be a font change in there somewhere.<br/><br/>Code: <a>[Select]</a>@echo off&gt;trial.txt<br/>cls<br/>setlocal<br/><br/>for /f "tokens=*" %%1 in ('dir /b trial.xml') do (<br/><br/> findstr /v /c:"&lt;" /c:"&gt;" %%1&gt;&gt;trial.txt<br/>)<br/><br/>type trial.txt<br/></p></body></html>
8868.

Solve : Batch remove - and . fixed length many suffix?

Answer» <html><body><p>I have to rename thousands of ???files with the nonstandard characters "." and "-". Fixed length, nothing else in folder, only the number changes, same <a href="https://interviewquestions.tuteehub.com/tag/date-11316" style="font-weight:bold;" target="_blank" title="Click to know more about DATE">DATE</a> &amp; system per folder, can be folder specificic, and multiple suffix, ie: <br/>2011-05-21sys-03-99.new.test_0001.scene.fixed.doc<br/>2011-05-21sys-03-99.new.test_0001.scene.fixed.xls <br/>2011-05-21sys-03-99.new.test_0002.scene.fixed.doc<br/>2011-05-21sys-03-99.new.test_0002.scene.fixed.xls<br/>need to be <br/>2011_05_21sys_03_99_new_test_0001_scene _fixed.doc<br/>2011_05_21sys_03_99_new_test_0001_scene _fixed.xls<br/>2011_05_21sys_03_99_new_test_0002_scene _fixed.doc<br/>2011_05_21sys_03_99_new_test_0002_scene _fixed.xls<br/>or with no spaces instead of "_". <br/><br/>ren 2011-??-??-??-??..test_*.scene.fixed.doc 2011_??_??_??_??_new_test_*_scene_fixed.doc<br/>ren 2011-??-??-??-??..test_*.scene.fixed.doc 2011_??_??_??_??_new_test_*_scene_fixed.xls<br/><br/>seems to work, but does not like the number wild card, and only works on one file. I tried a couple FOR loops, something like<br/><br/>FOR %%*doc IN (C:\Temp) DO (ren "%%*.doc" 2011-??-??-??-??..test_*.scene.fixed.doc 2011_??_??_??_??_new_test_*_scene_fixed.doc)<br/>but I am sure I have butchered this code.<br/><br/>Any pointers on how to get the number wild card to work or how to get the batch to work? Do you think the FOR loop is appropriate for this? Thanks.So you want the renamed filenames to be the same except that all dots and dashes <a href="https://interviewquestions.tuteehub.com/tag/become-389953" style="font-weight:bold;" target="_blank" title="Click to know more about BECOME">BECOME</a> underscores? Not including the dot which starts the extension?<br/><br/>Quote</p><blockquote>Do you think the FOR loop is appropriate for this? Thanks.</blockquote><br/>Absolutely. What I would do is enable delayed expansion and in a loop, <a href="https://interviewquestions.tuteehub.com/tag/read-619994" style="font-weight:bold;" target="_blank" title="Click to know more about READ">READ</a> in each filename, then using the ~n and ~x variable modifiers, split it into base name and extension, take the base name and use string replace (twice, once to replace . with _ and again to replace - with _) then add the extension back and use the old name and new name in a REN command. Unfortunately it is 7 AM here and I am gong to work so I won't be able to actually post some example code until around 9 hours time. Maybe somebody else will beat me to the punch? (Not you, Bill!)<br/><br/><br/><br/>Quote from: Salmon Trout<blockquote>Maybe somebody else will beat me to the punch?</blockquote><br/>Nobody would dare!!!<br/><br/>Ugh, I don't know why the little smiley faces showed up all over my post! <br/><br/>Thanks, Salmon Trout, that is the solution. I actually posted the same question on another forum and code using the filename parameter extensions (ie, %~n and %~a) were used in an FOR loop. I'll have to brush up on the use of extensions. <br/><br/>I give credit to Salmon Trout and the other person with code for the solution. I'd post the other person's website and username, but I don't know how kosher that is with you all or him/her. Either way, you all have created a true believer in DOS-Batch. Thanks again.Code: <a>[Select]</a>@echo off<br/>setlocal enabledelayedexpansion<br/>for /f "delims=" %%A in ( ' dir /b ' ) do (<br/> set oldbasename=%%~nA<br/> set extension=%%~xA<br/> set newbasename=!oldbasename:.=_!<br/> set newbasename=!newbasename:-=_!<br/> echo Renaming "!oldbasename!!extension!" to "!newbasename!!extension!"<br/> REN "!oldbasename!!extension!" "!newbasename!!extension!"<br/> )<br/>echo. <br/>echo All done<br/>pause<br/><br/>Quote from: AndrewJW on June 13, 2011, 08:22:54 AM<blockquote>I don't know why the little smiley faces showed up all over my post! </blockquote><br/>Unless you show text as code, this forum shows <a href="https://interviewquestions.tuteehub.com/tag/various-1443317" style="font-weight:bold;" target="_blank" title="Click to know more about VARIOUS">VARIOUS</a> character combinations as <a href="https://interviewquestions.tuteehub.com/tag/emoticons-2070218" style="font-weight:bold;" target="_blank" title="Click to know more about EMOTICONS">EMOTICONS</a> to all guests and all registered users who have not have selected "No Smileys" as the "Current Smiley Set" in their Profile Look and Layout Preferences. These are 3 question marks: If you see that as that *censored* stupid bewildered emoticon, that is why. This is a figure 8 and an end bracket <br/><br/>I really hate emoticons.<br/><br/><br/></body></html>
8869.

Solve : batchfile to backup sharepoint web application?

Answer» <html><body><p>I am trying to write a batch file that will backup a <a href="https://interviewquestions.tuteehub.com/tag/web-11417" style="font-weight:bold;" target="_blank" title="Click to know more about WEB">WEB</a> application, we have a multi-tennant farm so I <a href="https://interviewquestions.tuteehub.com/tag/want-1448756" style="font-weight:bold;" target="_blank" title="Click to know more about WANT">WANT</a> to promt the end user to type in the siteID<br/>i.e. 110xx-Auth01 to 11010-Auth01<br/><br/>What I have so far is:<br/><br/>@echo off<br/>echo ===============================================================<br/>echo Back up site to \\s604414dc4vw74\11005\<br/>echo Change 110xx-Auth01 to the site you are backing up in integration<br/>echo ===============================================================<br/>@echo off<br/>pause &gt;CON<br/>REM variables to replace - <a href="https://interviewquestions.tuteehub.com/tag/verify-1728440" style="font-weight:bold;" target="_blank" title="Click to know more about VERIFY">VERIFY</a> before continuing - hit ctrl+c to cancel script<br/>set /p siteid stsadm.exe -o backup -<a href="https://interviewquestions.tuteehub.com/tag/directory-11615" style="font-weight:bold;" target="_blank" title="Click to know more about DIRECTORY">DIRECTORY</a> \\s604414dc4vw74\11005\ -backupmethod full -<a href="https://interviewquestions.tuteehub.com/tag/item-770211" style="font-weight:bold;" target="_blank" title="Click to know more about ITEM">ITEM</a> "Farm\Windows SharePoint Services Web Application\110xx-Auth01" -nositelock<br/><br/>echo completed<br/><br/>Thanks for the help.<br/></p></body></html>
8870.

Solve : DOS batch file - not recognized as an internal command ...?

Answer» <html><body><p>This is all you really <a href="https://interviewquestions.tuteehub.com/tag/need-25476" style="font-weight:bold;" target="_blank" title="Click to know more about NEED">NEED</a>. The rest is just <a href="https://interviewquestions.tuteehub.com/tag/bells-894769" style="font-weight:bold;" target="_blank" title="Click to know more about BELLS">BELLS</a> and whistles.<br/><br/>Code: <a>[Select]</a>for %%A in (%ddir%\*.gz) do %zdir%\7za.exe <a href="https://interviewquestions.tuteehub.com/tag/e-236626" style="font-weight:bold;" target="_blank" title="Click to know more about E">E</a> "%%~dpnxA" -o%<a href="https://interviewquestions.tuteehub.com/tag/tdir-3827036" style="font-weight:bold;" target="_blank" title="Click to know more about TDIR">TDIR</a>% -<a href="https://interviewquestions.tuteehub.com/tag/aoa-363432" style="font-weight:bold;" target="_blank" title="Click to know more about AOA">AOA</a><br/>for %%B in (%tdir%\*.tar) do %zdir%\7za.exe e "%%~dpnxB" -o%gdir% -aoa<br/></p></body></html>
8871.

Solve : shutdown batch script?

Answer» <html><body><p>I am trying to write a batch file that I can use to shutdown/restart computers in my domain <a href="https://interviewquestions.tuteehub.com/tag/remotely-7289547" style="font-weight:bold;" target="_blank" title="Click to know more about REMOTELY">REMOTELY</a>. When I type this into the <a href="https://interviewquestions.tuteehub.com/tag/cmd-920083" style="font-weight:bold;" target="_blank" title="Click to know more about CMD">CMD</a> prompt it will work.<br/><br/>Code: <a>[Select]</a>shutdown /s /m \\pcName /t <a href="https://interviewquestions.tuteehub.com/tag/300-247719" style="font-weight:bold;" target="_blank" title="Click to know more about 300">300</a> /c "Your message here"<br/><br/><br/>But if I copy that into a batch file so I can use it for different machines as needed it just keeps looping through the first two questions. If I leave echo on I can see where the shutdown command is run, but nothing happens (see bottom of post). Any suggestions?<br/><br/><br/>Code: <a>[Select]</a>@echo off<br/><br/>SET /p _pcName="What computer do you wish to shutdown/restart? "<br/>SET /p _pcAction="Do you want to restart or shutdown the computer? "<br/><br/>if "%_pcAction%" equ "r" goto :pcRestart<br/>if "%_pcAction%" equ "s" goto :pcShutdown<br/><br/>:pcRestart<br/>shutdown /r /m "\\%_pcName% /t 300 /c "5 minutes to <a href="https://interviewquestions.tuteehub.com/tag/automatic-888453" style="font-weight:bold;" target="_blank" title="Click to know more about AUTOMATIC">AUTOMATIC</a> restart"<br/>goto :confirm<br/><br/><br/>:pcShutdown<br/>shutdown /s /m \\%_pcName% /t 300 /c "5 minutes to automatic shutdown"<br/>goto :confirm<br/><br/>:confirm<br/>set /p _confirm="Shutdown in progress. Would you like to abort? "<br/>if "%_confirm%" equ "y" shutdown /a /m \\%_pcName%<br/>exit<br/><br/>Code: <a>[Select]</a><br/>C:\Users\[username]\Desktop&gt;SET /p _pcName="What computer do you wish to shutdown<br/>/restart? "<br/>What computer do you wish to shutdown/restart? test_pc<br/><br/>C:\Users\[username]\Desktop&gt;SET /p _pcAction="Do you want to restart or shutdown<br/>the computer? "<br/>Do you want to restart or shutdown the computer? s<br/><br/>C:\Users\[username]\Desktop&gt;if "s" EQU "r" goto :pcRestart<br/><br/>C:\Users\[username]\Desktop&gt;if "s" EQU "s" goto :pcShutdown<br/><br/>C:\Users\[username]\Desktop&gt;shutdown /s /m \\test_pc /t 300 /c "5 minutes to auto<br/>matic shutdown"<br/><br/>C:\Users\[username]\Desktop&gt;SET /p _pcName="What computer do you wish to shutdown<br/>/restart? "<br/>What computer do you wish to shutdown/restart?<br/>have you tried using START in <a href="https://interviewquestions.tuteehub.com/tag/front-1000768" style="font-weight:bold;" target="_blank" title="Click to know more about FRONT">FRONT</a> of each shutdown command?I tried that and it still doesn't work. It opened a new window and started asking the questions again. The original window asked if I wanted to abort the shutdown and then went back to the questions again. The command never actually went through to the remote pc though.</p></body></html>
8872.

Solve : ftpcmd with dynamic names?

Answer» <html><body><p>Hello,<br/><br/>I use this ftpcmd:<br/><br/>open mywebserver.com<br/>usrname<br/>password<br/>cd httpdocs/mp3<br/>put "C:\files\20062011221.mp3"<br/><a href="https://interviewquestions.tuteehub.com/tag/quit-611662" style="font-weight:bold;" target="_blank" title="Click to know more about QUIT">QUIT</a><br/><br/>but 20062011221.mp3 is dynamic. DDMMYYYYHH1 (The one is always the same).mp3 <br/>I want to upload every day this mp3 file with a <a href="https://interviewquestions.tuteehub.com/tag/script-345000" style="font-weight:bold;" target="_blank" title="Click to know more about SCRIPT">SCRIPT</a> but the name of this file is everyday different<br/><br/>How to solve this problem?easy!!<br/>Create a text file with your commands in it and call FTP -s filename<br/>where filename is the file you stored your commands<br/><br/>Id suggest you put in a bin command before the upload, otherwise you run the risk of stripping off the bit 7 from every mp3 (makes for interesting effects on photos)<a href="https://interviewquestions.tuteehub.com/tag/thanks-665909" style="font-weight:bold;" target="_blank" title="Click to know more about THANKS">THANKS</a> for your reply, but that's just what I'm doing. The problem is that I don't know to handle a dynamic file name.<br/><br/>The name of the mp3 is every day different. I can't use "C:\files\20062011221.mp3" because the name changes every day. It should be %D%M%Y%H1.mp3 or something like that.<br/><br/>Is there anyone who knows this?The date and time format is local to each machine. Without knowing that, we can only guess at a solution. For more specific code, please run <em>echo %date%</em> and <em>echo %time%</em> at the command line and post the results.<br/><br/>This little snippet will work if the date format is <em>dow mm/dd/yyyy </em>and the time format is <em>hh:mm:ss.ms</em> You might be able to use it as a template.<br/><br/>Code: <a>[Select]</a>@echo off<br/>setlocal<br/><br/>set dt=%date:~7,2%%date:~4,2%%date:~10,4%%time:~0,2%1<br/>set dt=%dt: =0%<br/><br/>(<br/> echo open mywebserver.com<br/> echo usrname<br/> echo password<br/> echo cd httpdocs/mp3<br/> echo <a href="https://interviewquestions.tuteehub.com/tag/binary-11577" style="font-weight:bold;" target="_blank" title="Click to know more about BINARY">BINARY</a><br/> echo put "C:\files\%dt%.mp3"<br/> echo quit<br/>) &gt; script.txt <br/><br/>ftp -s script.txt<br/><br/>Good luck. <br/>Thanks. This is exactly what I need.<br/><br/>Is it also possible to give the file a suffix? So 20062011221.mp3 will be 20062011221-done.mp3 on my <a href="https://interviewquestions.tuteehub.com/tag/server-11236" style="font-weight:bold;" target="_blank" title="Click to know more about SERVER">SERVER</a>?Glad it helped.<br/><br/>Quote</p><blockquote>Is it also possible to give the file a suffix? So 20062011221.mp3 will be 20062011221-done.mp3 on my server?<br/></blockquote><br/>Why not try renaming the file?<br/><br/>Code: <a>[Select]</a>ren C:\files\%dt%.mp3 %dt%-done.mp3<br/><br/>Suggest doing this after the <strong>ftp</strong> command is complete. If the <strong>ftp</strong> command returns an <strong>errorlevel</strong> you can condition the <strong>ren</strong> in case the upload fails.<br/><br/></body></html>
8873.

Solve : Attempting to find hash?

Answer» <html><body><p>I'm trying to <a href="https://interviewquestions.tuteehub.com/tag/find-11616" style="font-weight:bold;" target="_blank" title="Click to know more about FIND">FIND</a> the hash of my favourite minecraft server so I can automatically switch to it if it changes IP addresses without having to look through the server list and find it, but I'm running into a bit of an issue. When I go to <a href="https://www.minecraft.net/servers.jsp">http://www.minecraft.net/servers.jsp</a> and look at the source, I see the server details like this:&lt;<a href="https://interviewquestions.tuteehub.com/tag/br-244048" style="font-weight:bold;" target="_blank" title="Click to know more about BR">BR</a>&gt;Code: <a>[Select]</a>&lt;a href="play.jsp?server=79be7a5abc334f8ae4bcbcd235cd4141"&gt;&lt;b&gt;Neko-san. Nyan!&lt;/b&gt;&lt;/a&gt; 8/50<br/> <br/> &lt;br&gt;<br/> <br/> &lt;a href="play.jsp?server=9439c1e4ca9c75edf046f7a03dbb92bb"&gt;&lt;b&gt;Au70 Galaxy&lt;/b&gt;&lt;/a&gt; 14/35<br/> <br/> &lt;br&gt;<br/> <br/> &lt;a href="play.jsp?server=d828ce6a503f2f61c12c19b70df2f48a"&gt;&lt;b&gt;Minecraft Server&lt;/b&gt;&lt;/a&gt; 0/16<br/> <br/> &lt;br&gt;<br/>...It would be all too easy to find the hash for my desired server like this, but when I <a href="https://interviewquestions.tuteehub.com/tag/try-1428546" style="font-weight:bold;" target="_blank" title="Click to know more about TRY">TRY</a> to get the source of the page with a tool like CURL, wGET, or this miscellaneous VBS tool from <a href="http://www.robvanderwoude.com/vbstech_internet_download.php">http://www.robvanderwoude.com/vbstech_internet_download.php</a>, the source looks like this:<br/>Code: <a>[Select]</a> &lt;b&gt;Team9000 Public (team9000.net)&lt;/b&gt; 94/512<br/> <br/> &lt;br&gt;<br/> <br/> &lt;b&gt;Javackes - LavaSurvival!&lt;/b&gt; 30/30<br/> <br/> &lt;br&gt;<br/> <br/> &lt;b&gt;Official Opticraft Dev Server!&lt;/b&gt; 104/320<br/> <br/> &lt;br&gt;<br/>...<br/>Does anyone know of another method of downloading the source of a page that would work for me?Tried using PHP with cURL?Quote from: kpac on May 24, 2011, 02:59:15 PM</p><blockquote>Tried using PHP with cURL?<br/></blockquote>How exactly kpac? There is no switch between --pass and --post301. I'm using the command line "Win32 2000/XP on i386 curl executable" version.<br/>you need to be logged in to join or even get links to multiplayer games. (if you log out and view the page you don't get links either).<br/>why can't you use view source from within the browser to acquire the link/hash?Quote from: BC_Programmer on May 24, 2011, 08:53:03 PM<blockquote>you need to be logged in to join or even get links to multiplayer games. (if you log out and view the page you don't get links either).<br/>why can't you use view source from within the browser to acquire the link/hash?<br/></blockquote>So true BC, I completely forgot about that. I already answered that question in my first post however, I wish to do this all automatically. I run a bot for the server, which automatically rejoins except when the server IP changes.<br/><br/>I tried using my cookie from internet explorer, but that didn't give desired results, so how would I log in with cURL and download the file?<br/>I tried using --user USERNAME:PASSWORD, but that <a href="https://interviewquestions.tuteehub.com/tag/also-373387" style="font-weight:bold;" target="_blank" title="Click to know more about ALSO">ALSO</a> didn't work.<br/>I tried to <a href="https://interviewquestions.tuteehub.com/tag/obtain-582970" style="font-weight:bold;" target="_blank" title="Click to know more about OBTAIN">OBTAIN</a> a cURL cookie by using Code: <a>[Select]</a>curl --cookie-jar newcookie.txt --data "username=USERNAME^&amp;password=PASSWORD^&amp;use_secure=false" http://www.minecraft.net/login.jsp but it tells me my username or password is incorrect, I've checked that they're right.Quote from: Helpmeh on May 24, 2011, 09:05:53 PM<blockquote>So true BC, I completely forgot about that. I already answered that question in my first post however, I wish to do this all automatically. I run a bot for the server, which automatically rejoins except when the server IP changes.<br/><br/>I tried using my cookie from internet explorer, but that didn't give desired results, so how would I log in with cURL and download the file?<br/>I tried using --user USERNAME:PASSWORD, but that also didn't work.<br/>I tried to obtain a cURL cookie by using Code: <a>[Select]</a>curl --cookie-jar newcookie.txt --data "username=USERNAME^&amp;password=PASSWORD^&amp;use_secure=false" http://www.minecraft.net/login.jsp but it tells me my username or password is incorrect, I've checked that they're right.<br/></blockquote><br/>youve put that secure=false, surely this needs to be set to true?Nope. I checked the POST data when I submit the form and that's what it is.I would try Denmark....<br/><br/>Sorry Helpmeh....couldn't resist.<br/><br/>Quote from: patio on June 07, 2011, 05:37:12 PM<blockquote>I would try Denmark....<br/><br/>Sorry Helpmeh....couldn't resist.<br/><br/><br/></blockquote>*sigh* No actual advice though?<br/><br/>It doesn't even technically need it to be batch...it just needs to put the hash in a file for the bot.Nobody has an answer...*sigh*<br/><br/>BUMP</body></html>
8874.

Solve : makefile and enviromental varriable confusion?

Answer» <html><body><p>Hi I'm trying define functions in a makefile such as echo and sed using the following code:-<br/><br/>Code: <a>[Select]</a><br/># <a href="https://interviewquestions.tuteehub.com/tag/check-25817" style="font-weight:bold;" target="_blank" title="Click to know more about CHECK">CHECK</a> <a href="https://interviewquestions.tuteehub.com/tag/expected-1733872" style="font-weight:bold;" target="_blank" title="Click to know more about EXPECTED">EXPECTED</a> variables are defined<br/>define ASSERT_VARIABLE_EXISTS<br/>ifndef $(1)<br/>$$(error Environment Variable $(1) must be defined )<br/>endif<br/>endef<br/><br/>$(eval $(call ASSERT_VARIABLE_EXISTS,MINGW_TOOL_DRIVE))<br/>$(eval $(call ASSERT_VARIABLE_EXISTS,MINGW_TOOL_PATH))<br/><br/><br/># MinGW Commands<br/>ECHO := $(MINGW_TOOL_DRIVE):\$(MINGW_TOOL_PATH)\msys\1.0\bin\echo<br/>DATE := $(MINGW_TOOL_DRIVE):\$(MINGW_TOOL_PATH)\msys\1.0\bin\date<br/>HOSTNAME := $(MINGW_TOOL_DRIVE):\$(MINGW_TOOL_PATH)\msys\1.0\bin\hostname<br/>UNAME := $(MINGW_TOOL_DRIVE):\$(MINGW_TOOL_PATH)\msys\1.0\bin\uname<br/>WHOAMI := $(MINGW_TOOL_DRIVE):\$(MINGW_TOOL_PATH)\msys\1.0\bin\whoami<br/>SED := $(MINGW_TOOL_DRIVE):\$(MINGW_TOOL_PATH)\msys\1.0\bin\sed<br/>GREP := $(MINGW_TOOL_DRIVE):\$(MINGW_TOOL_PATH)\msys\1.0\bin\grep<br/>MKDIR := $(MINGW_TOOL_DRIVE):\$(MINGW_TOOL_PATH)\msys\1.0\bin\mkdir<br/><br/><br/>I have the following added to my path: C:\MinGW\bin;C:\MinGW\msys\1.0\bin;C:\MinGW\MSYS\1.0\local\bin<br/>However each <a href="https://interviewquestions.tuteehub.com/tag/time-19467" style="font-weight:bold;" target="_blank" title="Click to know more about TIME">TIME</a> I run the make file I receive the error that I set up to say that the varriables are are not defined<br/>Is there anything else I must do to set up the environmental variables.<br/><br/>Any help is appreciated<br/>Thanks Problem sorted, just a misunderstanding of environmental variables Quote from: souslatable on <a href="https://interviewquestions.tuteehub.com/tag/june-251295" style="font-weight:bold;" target="_blank" title="Click to know more about JUNE">JUNE</a> 21, 2011, 09:10:59 AM</p><blockquote>environmental variables</blockquote><br/>Environment variables.<br/></body></html>
8875.

Solve : bat file to search a file and form new reports from the file?

Answer» <html><body><p>Hi i have a log.txt file which has multiple entries like below<br/><br/><br/>Message to the mobile no [ mnumber=9623434524 not sent ].failed<br/>something somethingXXXX xXXX<br/>Message to the mobile no [ Recieved Acknowledgement for mnumber=98373458938 ]<br/>Message to the mobile no [ mnumber=962342345324 not sent ].failed<br/>something somethingXXXX xXXX<br/>Message to the mobile no [ mnumber=96234432454 not sent ].failed<br/>Message to the mobile no [ Recieved Acknowledgement for mnumber=9543448938 ]<br/><br/><br/><br/>I want a <a href="https://interviewquestions.tuteehub.com/tag/bat-394554" style="font-weight:bold;" target="_blank" title="Click to know more about BAT">BAT</a> file to <a href="https://interviewquestions.tuteehub.com/tag/read-619994" style="font-weight:bold;" target="_blank" title="Click to know more about READ">READ</a> this log file for lines with keywords ".failed" and "[Recieved Acknowledgement".<br/><br/>then from each <a href="https://interviewquestions.tuteehub.com/tag/line-239358" style="font-weight:bold;" target="_blank" title="Click to know more about LINE">LINE</a> with keyword ".failed" it should find the substring "mnumber=98987676765" and save in a file failedreport.txt<br/>similarly <br/>from each line with keyword "[Recieved Acknowledgement" it should find the substring "mnumber=989873453345" and save in a file succesreport.txt<br/><br/>the log file is at location c:\Application\logs<br/>reports can be <a href="https://interviewquestions.tuteehub.com/tag/made-1082584" style="font-weight:bold;" target="_blank" title="Click to know more about MADE">MADE</a> at c:\Application\reports<br/>all mnumbers are differnt but only 10 digits<br/>mnumbers will be <a href="https://interviewquestions.tuteehub.com/tag/surely-2258464" style="font-weight:bold;" target="_blank" title="Click to know more about SURELY">SURELY</a> present in line with keywords ".failed" and "[Recieved Acknowledgement".<br/><br/>can this be done .. <br/>pleas help .<br/><br/>aditya Note correct spelling of "Received". Is this as it appears in log.txt?<br/><br/>sorry its "Received" ..... my mistake...Note "success" is spelt thus...<br/><br/>Code: <a>[Select]</a>@echo off<br/>for /f "tokens=1-26 delims== " %%A in (log.txt) do (<br/> if "%%G"=="Received" echo %%J=%%K &gt;&gt; c:\Application\reports\successreport.txt<br/> if "%%G"=="mnumber" echo %%G=%%H &gt;&gt; c:\Application\reports\failedreport.txt <br/> )<br/></p></body></html>
8876.

Solve : Saving hard drive C: to portable hard drive via DOS?

Answer» <html><body><p>If possible, what <a href="https://interviewquestions.tuteehub.com/tag/would-3285927" style="font-weight:bold;" target="_blank" title="Click to know more about WOULD">WOULD</a> the DOS command be to save the total contents of hard drive C: to portable hard drive E? Or will drag and drop do it?You can create an almost exact copy of C to E with DOS, but you will want to avoid trying to copy parts of windows such as <a href="https://interviewquestions.tuteehub.com/tag/swap-657453" style="font-weight:bold;" target="_blank" title="Click to know more about SWAP">SWAP</a> files etc. Most use an image utility to <a href="https://interviewquestions.tuteehub.com/tag/backup-18158" style="font-weight:bold;" target="_blank" title="Click to know more about BACKUP">BACKUP</a> C: as an image to say E: external if you want a full system recovery option. If you are looking to just backup <a href="https://interviewquestions.tuteehub.com/tag/music-1379" style="font-weight:bold;" target="_blank" title="Click to know more about MUSIC">MUSIC</a>, <a href="https://interviewquestions.tuteehub.com/tag/pictures-1154472" style="font-weight:bold;" target="_blank" title="Click to know more about PICTURES">PICTURES</a>, documents etc, then you can create a routine to do xcopy or robocopy those files/folders to E:Thanks David Lembke<br/><br/>Donald Gedge</p></body></html>
8877.

Solve : Can i make those changes??

Answer» <html><body><p>I have a book. I <a href="https://interviewquestions.tuteehub.com/tag/want-1448756" style="font-weight:bold;" target="_blank" title="Click to know more about WANT">WANT</a> to some <a href="https://interviewquestions.tuteehub.com/tag/changes-246902" style="font-weight:bold;" target="_blank" title="Click to know more about CHANGES">CHANGES</a> in this book. This book is in pdf format. Can I make those changes?<a href="https://interviewquestions.tuteehub.com/tag/yes-748598" style="font-weight:bold;" target="_blank" title="Click to know more about YES">YES</a>. But you <a href="https://interviewquestions.tuteehub.com/tag/need-25476" style="font-weight:bold;" target="_blank" title="Click to know more about NEED">NEED</a> to have a <a href="https://interviewquestions.tuteehub.com/tag/converter-13465" style="font-weight:bold;" target="_blank" title="Click to know more about CONVERTER">CONVERTER</a>. I am not sure if there are any free PDF to MS Word converter out there.</p></body></html>
8878.

Solve : Which is the best cli os??

Answer» <html><body><p>can anyone tell me which one is the best &amp; popular cli os in linux &amp; unix?Are you <a href="https://interviewquestions.tuteehub.com/tag/referring-2982035" style="font-weight:bold;" target="_blank" title="Click to know more about REFERRING">REFERRING</a> to the shell?<br/><br/><a href="https://interviewquestions.tuteehub.com/tag/bash-11584" style="font-weight:bold;" target="_blank" title="Click to know more about BASH">BASH</a> is the most common standard as far as shell's go. There are many other shells that can be used, however. While the wikipedia entry on the subject is not exactly the most thorough, it seems to provide a <a href="https://interviewquestions.tuteehub.com/tag/good-1009017" style="font-weight:bold;" target="_blank" title="Click to know more about GOOD">GOOD</a> overview.<br/><br/><a href="https://en.wikipedia.org/wiki/Unix_shell">http://en.wikipedia.org/wiki/Unix_shell</a><br/><br/>As far as Linux goes, generally what you get with the distro "ought" to be what you use most often. This doesn't mean you cannot use another shell- far from it- but most distros contain a number of shell scripts for various purposes, and these will of course not always work in other shell implementations. Whether this constitutes a problem depends on the specific user and what they are trying to do, of course.i actually meant gentoo linux ,redhat fedora linux in linux family....<br/>&amp; solaris <a href="https://interviewquestions.tuteehub.com/tag/etc-251218" style="font-weight:bold;" target="_blank" title="Click to know more about ETC">ETC</a> in unix family... ,which one's CLI?CLI?<br/>You mean Command Line Interface.<br/>All Linux distributions have a CLI and they are also called 'shells'.<br/><br/>For the <a href="https://interviewquestions.tuteehub.com/tag/enjoyment-972023" style="font-weight:bold;" target="_blank" title="Click to know more about ENJOYMENT">ENJOYMENT</a> of all... Here is a video...<br/><a href="https://www.youtube.com/watch?v=dOaeLN_FWGY">playing With Shells In Ubuntu </a></p></body></html>
8879.

Solve : Need batch file to provide answers to prompts that come up after running the cmd?

Answer» <html><body><p>Hi<br/><br/>I'm trying to create a batch file that will generate SNMP authentication failures on my system. I can issue this command:<br/><br/>“C:\Program Files (x86)\snmpri\JBb.JMADK\snmp17.<a href="https://interviewquestions.tuteehub.com/tag/2-236987" style="font-weight:bold;" target="_blank" title="Click to know more about 2">2</a>.0.1\eso\w32.bin\getone” –v3 172.16.0.40 admin sysDescr.0<br/><br/>but when I do that, it'll prompt me for my auth and priv passwords. I want to be able to generate a whole bunch of these errors so I don't want to have to enter the auth/priv passwords every time. Is there any way to get the .bat file to do this for me? I tried:<br/><br/>“C:\Program Files (x86)\snmpri\JBb.JMADK\snmp17.2.0.1\eso\w32.bin\getone” –v3 172.16.0.40 admin sysDescr.0<br/>SHA:thisIsMyPassword<br/>AES12:thisIsMyPassword<br/><br/>in my batch file (the <a href="https://interviewquestions.tuteehub.com/tag/last-2782539" style="font-weight:bold;" target="_blank" title="Click to know more about LAST">LAST</a> two lines are the answers to the "what's your auth <a href="https://interviewquestions.tuteehub.com/tag/key-11608" style="font-weight:bold;" target="_blank" title="Click to know more about KEY">KEY</a>" and "what's your priv key" questions that come up after issuing the getone command) but I still got the prompts asking these questions and my .bat file complained about the SHA:thisIsMyPassword and AES12:thisIsMyPassword lines.<br/><br/>I <a href="https://interviewquestions.tuteehub.com/tag/hope-25911" style="font-weight:bold;" target="_blank" title="Click to know more about HOPE">HOPE</a> I explained this well enough for someone to make sense of what I'm trying to ask.....Thanks for your help!Try putting the 2 passwords in a text file, in the right order, each on its own line, and using redirection e.g. <br/><br/>Code: <a>[Select]</a>“C:\Program Files (x86)\snmpri\JBb.JMADK\snmp17.2.0.1\eso\w32.bin\getone” –v3 172.16.0.40 admin sysDescr.0 &lt;passwords.txtThank you thank you thank you!!!! That worked!!! Now all I <a href="https://interviewquestions.tuteehub.com/tag/need-25476" style="font-weight:bold;" target="_blank" title="Click to know more about NEED">NEED</a> to do is throw it in a loop and voila!!!<br/><br/>Thanks again!!!</p></body></html>
8880.

Solve : Need Help in appending a substring of previous line to next subsequent lines?

Answer» <html><body><p>You can right justify the file size in an (e.g.) 16 char wide column quite easily - then you can use sort /R /+N on the output file - N (starting column for sort) will depend on the date and time field widths which depend on local <a href="https://interviewquestions.tuteehub.com/tag/settings-771535" style="font-weight:bold;" target="_blank" title="Click to know more about SETTINGS">SETTINGS</a>. <br/><br/>A tip with sort - specifying an output file for example: sort /R /+24 Unsorted.txt /O Sorted.txt is quicker than redirecting stdout to a file (according to Microsoft): sort /R /+24 Unsorted.txt &gt; Sorted.txt<br/><br/>I have actually tried this method on my system and I found I was getting some blank date/time/size fields for certain files, about 20 out of 600,000, whereas using the full DIR listing didn't do that.<br/><br/>Code: <a>[Select]</a>setlocal enabledelayedexpansion<br/>for /f "usebackq tokens=1" %%v in (`mountvol ^| find ":\"`) do ( <br/> for /f "tokens=* delims=" %%i in ('dir "%%v" /b /s /a-d /o:-s') do (<br/> set fsize=%%~zi<br/> set fsize= !fsize!<br/> set fsize=!fsize:~-16!<br/> echo %%~ti,!fsize!,%%~nxi,%%~dpi &gt;&gt; Unsorted_Intermediate.csv<br/> )<br/>)<br/>Admittedly the <strong>findstr</strong> commands are not needed. They were leftover from when testing without the <strong>/b</strong> switch. <br/><br/><a href="https://interviewquestions.tuteehub.com/tag/based-389387" style="font-weight:bold;" target="_blank" title="Click to know more about BASED">BASED</a> on the OP reply #1, the files are sorted correctly coming out of the <strong>dir</strong> command and require no further processing, while the <strong>echo</strong> command formats the csv file and gang punches the proper folder name into each record.<br/><br/>Quote</p><blockquote>and my expected output should be<br/><br/>07/01/2011 02:29 PM 17,503,511 Conf_Logs.log D:\<br/>07/06/2011 09:07 PM 3,013,934 Master.txt D:\<br/>12/01/2010 11:48 AM 1,383,424 CRBT_FRR_ID_50.doc D:\<br/>01/17/2011 12:49 PM 1,042,944 SpainFCA_Installation Note.doc D:\<br/><br/><br/>01/08/2011 07:18 PM 3,178,425 IMG_2801.JPG D:\Accord_Get2Gthr_Photos<br/>01/08/2011 07:18 PM 2,879,090 IMG_2802.JPG D:\Accord_Get2Gthr_Photos<br/>01/08/2011 07:18 PM 2,856,676 IMG_2803.JPG D:\Accord_Get2Gthr_Photos <br/>01/08/2011 07:35 PM 2,745,495 IMG_2818.JPG D:\Accord_Get2Gthr_Photos<br/>01/08/2011 08:50 PM 2,685,050 IMG_2838.JPG D:\Accord_Get2Gthr_Photos<br/>01/08/2011 07:14 PM 2,663,947 IMG_2799.JPG D:\Accord_Get2Gthr_Photos<br/><br/><br/><br/>01/08/2011 08:40 PM 100,078,852 MVI_2833.AVI D:\Accord_Get2Gthr_Photos\vid D:\Accord_Get2Gthr_Photos\vid<br/>01/08/2011 07:47 PM 10,844,132 MVI_2827.AVI D:\Accord_Get2Gthr_Photos\vid<br/>01/08/2011 07:47 PM 11,458 MVI_2827.THM D:\Accord_Get2Gthr_Photos\vid<br/></blockquote><br/>Forcing the size data into a 16 byte width seems unnecessary as does using the <strong>sort</strong> command. Excel with import it correctly.<br/><br/>The new model of this snippet from *censored* has gone from I/O bound to to CPU bound. Is this an improvement? [that's a rhetorical question ST] <br/><br/>Code: <a>[Select]</a>@echo off<br/><br/>rem for /f "usebackq tokens=1" %%v in (`mountvol ^| find ":\"`) do ( <br/> for /f "tokens=* delims=" %%i in ('dir "%%v" /b /s /a-d /o:-s') do (<br/> echo %%~ti,%%~zi,%%~nxi,%%~dpi &gt;&gt; Final_Master.csv<br/> ) <br/>) <br/><br/>Quote from: Sidewinder on July 17, 2011, 02:32:35 PM<blockquote>Based on the OP reply #1, the files are sorted correctly coming out of the <strong>dir</strong> command and require no further processing</blockquote><br/>In a later post he says he <a href="https://interviewquestions.tuteehub.com/tag/wants-1448762" style="font-weight:bold;" target="_blank" title="Click to know more about WANTS">WANTS</a> a <a href="https://interviewquestions.tuteehub.com/tag/list-11333" style="font-weight:bold;" target="_blank" title="Click to know more about LIST">LIST</a> of files in each folder, on each drive letter on his server, sorted in descending order of file size...<br/><br/>Quote<blockquote>1. I need to search each and directory and file in each drive and sort all the files according their size in descending order. i.e Largest file in the server to smallest file with path where it is existing.</blockquote><br/>Dir sorts the files for each folder independently, so a further sort will be necessary.<br/><br/>Quote<blockquote>Forcing the size data into a 16 byte width seems unnecessary as does using the <strong>sort</strong> command. Excel with import it correctly.</blockquote><br/>I asked the OP whether he had Excel but got no reply.<br/><br/>Quote<blockquote>The new model of this snippet from *censored* has gone from I/O bound to to CPU bound. Is this an improvement? [that's a rhetorical question ST] </blockquote><br/>I'm not sure...<br/><br/>Quote from: Sidewinder on July 17, 2011, 02:32:35 PM<blockquote>Forcing the size data into a 16 byte width seems unnecessary as does using the <strong>sort</strong> command. Excel with import it correctly.<br/></blockquote><br/>I just found that when importing a csv that Excel 2003 has a maximum number of rows limitation of 65,536 - Excel <a href="https://interviewquestions.tuteehub.com/tag/2007-290053" style="font-weight:bold;" target="_blank" title="Click to know more about 2007">2007</a> is 1,048,576 rows<br/><br/>Anyhow, Powershell is much quicker than batch - I catalogued my whole computer in 2 minutes 35 seconds; using batch and dir took 50 minutes 51 seconds.<br/><br/>320,000 files approx in around 62,000 folders<br/><br/>Found 25 GB of forgotten stuff to delete<br/></body></html>
8881.

Solve : .txt output of batch session?

Answer» <html><body><p>I am using batch to run a folder full of python scripts over the weekend<br/><br/>FOR %%x IN (*.py) DO call "%%x" <br/><br/>Occasionally, one of the .py files does not <a href="https://interviewquestions.tuteehub.com/tag/work-20377" style="font-weight:bold;" target="_blank" title="Click to know more about WORK">WORK</a>, gives and error on the command prompt window, and then moves on to the next .py. I would <a href="https://interviewquestions.tuteehub.com/tag/like-537196" style="font-weight:bold;" target="_blank" title="Click to know more about LIKE">LIKE</a> a print (output to .txt) of the batch <a href="https://interviewquestions.tuteehub.com/tag/session-11564" style="font-weight:bold;" target="_blank" title="Click to know more about SESSION">SESSION</a> so that I can tell which .py did not work. <br/><br/>It seems that the redirect command (&gt; or &gt;&gt;) would only transfer command output (ie, dir) to particular place. My batch command (ie, call) does not have any output and simply executes. Is there a way to get and output of everything that happened during a batch session? It would mimic alt+print screen or cut and paste of a command window. Thanks,<br/><br/>Have you tried <a href="https://interviewquestions.tuteehub.com/tag/redirecting-7709727" style="font-weight:bold;" target="_blank" title="Click to know more about REDIRECTING">REDIRECTING</a> the batch output to a <a href="https://interviewquestions.tuteehub.com/tag/file-11330" style="font-weight:bold;" target="_blank" title="Click to know more about FILE">FILE</a>?<br/><br/>Mybatch.bat &gt; report.txt<br/><br/>Mybatch.bat &gt; report.txt generally just creates a blank .txt file.<br/><br/>Some other posters have suggested a error or output log 1&gt;&gt;output.log or 2&gt;&gt;error.logYou can print the errors and standard output to a single file by using the "&amp;1" command to redirect the output for STDERR to STDOUT and then sending the output from STDOUT to a file:<br/><br/> Mybatch.bat 1&gt; output.msg 2&gt;&amp;1</p></body></html>
8882.

Solve : Echo vs. Echo to file (make file)?

Answer» <html><body><p>Hi,<br/>I'm writing a makefile and I need it to create a .<a href="https://interviewquestions.tuteehub.com/tag/tcl-659352" style="font-weight:bold;" target="_blank" title="Click to know more about TCL">TCL</a> <a href="https://interviewquestions.tuteehub.com/tag/file-11330" style="font-weight:bold;" target="_blank" title="Click to know more about FILE">FILE</a> before executing it, the problem is that the echo command to a file is not working e.g.<br/><br/>for the following code:-<br/>Code: <a>[Select]</a> $E Hello1<br/> $E Hello2 &gt; hello.txt<br/><br/>The result to the cmd prompt is:-<br/><br/>Code: <a>[Select]</a>Hello1<br/>/usr/bin/sh: C:MINGWmsys1.0binecho: command not found<br/>make: *** [test] Error 127<br/><br/>Any ideas why the echo command works but not for writing to a file?<br/>ThanksThe problem was my <a href="https://interviewquestions.tuteehub.com/tag/definition-11288" style="font-weight:bold;" target="_blank" title="Click to know more about DEFINITION">DEFINITION</a> for the echo command, it works by <a href="https://interviewquestions.tuteehub.com/tag/replacing-2248205" style="font-weight:bold;" target="_blank" title="Click to know more about REPLACING">REPLACING</a>:<br/><br/>Code: <a>[Select]</a>ECHO := $(MINGW_TOOL_DRIVE):\$(MINGW_TOOL_PATH)\msys\1.0\bin\echo<br/><br/>With<br/><br/>Code: <a>[Select]</a>ECHO := $(MINGW_TOOL_DRIVE):/$(MINGW_TOOL_PATH)/msys/1.0/bin/echo<br/><br/>However if the problem was interpreting the <a href="https://interviewquestions.tuteehub.com/tag/slashes-3037044" style="font-weight:bold;" target="_blank" title="Click to know more about SLASHES">SLASHES</a> why did the standard echo command work with the first definition?</p></body></html>
8883.

Solve : Batch Generator?

Answer» <html><body><p>Hi<br/>I am new to this and would like some help.<br/><br/>I have <a href="https://interviewquestions.tuteehub.com/tag/tried-7272297" style="font-weight:bold;" target="_blank" title="Click to know more about TRIED">TRIED</a> reading manuals but cant get my head around it, I have tried a Batch Generator to help me <a href="https://www.newgrounds.com/portal/view/452275">http://www.newgrounds.com/portal/view/452275</a> and wondering if there is a more better one available that can be downloaded or online.<br/><br/>I have tried some of the examples on the forum and messed araund with some of them.<br/><br/>Its best to learn by example and exploration than using a handicap tool that dynamically creates a batch for you. <a href="https://interviewquestions.tuteehub.com/tag/create-427332" style="font-weight:bold;" target="_blank" title="Click to know more about CREATE">CREATE</a> 2 folders on your hard drive using MD and Directory name such as MD TEST1 and MD TEST2 and place a text file into the TEST1 folder and learn how to copy it to TEST2 via a batch, then build onto something more complex like placing a bunch of files and folders at TEST1 and then create an XCOPY if XP or earlier or ROBOCOPY if Win 7 to learn how to have a batch grab all or specific files and folders and copy them to TEST2. When done doing that, post back here if you need another batch assignment for us to help you learn.<br/><br/>This reminds me of the guy who claimed he knew HTML and Java script when he contacted me about a problem and when i checked into his problem he was using a WYSIWYG HTML/Java script tool. When looking at the HTML/Java script source he was totally lost. He didnt know why or how any of it worked other than if he used his WYSIWYG tool that it is suppose to <a href="https://interviewquestions.tuteehub.com/tag/work-20377" style="font-weight:bold;" target="_blank" title="Click to know more about WORK">WORK</a> and it <a href="https://interviewquestions.tuteehub.com/tag/doesnt-957774" style="font-weight:bold;" target="_blank" title="Click to know more about DOESNT">DOESNT</a>. The problem here was the tool had a flaw in its design that reflected when it created his dynamic HTML / Java Script web pages 10 years ago. I directed him to take cheap courses at Virtual University Online which was like $20 for a semester of up to 4 courses. He took HTML, Java Script, and CSS and thanked me for directing him into really learning it. He is now a graphic artist who also creates professional web pages with some WYSIWYG tools as well as source code touch ups <a href="https://interviewquestions.tuteehub.com/tag/since-644476" style="font-weight:bold;" target="_blank" title="Click to know more about SINCE">SINCE</a> he can now go back and read it and understand it to correct it.</p></body></html>
8884.

Solve : Programmes running?

Answer» <html><body><p>I have used this <a href="https://interviewquestions.tuteehub.com/tag/command-11508" style="font-weight:bold;" target="_blank" title="Click to know more about COMMAND">COMMAND</a> many times in the <a href="https://interviewquestions.tuteehub.com/tag/past-1148648" style="font-weight:bold;" target="_blank" title="Click to know more about PAST">PAST</a>, but have now suddenly forgotten it. The command brings up, I think 3 tabs. Under one of them are listed the startup programmes, each with a tick box. If you want to stop a particular programme from starting, just remove the tick..I've just remembered, always the way...msconfig..Msconfig was designed to be a diagnostic utility. It should not be used to make permanent changes to startup processes. Instead you should use a 3rd party app designed for the purpose. One such app is Mike <a href="https://interviewquestions.tuteehub.com/tag/lin-537210" style="font-weight:bold;" target="_blank" title="Click to know more about LIN">LIN</a>'s Startup Control Panel (<a href="&lt;klux&gt;HTTP&lt;/klux&gt;://www.mlin.net/StartupCPL.shtml">http://www.mlin.net/StartupCPL.shtml</a>). There are other, more comprehensive apps - but this one is simple and <a href="https://interviewquestions.tuteehub.com/tag/straightforward-633157" style="font-weight:bold;" target="_blank" title="Click to know more about STRAIGHTFORWARD">STRAIGHTFORWARD</a>.</p></body></html>
8885.

Solve : how to form a triangle on dos command??

Answer» <html><body><p>i need the whole code to form a triangle... plss <a href="https://interviewquestions.tuteehub.com/tag/help-239643" style="font-weight:bold;" target="_blank" title="Click to know more about HELP">HELP</a> Me!homework?Quote from: Allan on <a href="https://interviewquestions.tuteehub.com/tag/july-244157" style="font-weight:bold;" target="_blank" title="Click to know more about JULY">JULY</a> 12, 2011, 06:19:28 AM</p><blockquote>homework?<br/></blockquote><br/>They give homework in summer school? If you don't do the <a href="https://interviewquestions.tuteehub.com/tag/assignment-384339" style="font-weight:bold;" target="_blank" title="Click to know more about ASSIGNMENT">ASSIGNMENT</a>, do they punish you by sending you to regular school?<br/><br/>I found this on the CH boards. The basic code is there, feel free to modify it.<br/><br/><br/>Quote from: Kay_IT23 on July 12, 2011, 06:18:17 AM<blockquote>i need the whole code to form a triangle... plss Help Me!<br/></blockquote><br/>-You didn't say what programming language<br/>-You didn't show what you have tried so farCode: <a>[Select]</a>@echo. ___<br/>@echo. \ /<br/>@echo. V<br/><br/>run that as a batch file..<a href="https://interviewquestions.tuteehub.com/tag/lol-1077963" style="font-weight:bold;" target="_blank" title="Click to know more about LOL">LOL</a></body></html>
8886.

Solve : Use Batch to Stop a service that is in a state of starting??

Answer» <html><body><p>Can someone confirm if stop or taskkill from a batch file will be able to stop/kill a service that is hung in a state of "starting"? I need to stop services across <a href="https://interviewquestions.tuteehub.com/tag/multiple-1105557" style="font-weight:bold;" target="_blank" title="Click to know more about MULTIPLE">MULTIPLE</a> servers in a particular order and then restart those same services in the reverse order.<br/><br/>Example:<br/><br/>Stop service2 on server2<br/>stop service1 on server2<br/>stop service2 on server1<br/>stop service1 on server1<br/><br/>start service1 on server1<br/>start service2 on server1<br/>start service1 on server2<br/>start service2 on server2<br/><br/>My issue is that if a service gets hung in a state of "starting" the batch does not go on to the next step. I suspect I can simply kill the hung process and then attempt to start it again to see if that fixes the issue and allows the batch to complete.<br/><br/>I realize this is treating the symptom and not the issue, but I do not know of a way to replicate a hung service to determine what the root problem is.<br/><br/>I'm running Windows 2003 on some servers and Windows 2008 on the other servers.<br/><br/>Any help would be greatly appreciated.<br/><br/><br/><br/>no responses, yet...I was able to find a service that <a href="https://interviewquestions.tuteehub.com/tag/took-3223163" style="font-weight:bold;" target="_blank" title="Click to know more about TOOK">TOOK</a> long enough in the starting state to test...sc stop works but takes a <a href="https://interviewquestions.tuteehub.com/tag/bit-239224" style="font-weight:bold;" target="_blank" title="Click to know more about BIT">BIT</a>....taskkill /F took care of it quickly...thought I would <a href="https://interviewquestions.tuteehub.com/tag/update-718077" style="font-weight:bold;" target="_blank" title="Click to know more about UPDATE">UPDATE</a> in case it helps anyone <a href="https://interviewquestions.tuteehub.com/tag/else-printfy-344787" style="font-weight:bold;" target="_blank" title="Click to know more about ELSE">ELSE</a></p></body></html>
8887.

Solve : batch to stop services on multiple servers and then restart same services?

Answer» <html><body><p>I've seen some different postings regarding stopping and starting services and dependencies between services. Here is my need. I have 3 servers with one or two services in question running on each server. I will always know which of the 2 services exist on each server, so that is not an issue. Here is what needs to happen:<br/><br/>Stop IBM Cognos 8 on \\EP App Server<br/>wait for service to stop, then<br/>Stop IBM Cognos 8 Planning 8.4 on \\EP App Server<br/>wait for service to stop, then<br/>Stop IBM Cognos 8 on \\Web Server<br/>wait for service to stop, then<br/>Stop IBM Cognos 8 Planning 8.4 on \\Web Server<br/>wait for service to stop, then<br/>Stop IBM Cognos 8 on \\BI App Server<br/>wait for service to stop, then<br/><br/>Reboot all three servers<br/><br/>Wait for all three servers to start up<br/><br/>Start IBM Cognos 8 on \\BI App Server<br/>wait for service to start, then<br/>Start IBM Cognos 8 on \\EP App Server<br/>wait for service to start, then<br/>Start IBM Cognos 8 Planning 8.4 on \\EP App Server<br/>wait for service to start, then<br/>Start IBM Cognos 8 on \\Web Server<br/>wait for service to start, then<br/>Start IBM Cognos 8 Planning 8.4 on \\Web Server<br/><br/>If possible, then email an output showing that all services started properly. This is not as critical, but would be nice, though.<br/><br/>Notice that the services are started in the reverse order that they are stopped.<br/><br/>I am running Windows 2003 on all three servers.<br/><br/>Let me know what else you need to know...thanks, in advance!First you need to explain:<br/><br/><strong>IBM Cognos 8 Planning 8.4</strong><br/><br/>Here on this forum many are <a href="https://interviewquestions.tuteehub.com/tag/using-1441597" style="font-weight:bold;" target="_blank" title="Click to know more about USING">USING</a> Windows server 2003 and the commands are specific to windows.<br/>Does IBM Cognos 8 tun on Windows server 2003?<br/>And does it allow remote control?<br/>can you tell us the service name (Not display name) of IBM Cognos 8 and other service you mentioned. You can find this value when you double click on the service name in services.msc snap in.<br/><br/><br/>Also, I dont think there is a reliable way to "wait for the servers to comeup" from a script. Script can keep pinging the server but ping stars responding as soon as network services are started,does not mean the server is fully up. May be experts here are aware of any way.<br/><br/>Besides that what you asked can be done including emails. May be you can give a approximate time taken by the server for reboot and the script will wait for that much time.<br/><br/><br/><br/>thanks..<br/>Here's what I did that works (still room for improvement, but it works):<br/><br/><a href="https://interviewquestions.tuteehub.com/tag/echo-11626" style="font-weight:bold;" target="_blank" title="Click to know more about ECHO">ECHO</a> off<br/><br/>REM Script created by Jeff Owen in June 2011 to recycle the Cognos services in the Cognos 8.4 QA environment<br/>REM and to reboot all of the servers in the environment<br/>REM --<br/>REM -- PURPOSE --<br/>REM Cognos Planning performs much of its tasks using java processes constrained by 2G of RAM on each<br/>REM processor, given the 32-bit platform for the Planning applications. Consequently, it is necessary to<br/>REM recycle the services, periodically, to free up the memory for each java process available in the system.<br/>REM This scripts also handles rebooting all of the servers in the environment to further improve<br/>REM performance for the QA environment.<br/><br/>REM -- DOCUMENTATION --<br/>REM This script provides documentation through both the command prompt window (primarily for developing and<br/>REM testing purposes) and a text file for later review. Currently, the text file overwrites itself after<br/>REM each run, on the premise that this will run once or twice a week, so issues will be ID'ed before the next<br/>REM run. Multiple runs will not need to be logged in the file. If this changes, then make sure the first<br/>REM entry to the text file is preceded by &gt;&gt; instead of a single &gt;.<br/><br/><br/>REM ****** ISSUES TO RESOLVE ******<br/>REM what happens if one of the servers does not come back up? this script does not account for this<br/>REM need to change the script to remove the planning services from the <a href="https://interviewquestions.tuteehub.com/tag/gateway-471194" style="font-weight:bold;" target="_blank" title="Click to know more about GATEWAY">GATEWAY</a> server once "production" changes<br/>REM are <a href="https://interviewquestions.tuteehub.com/tag/carriedbrbr-2500933" style="font-weight:bold;" target="_blank" title="Click to know more about CARRIED">CARRIED</a> out to QA instance<br/><br/><br/><br/>REM --- stop order for servers ---<br/>REM all planning servers can be stopped at the same time<br/>REM PlanningServer<br/>REM standby content manager<br/>REM active content manager<br/>REM BIServer<br/><br/>REM --- recycle IIS ---<br/>REM stop w3svc<br/>REM start w3svc<br/>REM GatewayServer<br/><br/>REM --- start order for servers ---<br/>REM active content manager<br/>REM BIServer<br/>REM standby content manager<br/>REM all planning servers can be started at the same time<br/>REM PlanningServer<br/><br/>REM --- on individual server with both services ---<br/>REM stop IBM Cognos 8<br/>REM stop IBM Cognos 8 Planning 8.4<br/>REM start IBM Cognos 8 Planning 8.4 (IBM Cognos 8 service is started automatically by starting Planning 8.4)<br/><br/><br/>Echo Planning Recycle started %date% %time% &gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/><br/><br/>echo -------------- stopping Cognos services ------------------<br/>echo -------------- stopping Cognos services ------------------ &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/><br/><br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/>echo Status of IBM Cognos 8 service on PlanningServer &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/>echo Status of IBM Cognos 8 service on PlanningServer<br/><br/>:Resolve_PlanningServer_IBMCognos8_pre<br/>REM This is to check the status of this particular service prior to making any changes<br/>SC \\PlanningServer query "IBM Cognos 8" | FIND "STATE" | FIND "RUNNING" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StopService_PlanningServer_IBMCognos8<br/>SC \\PlanningServer query "IBM Cognos 8" | FIND "STATE" | FIND "STOPPED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StoppedService_PlanningServer_IBMCognos 8<br/>SC \\PlanningServer query "IBM Cognos 8" | FIND "STATE" | FIND "PAUSED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StopService_PlanningServer_IBMCognos8<br/>echo Service State is changing, waiting for service to resolve its state before making changes<br/>sc \\PlanningServer query "IBM Cognos 8" | Find "STATE"<br/>echo wait 10 seconds<br/>sleep 10<br/>GOTO Resolve_PlanningServer_IBMCognos8_pre<br/><br/>:StopService_PlanningServer_IBMCognos8<br/>echo stop IBM Cognos 8 Service on EP App Server &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt" <br/>sc \\PlanningServer stop "IBM Cognos 8"<br/><br/>:Resolve_PlanningServer_IBMCognos8_post<br/>REM This is to check that the service has stopped before moving on to the next service/server<br/>SC \\PlanningServer query "IBM Cognos 8" | FIND "STATE" | FIND "RUNNING" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StopService_PlanningServer_IBMCognos8<br/>SC \\PlanningServer query "IBM Cognos 8" | FIND "STATE" | FIND "STOPPED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StoppedService_PlanningServer_IBMCognos 8<br/>SC \\PlanningServer query "IBM Cognos 8" | FIND "STATE" | FIND "PAUSED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StopService_PlanningServer_IBMCognos8<br/>echo Service State is changing, waiting for service to resolve its state before making changes<br/>sc \\PlanningServer query "IBM Cognos 8" | Find "STATE"<br/>echo wait 10 seconds<br/>sleep 10<br/>GOTO Resolve_PlanningServer_IBMCognos8_post<br/><br/>:StoppedService_PlanningServer_IBMCognos 8<br/><br/>REM Show final status before moving on to the next service/server<br/>sc \\PlanningServer query "IBM Cognos 8" | Find "STATE"<br/><br/><br/><br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/>echo Status of IBM Cognos 8 Planning 8.4 service on PlanningServer &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/>echo Status of IBM Cognos 8 Planning 8.4 service on PlanningServer<br/><br/>:Resolve_PlanningServer_IBMCognos8Planni ng84_pre<br/>REM This is to check the status of this particular service prior to making any changes<br/>SC \\PlanningServer query "IBM Cognos 8 Planning 8.4" | FIND "STATE" | FIND "RUNNING" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StopService_PlanningServer_IBMCognos8Pl anning84<br/>SC \\PlanningServer query "IBM Cognos 8 Planning 8.4" | FIND "STATE" | FIND "STOPPED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StoppedService_PlanningServer_IBMCognos 8Planning84<br/>SC \\PlanningServer query "IBM Cognos 8 Planning 8.4" | FIND "STATE" | FIND "PAUSED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StopService_PlanningServer_IBMCognos8Pl anning84<br/>echo Service State is changing, waiting for service to resolve its state before making changes<br/>sc \\PlanningServer query "IBM Cognos 8 Planning 8.4" | Find "STATE"<br/>echo wait 10 seconds<br/>sleep 10<br/>GOTO Resolve_PlanningServer_IBMCognos8Planni ng84_pre<br/><br/>:StopService_PlanningServer_IBMCognos8Pl anning84<br/>echo stop IBM Cognos 8 Planning 8.4 Service on EP App Server &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt" <br/>sc \\PlanningServer stop "IBM Cognos 8 Planning 8.4"<br/><br/>:Resolve_PlanningServer_IBMCognos8Planni ng84_post<br/>REM This is to check that the service has stopped before moving on to the next service/server<br/>SC \\PlanningServer query "IBM Cognos 8 Planning 8.4" | FIND "STATE" | FIND "RUNNING" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StopService_PlanningServer_IBMCognos8Pl anning84<br/>SC \\PlanningServer query "IBM Cognos 8 Planning 8.4" | FIND "STATE" | FIND "STOPPED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StoppedService_PlanningServer_IBMCognos 8Planning84<br/>SC \\PlanningServer query "IBM Cognos 8 Planning 8.4" | FIND "STATE" | FIND "PAUSED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StopService_PlanningServer_IBMCognos8Pl anning84<br/>echo Service State is changing, waiting for service to resolve its state before making changes<br/>sc \\PlanningServer query "IBM Cognos 8 Planning 8.4" | Find "STATE"<br/>echo wait 10 seconds<br/>sleep 10<br/>GOTO Resolve_PlanningServer_IBMCognos8Planni ng84_post<br/><br/>:StoppedService_PlanningServer_IBMCognos 8Planning84<br/><br/>REM Show final status before moving on to the next service/server<br/>sc \\PlanningServer query "IBM Cognos 8 Planning 8.4" | Find "STATE"<br/><br/><br/><br/><br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/>echo Status of IBM Cognos 8 service on GatewayServer &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/>echo Status of IBM Cognos 8 service on GatewayServer<br/><br/>:Resolve_GatewayServer_IBMCognos8_pre<br/>REM This is to check the status of this particular service prior to making any changes<br/>SC \\GatewayServer query "IBM Cognos 8" | FIND "STATE" | FIND "RUNNING" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StopService_GatewayServer_IBMCognos8<br/>SC \\GatewayServer query "IBM Cognos 8" | FIND "STATE" | FIND "STOPPED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StoppedService_GatewayServer_IBMCognos8<br/>SC \\GatewayServer query "IBM Cognos 8" | FIND "STATE" | FIND "PAUSED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StopService_GatewayServer_IBMCognos8<br/>echo Service State is changing, waiting for service to resolve its state before making changes<br/>sc \\GatewayServer query "IBM Cognos 8" | Find "STATE"<br/>echo wait 10 seconds<br/>sleep 10<br/>GOTO Resolve_GatewayServer_IBMCognos8_pre<br/><br/>:StopService_GatewayServer_IBMCognos8<br/>echo stop IBM Cognos 8 Service on Gateway Server &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt" <br/>sc \\GatewayServer stop "IBM Cognos 8"<br/><br/>:Resolve_GatewayServer_IBMCognos8_post<br/>REM This is to check that the service has stopped before moving on to the next service/server<br/>SC \\GatewayServer query "IBM Cognos 8" | FIND "STATE" | FIND "RUNNING" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StopService_GatewayServer_IBMCognos8<br/>SC \\GatewayServer query "IBM Cognos 8" | FIND "STATE" | FIND "STOPPED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StoppedService_GatewayServer_IBMCognos8<br/>SC \\GatewayServer query "IBM Cognos 8" | FIND "STATE" | FIND "PAUSED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StopService_GatewayServer_IBMCognos8<br/>echo Service State is changing, waiting for service to resolve its state before making changes<br/>sc \\GatewayServer query "IBM Cognos 8" | Find "STATE"<br/>echo wait 10 seconds<br/>sleep 10<br/>GOTO Resolve_GatewayServer_IBMCognos8_post<br/><br/>:StoppedService_GatewayServer_IBMCognos8<br/><br/>REM Show final status before moving on to the next service/server<br/>sc \\GatewayServer query "IBM Cognos 8" | Find "STATE"<br/><br/><br/><br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/>echo Status of IBM Cognos 8 Planning 8.4 service on GatewayServer &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/>echo Status of IBM Cognos 8 Planning 8.4 service on GatewayServer<br/><br/>:Resolve_GatewayServer_IBMCognos8Plannin g84_pre<br/>REM This is to check the status of this particular service prior to making any changes<br/>SC \\GatewayServer query "IBM Cognos 8 Planning 8.4" | FIND "STATE" | FIND "RUNNING" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StopService_GatewayServer_IBMCognos8Pla nning84<br/>SC \\GatewayServer query "IBM Cognos 8 Planning 8.4" | FIND "STATE" | FIND "STOPPED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StoppedService_GatewayServer_IBMCognos8 Planning84<br/>SC \\GatewayServer query "IBM Cognos 8 Planning 8.4" | FIND "STATE" | FIND "PAUSED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StopService_GatewayServer_IBMCognos8Pla nning84<br/>echo Service State is changing, waiting for service to resolve its state before making changes<br/>sc \\GatewayServer query "IBM Cognos 8 Planning 8.4" | Find "STATE"<br/>echo wait 10 seconds<br/>sleep 10<br/>GOTO Resolve_GatewayServer_IBMCognos8Plannin g84_pre<br/><br/>:StopService_GatewayServer_IBMCognos8Pla nning84<br/>echo stop IBM Cognos 8 Planning 8.4 Service on Gateway Server &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt" <br/>sc \\GatewayServer stop "IBM Cognos 8 Planning 8.4"<br/><br/>:Resolve_GatewayServer_IBMCognos8Plannin g84_post<br/>REM This is to check that the service has stopped before moving on to the next service/server<br/>SC \\GatewayServer query "IBM Cognos 8 Planning 8.4" | FIND "STATE" | FIND "RUNNING" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StopService_GatewayServer_IBMCognos8Pla nning84<br/>SC \\GatewayServer query "IBM Cognos 8 Planning 8.4" | FIND "STATE" | FIND "STOPPED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StoppedService_GatewayServer_IBMCognos8 Planning84<br/>SC \\GatewayServer query "IBM Cognos 8 Planning 8.4" | FIND "STATE" | FIND "PAUSED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StopService_GatewayServer_IBMCognos8Pla nning84<br/>echo Service State is changing, waiting for service to resolve its state before making changes<br/>sc \\GatewayServer query "IBM Cognos 8 Planning 8.4" | Find "STATE"<br/>echo wait 10 seconds<br/>sleep 10<br/>GOTO Resolve_GatewayServer_IBMCognos8Plannin g84_post<br/><br/>:StoppedService_GatewayServer_IBMCognos8 Planning84<br/><br/>REM Show final status before moving on to the next service/server<br/>sc \\GatewayServer query "IBM Cognos 8 Planning 8.4" | Find "STATE"<br/><br/><br/><br/><br/><br/><br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/>echo Status of IBM Cognos 8 service on BIServer &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/>echo Status of IBM Cognos 8 service on BIServer<br/><br/>:Resolve_BIServer_IBMCognos8_pre<br/>REM This is to check the status of this particular service prior to making any changes<br/>SC \\BIServer query "IBM Cognos 8" | FIND "STATE" | FIND "RUNNING" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StopService_BIServer_IBMCognos8<br/>SC \\BIServer query "IBM Cognos 8" | FIND "STATE" | FIND "STOPPED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StoppedService_BIServer_IBMCognos8<br/>SC \\BIServer query "IBM Cognos 8" | FIND "STATE" | FIND "PAUSED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StopService_BIServer_IBMCognos8<br/>echo Service State is changing, waiting for service to resolve its state before making changes<br/>sc \\BIServer query "IBM Cognos 8" | Find "STATE"<br/>echo wait 10 seconds<br/>sleep 10<br/>sc \\BIServer query "IBM Cognos 8" | Find "STATE"<br/>GOTO Resolve_BIServer_IBMCognos8_pre<br/><br/>:StopService_BIServer_IBMCognos8<br/>echo stop IBM Cognos 8 Service on Content Manager / BI App Server Server &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt" <br/>sc \\BIServer stop "IBM Cognos 8"<br/><br/>:Resolve_BIServer_IBMCognos8_post<br/>REM This is to check that the service has stopped before moving on to the next service/server<br/>SC \\BIServer query "IBM Cognos 8" | FIND "STATE" | FIND "RUNNING" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StopService_BIServer_IBMCognos8<br/>SC \\BIServer query "IBM Cognos 8" | FIND "STATE" | FIND "STOPPED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StoppedService_BIServer_IBMCognos8<br/>SC \\BIServer query "IBM Cognos 8" | FIND "STATE" | FIND "PAUSED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StopService_BIServer_IBMCognos8<br/>echo Service State is changing, waiting for service to resolve its state before making changes<br/>sc \\BIServer query "IBM Cognos 8" | Find "STATE"<br/>echo wait 10 seconds<br/>sleep 10<br/>GOTO Resolve_BIServer_IBMCognos8_post<br/><br/>:StoppedService_BIServer_IBMCognos8<br/><br/>REM Show final status before moving on to the next service/server<br/>sc \\BIServer query "IBM Cognos 8" | Find "STATE"<br/><br/><br/><br/><br/><br/><br/><br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/>Echo Cognos Services stopped %date% %time% &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/><br/><br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/>echo wait 15 seconds &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>sleep 15<br/><br/>echo -------------- Reboot Servers ------------------<br/>echo -------------- Reboot Servers ------------------ &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/>echo Rebooting all servers in QA simultaneously &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/>echo Rebooting all servers in QA simultaneously<br/><br/>shutdown -m \\BIServer -r -t 15 -c "Weekly Maintenance Reboot - Cognos Administrator initiated. Please save and logoff." -f -d p:4:1<br/><br/>shutdown -m \\PlanningServer -r -t 15 -c "Weekly Maintenance Reboot - Cognos Administrator initiated. Please save and logoff." -f -d p:4:1<br/><br/>shutdown -m \\GatewayServer -r -t 15 -c "Weekly Maintenance Reboot - Cognos Administrator initiated. Please save and logoff." -f -d p:4:1<br/><br/>echo wait 90 seconds to ensure all servers are shutting down<br/>sleep 90<br/><br/>:CheckStatus_BIServer<br/>REM This is to check the status of the Event <a href="https://interviewquestions.tuteehub.com/tag/log-237006" style="font-weight:bold;" target="_blank" title="Click to know more about LOG">LOG</a> service as a means of determining the server is up and running<br/>SC \\BIServer query "Eventlog" | FIND "STATE" | FIND "RUNNING" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO CheckStatus_PlanningServer<br/>echo Service State is changing, waiting for service to resolve its state before making changes<br/>sc \\BIServer query "Eventlog" | Find "STATE"<br/>echo wait 10 seconds<br/>sleep 10<br/>GOTO CheckStatus_BIServer<br/><br/>:CheckStatus_PlanningServer<br/>REM This is to check the status of the Event Log service as a means of determining the server is up and running<br/>SC \\PlanningServer query "Eventlog" | FIND "STATE" | FIND "RUNNING" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO CheckStatus_GatewayServer<br/>echo Service State is changing, waiting for service to resolve its state before making changes<br/>sc \\PlanningServer query "Eventlog" | Find "STATE"<br/>echo wait 10 seconds<br/>sleep 10<br/>GOTO CheckStatus_PlanningServer<br/><br/>:CheckStatus_GatewayServer<br/>REM This is to check the status of the Event Log service as a means of determining the server is up and running<br/>SC \\GatewayServer query "Eventlog" | FIND "STATE" | FIND "RUNNING" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO All_Servers_Started<br/>echo Service State is changing, waiting for service to resolve its state before making changes<br/>sc \\GatewayServer query "Eventlog" | Find "STATE"<br/>echo wait 10 seconds<br/>sleep 10<br/>GOTO CheckStatus_GatewayServer<br/><br/><br/>:All_Servers_Started<br/><br/><br/><br/><br/><br/>echo -------------- Servers Rebooted ------------------<br/>echo -------------- Servers Rebooted ------------------ &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/><br/>echo -------------- stopping and starting World Wide Web Publishing service ------------------<br/>echo -------------- stopping and starting World Wide Web Publishing service ------------------ &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/>echo Status of World Wide Web Publishing Service on GatewayServer &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/>echo Status of World Wide Web Publishing Service on GatewayServer<br/><br/>:Resolve_GatewayServer_W3SVC_pre<br/>REM This is to check the status of this particular service prior to making any changes<br/>SC \\GatewayServer query "W3SVC" | FIND "STATE" | FIND "RUNNING" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StopService_GatewayServer_W3SVC<br/>SC \\GatewayServer query "W3SVC" | FIND "STATE" | FIND "STOPPED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StoppedService_GatewayServer_W3SVC<br/>SC \\GatewayServer query "W3SVC" | FIND "STATE" | FIND "PAUSED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StopService_GatewayServer_W3SVC<br/>echo Service State is changing, waiting for service to resolve its state before making changes<br/>sc \\GatewayServer query "W3SVC" | Find "STATE"<br/>echo wait 10 seconds<br/>sleep 10<br/>GOTO Resolve_GatewayServer_W3SVC_pre<br/><br/>:StopService_GatewayServer_W3SVC<br/><br/>echo stop World Wide Web Publishing Service on Gateway Server &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt" <br/>sc \\GatewayServer stop "W3SVC"<br/><br/>:Resolve_GatewayServer_W3SVC_post<br/>REM This is to check that the service has stopped before moving on to the next service/server<br/>SC \\GatewayServer query "W3SVC" | FIND "STATE" | FIND "RUNNING" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StopService_GatewayServer_W3SVC<br/>SC \\GatewayServer query "W3SVC" | FIND "STATE" | FIND "STOPPED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StoppedService_GatewayServer_W3SVC<br/>SC \\GatewayServer query "W3SVC" | FIND "STATE" | FIND "PAUSED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StopService_GatewayServer_W3SVC<br/>echo Service State is changing, waiting for service to resolve its state before making changes<br/>sc \\GatewayServer query "W3SVC" | Find "STATE"<br/>echo wait 10 seconds<br/>sleep 10<br/>GOTO Resolve_GatewayServer_W3SVC_post<br/><br/>:StoppedService_GatewayServer_W3SVC<br/><br/>REM Show final status before moving on to the next service/server<br/>sc \\GatewayServer query "W3SVC" | Find "STATE"<br/><br/><br/><br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/>Echo World Wide Web Publishing Service stopped %date% %time% &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/><br/><br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/><br/><br/><br/><br/>echo Status of World Wide Web Publishing service on GatewayServer &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/>echo Status of World Wide Web Publishing service on GatewayServer<br/><br/>:Resolve_START_GatewayServer_W3SVC_pre<br/>REM This is to check the status of this particular service prior to making any changes<br/>SC \\GatewayServer query "W3SVC" | FIND "STATE" | FIND "STOPPED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StartService_GatewayServer_W3SVC<br/>SC \\GatewayServer query "W3SVC" | FIND "STATE" | FIND "RUNNING" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StartedService_GatewayServer_W3SVC<br/>SC \\GatewayServer query "W3SVC" | FIND "STATE" | FIND "PAUSED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StartService_GatewayServer_W3SVC<br/>echo Service State is changing, waiting for service to resolve its state before making changes<br/>sc \\GatewayServer query "W3SVC" | Find "STATE"<br/>echo wait 10 seconds<br/>sleep 10<br/>GOTO Resolve_START_GatewayServer_W3SVC_pre<br/><br/>:StartService_GatewayServer_W3SVC<br/>echo start World Wide Web Publishing Service on Gateway Server &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt" <br/>sc \\GatewayServer start "W3SVC"<br/><br/>:Resolve_START_GatewayServer_W3SVC_post<br/>REM This is to check that the service has stopped before moving on to the next service/server<br/>SC \\GatewayServer query "W3SVC" | FIND "STATE" | FIND "STOPPED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StartService_GatewayServer_W3SVC<br/>SC \\GatewayServer query "W3SVC" | FIND "STATE" | FIND "RUNNING" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StartedService_GatewayServer_W3SVC<br/>SC \\GatewayServer query "W3SVC" | FIND "STATE" | FIND "PAUSED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StartService_GatewayServer_W3SVC<br/>echo Service State is changing, waiting for service to resolve its state before making changes<br/>sc \\GatewayServer query "W3SVC" | Find "STATE"<br/>echo wait 10 seconds<br/>sleep 10<br/>GOTO Resolve_START_GatewayServer_W3SVC_post<br/><br/>:StartedService_GatewayServer_W3SVC<br/><br/>REM Show final status before moving on to the next service/server<br/>sc \\GatewayServer query "W3SVC" | Find "STATE"<br/><br/><br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/>Echo World Wide Web Publishing Service started %date% %time% &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/><br/><br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/><br/><br/><br/>echo -------------- starting Cognos services ------------------<br/>echo -------------- starting Cognos services ------------------ &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/><br/><br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/>echo Status of IBM Cognos 8 service on BIServer &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/>echo Status of IBM Cognos 8 service on BIServer<br/><br/>:Resolve_START_BIServer_IBMCognos8_pre<br/>REM This is to check the status of this particular service prior to making any changes<br/>SC \\BIServer query "IBM Cognos 8" | FIND "STATE" | FIND "STOPPED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StartService_BIServer_IBMCognos8<br/>SC \\BIServer query "IBM Cognos 8" | FIND "STATE" | FIND "RUNNING" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StartedService_BIServer_IBMCognos8<br/>SC \\BIServer query "IBM Cognos 8" | FIND "STATE" | FIND "PAUSED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StartService_BIServer_IBMCognos8<br/>echo Service State is changing, waiting for service to resolve its state before making changes<br/>sc \\BIServer query "IBM Cognos 8" | Find "STATE"<br/>echo wait 10 seconds<br/>sleep 10<br/>GOTO Resolve_START_BIServer_IBMCognos8_pre<br/><br/>:StartService_BIServer_IBMCognos8<br/>echo start IBM Cognos 8 Service on Content Manager / BI App Server &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt" <br/>sc \\BIServer start "IBM Cognos 8"<br/><br/>:Resolve_START_BIServer_IBMCognos8_post<br/>REM This is to check that the service has stopped before moving on to the next service/server<br/>SC \\BIServer query "IBM Cognos 8" | FIND "STATE" | FIND "STOPPED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StartService_BIServer_IBMCognos8<br/>SC \\BIServer query "IBM Cognos 8" | FIND "STATE" | FIND "RUNNING" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StartedService_BIServer_IBMCognos8<br/>SC \\BIServer query "IBM Cognos 8" | FIND "STATE" | FIND "PAUSED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StartService_BIServer_IBMCognos8<br/>echo Service State is changing, waiting for service to resolve its state before making changes<br/>sc \\BIServer query "IBM Cognos 8" | Find "STATE"<br/>echo wait 10 seconds<br/>sleep 10<br/>GOTO Resolve_START_BIServer_IBMCognos8_post<br/><br/>:StartedService_BIServer_IBMCognos8<br/><br/>REM Show final status before moving on to the next service/server<br/>sc \\BIServer query "IBM Cognos 8" | Find "STATE"<br/><br/><br/><br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/>echo Status of IBM Cognos 8 Planning 8.4 service on PlanningServer &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/>echo Status of IBM Cognos 8 Planning 8.4 service on PlanningServer<br/><br/>:Resolve_START_PlanningServer_IBMCognos8 Planning84_pre<br/>REM This is to check the status of this particular service prior to making any changes<br/>SC \\PlanningServer query "IBM Cognos 8 Planning 8.4" | FIND "STATE" | FIND "STOPPED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StartService_PlanningServer_IBMCognos8P lanning84<br/>SC \\PlanningServer query "IBM Cognos 8 Planning 8.4" | FIND "STATE" | FIND "RUNNING" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StartedService_PlanningServer_IBMCognos 8Planning84<br/>SC \\PlanningServer query "IBM Cognos 8 Planning 8.4" | FIND "STATE" | FIND "PAUSED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StartService_PlanningServer_IBMCognos8P lanning84<br/>echo Service State is changing, waiting for service to resolve its state before making changes<br/>sc \\PlanningServer query "IBM Cognos 8 Planning 8.4" | Find "STATE"<br/>echo wait 10 seconds<br/>sleep 10<br/>GOTO Resolve_START_PlanningServer_IBMCognos8 Planning84_pre<br/><br/>:StartService_PlanningServer_IBMCognos8P lanning84<br/>echo start IBM Cognos 8 Planning 8.4 and IBM Cognos 8 Service on EP App Server &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt" <br/>sc \\PlanningServer start "IBM Cognos 8 Planning 8.4"<br/><br/>:Resolve_START_PlanningServer_IBMCognos8 Planning84_post<br/>REM This is to check that the service has stopped before moving on to the next service/server<br/>SC \\PlanningServer query "IBM Cognos 8 Planning 8.4" | FIND "STATE" | FIND "STOPPED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StartService_PlanningServer_IBMCognos8P lanning84<br/>SC \\PlanningServer query "IBM Cognos 8 Planning 8.4" | FIND "STATE" | FIND "RUNNING" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StartedService_PlanningServer_IBMCognos 8Planning84<br/>SC \\PlanningServer query "IBM Cognos 8 Planning 8.4" | FIND "STATE" | FIND "PAUSED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StartService_PlanningServer_IBMCognos8P lanning84<br/>echo Service State is changing, waiting for service to resolve its state before making changes<br/>sc \\PlanningServer query "IBM Cognos 8 Planning 8.4" | Find "STATE"<br/>echo wait 10 seconds<br/>sleep 10<br/>GOTO Resolve_START_PlanningServer_IBMCognos8 Planning84_post<br/><br/>:StartedService_PlanningServer_IBMCognos 8Planning84<br/><br/>REM Show final status before moving on to the next service/server<br/>sc \\PlanningServer query "IBM Cognos 8 Planning 8.4" | Find "STATE"<br/><br/><br/><br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/>REM This section is left in strictly as a fail safe in case the IBM Cognos 8 service does not automatically<br/>REM start with the start of the IBM Cognos 8 Planning 8.4 service. Generally speaking, this should only <br/>REM serve to present the status of the IBM Cognos 8 service as running.<br/><br/>echo Status of IBM Cognos 8 service on PlanningServer &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/>echo Status of IBM Cognos 8 service on PlanningServer<br/><br/>:Resolve_START_PlanningServer_IBMCognos8 _pre<br/>REM This is to check the status of this particular service prior to making any changes<br/>SC \\PlanningServer query "IBM Cognos 8" | FIND "STATE" | FIND "STOPPED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StartService_PlanningServer_IBMCognos8<br/>SC \\PlanningServer query "IBM Cognos 8" | FIND "STATE" | FIND "RUNNING" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StartedService_PlanningServer_IBMCognos 8<br/>SC \\PlanningServer query "IBM Cognos 8" | FIND "STATE" | FIND "PAUSED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StartService_PlanningServer_IBMCognos8<br/>echo Service State is changing, waiting for service to resolve its state before making changes<br/>sc \\PlanningServer query "IBM Cognos 8" | Find "STATE"<br/>echo wait 10 seconds<br/>sleep 10<br/>GOTO Resolve_START_PlanningServer_IBMCognos8 _pre<br/><br/>:StartService_PlanningServer_IBMCognos8<br/>echo start IBM Cognos 8 Service on EP App Server &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt" <br/>sc \\PlanningServer start "IBM Cognos 8"<br/><br/>:Resolve_START_PlanningServer_IBMCognos8 _post<br/>REM This is to check that the service has stopped before moving on to the next service/server<br/>SC \\PlanningServer query "IBM Cognos 8" | FIND "STATE" | FIND "STOPPED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StartService_PlanningServer_IBMCognos8<br/>SC \\PlanningServer query "IBM Cognos 8" | FIND "STATE" | FIND "RUNNING" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StartedService_PlanningServer_IBMCognos 8<br/>SC \\PlanningServer query "IBM Cognos 8" | FIND "STATE" | FIND "PAUSED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StartService_PlanningServer_IBMCognos8<br/>echo Service State is changing, waiting for service to resolve its state before making changes<br/>sc \\PlanningServer query "IBM Cognos 8" | Find "STATE"<br/>echo wait 10 seconds<br/>sleep 10<br/>GOTO Resolve_START_PlanningServer_IBMCognos8 _post<br/><br/>:StartedService_PlanningServer_IBMCognos 8<br/><br/>REM Show final status before moving on to the next service/server<br/>sc \\PlanningServer query "IBM Cognos 8" | Find "STATE"<br/><br/><br/><br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/>echo Status of IBM Cognos 8 Planning 8.4 service on GatewayServer &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/>echo Status of IBM Cognos 8 Planning 8.4 service on GatewayServer<br/><br/>:Resolve_START_GatewayServer_IBMCognos8P lanning84_pre<br/>REM This is to check the status of this particular service prior to making any changes<br/>SC \\GatewayServer query "IBM Cognos 8 Planning 8.4" | FIND "STATE" | FIND "STOPPED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StartService_GatewayServer_IBMCognos8Pl anning84<br/>SC \\GatewayServer query "IBM Cognos 8 Planning 8.4" | FIND "STATE" | FIND "RUNNING" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StartedService_GatewayServer_IBMCognos8 Planning84<br/>SC \\GatewayServer query "IBM Cognos 8 Planning 8.4" | FIND "STATE" | FIND "PAUSED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StartService_GatewayServer_IBMCognos8Pl anning84<br/>echo Service State is changing, waiting for service to resolve its state before making changes<br/>sc \\GatewayServer query "IBM Cognos 8 Planning 8.4" | Find "STATE"<br/>echo wait 10 seconds<br/>sleep 10<br/>GOTO Resolve_START_GatewayServer_IBMCognos8P lanning84_pre<br/><br/>:StartService_GatewayServer_IBMCognos8Pl anning84<br/>echo start IBM Cognos 8 Planning 8.4 and IBM Cognos 8 Service on Gateway Server &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt" <br/>sc \\GatewayServer start "IBM Cognos 8 Planning 8.4"<br/><br/>:Resolve_START_GatewayServer_IBMCognos8P lanning84_post<br/>REM This is to check that the service has stopped before moving on to the next service/server<br/>SC \\GatewayServer query "IBM Cognos 8 Planning 8.4" | FIND "STATE" | FIND "STOPPED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StartService_GatewayServer_IBMCognos8Pl anning84<br/>SC \\GatewayServer query "IBM Cognos 8 Planning 8.4" | FIND "STATE" | FIND "RUNNING" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StartedService_GatewayServer_IBMCognos8 Planning84<br/>SC \\GatewayServer query "IBM Cognos 8 Planning 8.4" | FIND "STATE" | FIND "PAUSED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StartService_GatewayServer_IBMCognos8Pl anning84<br/>echo Service State is changing, waiting for service to resolve its state before making changes<br/>sc \\GatewayServer query "IBM Cognos 8 Planning 8.4" | Find "STATE"<br/>echo wait 10 seconds<br/>sleep 10<br/>GOTO Resolve_START_GatewayServer_IBMCognos8P lanning84_post<br/><br/>:StartedService_GatewayServer_IBMCognos8 Planning84<br/><br/>REM Show final status before moving on to the next service/server<br/>sc \\GatewayServer query "IBM Cognos 8 Planning 8.4" | Find "STATE"<br/><br/><br/><br/><br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/>REM This section is left in strictly as a fail safe in case the IBM Cognos 8 service does not automatically<br/>REM start with the start of the IBM Cognos 8 Planning 8.4 service. Generally speaking, this should only <br/>REM serve to present the status of the IBM Cognos 8 service as running.<br/><br/>echo Status of IBM Cognos 8 service on GatewayServer &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/>echo Status of IBM Cognos 8 service on GatewayServer<br/><br/>:Resolve_START_GatewayServer_IBMCognos8_ pre<br/>REM This is to check the status of this particular service prior to making any changes<br/>SC \\GatewayServer query "IBM Cognos 8" | FIND "STATE" | FIND "STOPPED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StartService_GatewayServer_IBMCognos8<br/>SC \\GatewayServer query "IBM Cognos 8" | FIND "STATE" | FIND "RUNNING" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StartedService_GatewayServer_IBMCognos8<br/>SC \\GatewayServer query "IBM Cognos 8" | FIND "STATE" | FIND "PAUSED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StartService_GatewayServer_IBMCognos8<br/>echo Service State is changing, waiting for service to resolve its state before making changes<br/>sc \\GatewayServer query "IBM Cognos 8" | Find "STATE"<br/>echo wait 10 seconds<br/>sleep 10<br/>GOTO Resolve_START_GatewayServer_IBMCognos8_ pre<br/><br/>:StartService_GatewayServer_IBMCognos8<br/>echo start IBM Cognos 8 Service on Gateway Server &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt" <br/>sc \\GatewayServer start "IBM Cognos 8"<br/><br/>:Resolve_START_GatewayServer_IBMCognos8_ post<br/>REM This is to check that the service has stopped before moving on to the next service/server<br/>SC \\GatewayServer query "IBM Cognos 8" | FIND "STATE" | FIND "STOPPED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StartService_GatewayServer_IBMCognos8<br/>SC \\GatewayServer query "IBM Cognos 8" | FIND "STATE" | FIND "RUNNING" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StartedService_GatewayServer_IBMCognos8<br/>SC \\GatewayServer query "IBM Cognos 8" | FIND "STATE" | FIND "PAUSED" &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>IF errorlevel 0 IF NOT errorlevel 1 GOTO StartService_GatewayServer_IBMCognos8<br/>echo Service State is changing, waiting for service to resolve its state before making changes<br/>sc \\GatewayServer query "IBM Cognos 8" | Find "STATE"<br/>echo wait 10 seconds<br/>sleep 10<br/>GOTO Resolve_START_GatewayServer_IBMCognos8_ post<br/><br/>:StartedService_GatewayServer_IBMCognos8<br/><br/>REM Show final status before moving on to the next service/server<br/>sc \\GatewayServer query "IBM Cognos 8" | Find "STATE"<br/><br/><br/><br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/><br/><br/><br/>Echo Cognos Services started %date% %time% &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/><br/><br/><br/><br/><br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/>REM Delay, primarily for development and testing purposes to quickly review the environment<br/>echo wait 15 seconds &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>sleep 15<br/><br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo - &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/>echo completed RecycleServices_QA.bat &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/><br/>echo completed RecycleServices_QA.bat<br/><br/>echo wait 15 seconds<br/>sleep 15<br/><br/>Echo --- &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo --- &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"<br/>Echo --- &gt;&gt; "\\ScriptsServer\Cognos Scripts\RebootAndRecycleServices_QA.txt"</p></body></html>
8888.

Solve : Need help on file compare option?

Answer» <html><body><p>Hi Friends,<br/><br/>Is it possible to compare 2 text file <a href="https://interviewquestions.tuteehub.com/tag/using-1441597" style="font-weight:bold;" target="_blank" title="Click to know more about USING">USING</a> <a href="https://interviewquestions.tuteehub.com/tag/dos-432778" style="font-weight:bold;" target="_blank" title="Click to know more about DOS">DOS</a> command? Please advise. The clear data is mentioned below for your reference.<br/><br/>content on File1:<br/>1.zip<br/>2.zip<br/>3.zip<br/>4.zip<br/><br/>content on File2:<br/>1.zip<br/>2.zip<br/>4.zip<br/><br/>The output file should display the 3.zip which is not in file2 but on file1. Please help on this. Thanks.If 3 zip isn't on file 2 it won't show in the content output...no matter what you do...Hi Patio,<br/><br/>Thanks much foir quick reply. Is there is any possiblity to print the line which is not in file2 but which is available on file1? Please adviseCode: <a>[Select]</a>@echo off<br/>setlocal enabledelayedexpansion<br/><br/>echo 1.zip &gt; File1<br/>echo 2.zip &gt;&gt; File1<br/>echo 3.zip &gt;&gt; File1<br/>echo 4.zip &gt;&gt; File1<br/>echo 5.zip &gt;&gt; File1<br/>echo 6.zip &gt;&gt; File1<br/>echo 7.zip &gt;&gt; File1<br/>echo 8.zip &gt;&gt; File1<br/>echo 9.zip &gt;&gt; File1<br/>echo 10.zip &gt;&gt; File1<br/><br/>echo 1.zip &gt; File2<br/>echo 2.zip &gt;&gt; File2<br/>REM echo 3.zip &gt;&gt; File2<br/>echo 4.zip &gt;&gt; File2<br/>echo 5.zip &gt;&gt; File2<br/>REM echo 6.zip &gt;&gt; File2<br/>echo 7.zip &gt;&gt; File2<br/>echo 8.zip &gt;&gt; File2<br/>echo 9.zip &gt;&gt; File2<br/>echo 10.zip &gt;&gt; File2<br/>echo 99.zip &gt;&gt; File2<br/><br/>for /f "delims=" %%A in (File1) do (<br/> set found=1<br/> For /F "delims=" %%B in (File2) do if "%%A"=="%%B" set /a found+=1<br/> if not !found! equ 2 echo %%A is present in File1 but not in File2<br/> )<br/><br/>for /f "delims=" %%A in (File2) do (<br/> set found=1<br/> For /F "delims=" %%B in (File1) do if "%%A"=="%%B" set /a found+=1<br/> if not !found! equ 2 echo %%A is present in File2 but not in File1<br/> )<br/><br/>Code: <a>[Select]</a>3.zip is present in File1 but not in File2<br/>6.zip is present in File1 but not in File2<br/>99.zip is present in File2 but not in File1Fixed a possible bug if a line is present more than once in one of the files<br/><br/>Code: <a>[Select]</a>@echo off<br/>setlocal enabledelayedexpansion<br/><br/>echo 1.zip &gt; File1<br/>echo 2.zip &gt;&gt; File1<br/>echo 3.zip &gt;&gt; File1<br/>echo 4.zip &gt;&gt; File1<br/>echo 5.zip &gt;&gt; File1<br/>echo 6.zip &gt;&gt; File1<br/>echo 7.zip &gt;&gt; File1<br/>echo 8.zip &gt;&gt; File1<br/>echo 9.zip &gt;&gt; File1<br/>echo 10.zip &gt;&gt; File1<br/><br/>echo 1.zip &gt; File2<br/>echo 2.zip &gt;&gt; File2<br/>REM echo 3.zip &gt;&gt; File2<br/>echo 4.zip &gt;&gt; File2<br/>echo 5.zip &gt;&gt; File2<br/>REM echo 6.zip &gt;&gt; File2<br/>echo 7.zip &gt;&gt; File2<br/>echo 8.zip &gt;&gt; File2<br/>echo 9.zip &gt;&gt; File2<br/>echo 10.zip &gt;&gt; File2<br/>echo 99.zip &gt;&gt; File2<br/><br/>for /f "delims=" %%A in (File1) do (<br/> set found=1<br/> For /F "delims=" %%B in (File2) do if "%%A"=="%%B" set /a found+=1<br/> if !found! equ 1 echo %%A is present in File1 but not in File2<br/> )<br/><br/>for /f "delims=" %%A in (File2) do (<br/> set found=1<br/> For /F "delims=" %%B in (File1) do if "%%A"=="%%B" set /a found+=1<br/> if !found! equ 1 echo %%A is present in File2 but not in File1<br/> )<br/><br/>Code: <a>[Select]</a>3.zip is present in File1 but not in File2<br/>6.zip is present in File1 but not in File2<br/>99.zip is present in File2 but not in File1of course, a batch script is just about the slowest way to do this sort of <a href="https://interviewquestions.tuteehub.com/tag/thing-25656" style="font-weight:bold;" target="_blank" title="Click to know more about THING">THING</a>, especially if the file sizes are larger than just a few lines. I tried the script above on two 10,000 line files and the time was 15 minutes for each compare. With VBScript it was down to 2 minutes.<br/>fc file1 file2<br/><br/>OR output to file <br/><br/>fc file1 file2 &gt; diffs.txt<br/><br/>Why doesn't this work for you? <br/><br/><br/><br/>Quote from: sandy1000 on June 23, 2011, 10:19:51 AM</p><blockquote>fc file1 file2</blockquote><br/>The original poster desired to find which strings were present in the first file but not in the second. The FC command merely does a simple comparison. If we assume that the second file is just a copy of the first but with one or more lines deleted, then FC will flag every line after the missing one as a "difference", whether or not it is missing from the first file. Possibly by a diligent <a href="https://interviewquestions.tuteehub.com/tag/examination-769661" style="font-weight:bold;" target="_blank" title="Click to know more about EXAMINATION">EXAMINATION</a> ofthe output it might be possible to discover the required information, but ti <a href="https://interviewquestions.tuteehub.com/tag/would-3285927" style="font-weight:bold;" target="_blank" title="Click to know more about WOULD">WOULD</a> not be very convenient.<br/></body></html>
8889.

Solve : .bat - looping through a text file?

Answer» <html><body><p>Hi, <br/><br/>what i am trying to achieve, is to measure network performance using a batch file<br/>The batch file copies a test file (1meg.test) from from a central server to the c:\<a href="https://interviewquestions.tuteehub.com/tag/temp-344990" style="font-weight:bold;" target="_blank" title="Click to know more about TEMP">TEMP</a> directory on a bunch of <a href="https://interviewquestions.tuteehub.com/tag/computers-21658" style="font-weight:bold;" target="_blank" title="Click to know more about COMPUTERS">COMPUTERS</a>. by looping through a list (list.txt) of computers at remote sites to calculate the <a href="https://interviewquestions.tuteehub.com/tag/amount-246331" style="font-weight:bold;" target="_blank" title="Click to know more about AMOUNT">AMOUNT</a> of time taken to copy the file to each computer, then outputs the results to a txt file (timer.txt) <br/><br/>i have two batch files <br/>the first (run.bat) calls the main batch file and reads from the list.txt <br/><br/>---RUN.BAT---<br/><br/>FOR /f %%u IN (list.txt) DO call c:\temp\timer.bat %%u &gt;&gt; c:\temp\timer.txt <br/><br/>--------------------------------------------------------------------------<br/>which then should then run the second batch file (timer.bat)<br/><br/>---timer.bat---<br/><br/>@echo off<br/> <br/>FOR /F "skip=1 tokens=1-6" %%A IN ('WMIC Path Win32_LocalTime Get Day^,Hour^,Minute^,Second /Format:table ^| findstr /r "."') DO ( <br/>set Milisecond=%time:~9,2% <br/>set Day=%%A<br/>set Hour=%%B<br/>set Minute=%%C<br/>set Second=%%D<br/>) <br/>set /a Start=%Day%*8640000+%Hour%*360000+%Minute%*6000+%Second%*100+%Milisecond%<br/> <br/>copy c:\temp\1meg.test \\%comp%\c$\temp [this is where i am having a problem]<br/><br/>FOR /F "skip=1 tokens=1-6" %%A IN ('WMIC Path Win32_LocalTime Get Day^,Hour^,Minute^,Second /Format:table ^| findstr /r "."') DO ( <br/>set Day=%%A<br/>set Hour=%%B<br/>set Minute=%%C<br/>set Second=%%D<br/>) <br/>set Milisecond=%time:~9,2% <br/>set /a End=%Day%*8640000+%Hour%*360000+%Minute%*6000+%Second%*100+%Milisecond%<br/>set /a Diff=%End%-%Start%<br/>set /a DiffMS=%Diff%%%100 <br/>set /a Diff=(%Diff%-%DiffMS%)/100 <br/>set /a DiffSec=%Diff%%%60 <br/>set /a Diff=(%Diff%-%Diff%%%60)/60 <br/>set /a DiffMin=%Diff%%%60 <br/>set /a Diff=(%Diff%-%Diff%%%60)/60 <br/>set /a DiffHrs=%Diff%<br/> <br/>:: format with leading zeroes <br/>if %DiffMS% LSS 10 set DiffMS=0%DiffMS!% <br/>if %DiffSec% LSS 10 set DiffMS=0%DiffSec%<br/>if %DiffMin% LSS 10 set DiffMS=0%DiffMin%<br/>if %DiffHrs% LSS 10 set DiffMS=0%DiffHrs%<br/> <br/>echo %DiffHrs%:%DiffMin%:%DiffSec%.%DiffMS% &gt;&gt; c:\temp\timer.txt<br/>---------------------------------------------------------------------------<br/><br/>---list.txt---<br/>computer1<br/>computer2<br/>computer3<br/>computer4<br/>computer5<br/>.etc..<br/><br/>the output that i am trying to get is something like <br/>----output.txt------<br/>computer1<br/>00.200 sec<br/>computer2<br/>00.300 sec<br/>computer3<br/>00.400 sec<br/>etc ....<br/><br/>the time function calculates correctly my problem is getting the batch to loop through the list of remote computers <br/>if you can help, thanks in advance Have you considered <a href="https://interviewquestions.tuteehub.com/tag/making-1085093" style="font-weight:bold;" target="_blank" title="Click to know more about MAKING">MAKING</a> this into one file? You could call your list and then <a href="https://interviewquestions.tuteehub.com/tag/use-241643" style="font-weight:bold;" target="_blank" title="Click to know more about USE">USE</a> a nested for loop to run the functions of the timer.bat file. <br/><br/>For instance:<br/><br/><br/>@echo off<br/>FOR /f %%u IN (list.txt) DO (<br/><br/>FOR /F "skip=1 tokens=1-6" %%A IN ('WMIC Path Win32_LocalTime Get Day^,Hour^,Minute^,Second /Format:table ^| findstr /r "."') DO ( <br/>set Milisecond=%time:~9,2% <br/>set Day=%%A<br/>set Hour=%%B<br/>set Minute=%%C<br/>set Second=%%D<br/>) <br/>set /a Start=%Day%*8640000+%Hour%*360000+%Minute%*6000+%Second%*100+%Milisecond%<br/> <br/>copy c:\temp\1meg.test \\%%u\c$\temp <br/><br/>FOR /F "skip=1 tokens=1-6" %%A IN ('WMIC Path Win32_LocalTime Get Day^,Hour^,Minute^,Second /Format:table ^| findstr /r "."') DO ( <br/>set Day=%%A<br/>set Hour=%%B<br/>set Minute=%%C<br/>set Second=%%D<br/>) <br/>set Milisecond=%time:~9,2% <br/>set /a End=%Day%*8640000+%Hour%*360000+%Minute%*6000+%Second%*100+%Milisecond%<br/>set /a Diff=%End%-%Start%<br/>set /a DiffMS=%Diff%%%100 <br/>set /a Diff=(%Diff%-%DiffMS%)/100 <br/>set /a DiffSec=%Diff%%%60 <br/>set /a Diff=(%Diff%-%Diff%%%60)/60 <br/>set /a DiffMin=%Diff%%%60 <br/>set /a Diff=(%Diff%-%Diff%%%60)/60 <br/>set /a DiffHrs=%Diff%<br/> <br/>:: format with leading zeroes <br/>if %DiffMS% LSS 10 set DiffMS=0%DiffMS!% <br/>if %DiffSec% LSS 10 set DiffMS=0%DiffSec%<br/>if %DiffMin% LSS 10 set DiffMS=0%DiffMin%<br/>if %DiffHrs% LSS 10 set DiffMS=0%DiffHrs%<br/> <br/>echo %%u %DiffHrs%:%DiffMin%:%DiffSec%.%DiffMS% &gt;&gt; c:\temp\timer.txt<br/>)</p></body></html>
8890.

Solve : Adding domain users to local group through command prompt?

Answer» <html><body><p>In computer management, when I add a domain <a href="https://interviewquestions.tuteehub.com/tag/user-25565" style="font-weight:bold;" target="_blank" title="Click to know more about USER">USER</a> group to the local <a href="https://interviewquestions.tuteehub.com/tag/administrators-368062" style="font-weight:bold;" target="_blank" title="Click to know more about ADMINISTRATORS">ADMINISTRATORS</a> group, I'm prompted for my Active Directory <a href="https://interviewquestions.tuteehub.com/tag/credentials-938512" style="font-weight:bold;" target="_blank" title="Click to know more about CREDENTIALS">CREDENTIALS</a>. <br/><br/>Is there way to <a href="https://interviewquestions.tuteehub.com/tag/use-241643" style="font-weight:bold;" target="_blank" title="Click to know more about USE">USE</a> <em>net localgroup administrators domain/groupname /ADD</em> <a href="https://interviewquestions.tuteehub.com/tag/aeuroewithout-1475023" style="font-weight:bold;" target="_blank" title="Click to know more about WITHOUT">WITHOUT</a> being on the domain? Perhaps a credentials switch?</p></body></html>
8891.

Solve : File Compare?

Answer» <html><body><p>Hello all,<br/><br/>I am using file compare on two text files. It seems to return the line previous to and the line following, as well as the line that's different. Is this correct? I don't find this noted in FC help info. <br/><br/>Thank,<br/><br/>SandyFC shows the differences in a dumb way. If you want to know the first place in a file where there is a difference, use a binary comparison.<br/><br/><a href="https://interviewquestions.tuteehub.com/tag/code-25512" style="font-weight:bold;" target="_blank" title="Click to know more about CODE">CODE</a>: <a>[Select]</a>C:\&gt;type file1<br/>hello<br/>goodbye<br/>different1<br/><br/>C:\&gt;type file2<br/>hello<br/>goodbye<br/>different2<br/><br/>C:\&gt;fc file1 file2<br/>Comparing files file1 and FILE2<br/>***** file1<br/>goodbye<br/>different1<br/>***** FILE2<br/>goodbye<br/>different2<br/>*****<br/><br/>Code: <a>[Select]</a>C:\&gt;fc /b file1 file2<br/>Comparing files file1 and FILE2<br/>00000019: 31 32<br/>So then, I should see the line that's different, along with the line above and the line after it (if there is one)? <br/><br/>I apologize that I don't know how to read the binary result, if you could get me started with that.<br/><br/>Thanks.What is the reason for using FC? What are you trying to find out about the two files?<br/>I'm running an invoice off of a system. I want to make sure the invoice is exactly like a previous run of that invoice. <br/><br/>I expected to see the run date was different. The additional lines threw me and I could not find anything different about them. Except that it appears to be including info from above and below the line of discrepancy. (A name edit had also taken place in the body of the invoice, so there was extraneous info there also). A bit confusing when you're only expecting to see what's different. <br/><br/>So I' was trying to confirm how FC works and that I'm not somehow missing something. <br/><br/><br/><br/>Actually, I had done a test with text and it returned the lines above and below the line of discrepancy. So I thought that's what was happening. <br/><br/>Looking at the real data:<br/><br/>* It is showing only the last 8 characters of the 136 character line above. <br/><br/>* What looks like it would be the line below the line of discrepancy (which has a name edit) <br/> is actually the last 32 characters of that same line (which is 160 characters total). <br/><br/><br/>Specifically how does FC report back? <br/><br/><br/> <br/>Can anyone describe what FC would return when one line is different? Why don't you do some experiments?<br/>I did do a controlled test to see what returned. The real data return seems different and I don't understand the result. So, I'm not understanding what FC is supposed to return when one line differs. <br/><br/>I'd like to know the syntax for the return if anyone knows it (can't seem to find it anywhere for some reason). <br/><br/>Quote from: sandy1000 on June 24, 2011, 09:49:17 AM</p><blockquote>I did do a controlled test to see what returned. The real data return seems different and I don't understand the result. So, I'm not understanding what FC is supposed to return when one line differs. <br/><br/>I'd like to know the syntax for the return if anyone knows it (can't seem to find it anywhere for some reason). <br/></blockquote><br/>What do you mean "if one line differs"? Do you mean 2 files which have exactly the same number of characters, in the same number of lines, but one line is different in one of the files? At the beginning, in the middle, or at the end? Or two one-line files, each different from the other? Or what?<br/><br/>The results below seem clear enough to me.<br/><br/>Text1.txt <br/><br/>Code: <a>[Select]</a>The prime minister, in Brussels for an <a href="https://interviewquestions.tuteehub.com/tag/eu-446864" style="font-weight:bold;" target="_blank" title="Click to know more about EU">EU</a> summit where Greece's debt crisis is<br/>among items on the agenda, <a href="https://interviewquestions.tuteehub.com/tag/said-629244" style="font-weight:bold;" target="_blank" title="Click to know more about SAID">SAID</a>: "Britain is out of the euro - I think we will<br/>stay out of the euro and certainly as long as I am doing this job there is no<br/>prospect of Britain even contemplating <a href="https://interviewquestions.tuteehub.com/tag/joining-525969" style="font-weight:bold;" target="_blank" title="Click to know more about JOINING">JOINING</a> the euro."<br/>The Greek parliament has to pass fresh austerity measures next week before the<br/>country can gain vital bail-out funds to prevent it defaulting on its loan<br/>payments, due in mid-July.<br/>Mr Blair told BBC One's Politics Show, in an interview to be broadcast on<br/>Sunday, he had backed the idea of Britain joining the euro when he came to<br/>power - but had accepted that the conditions had to be right.<br/>Text2.txt - First line: lower case p changed to upper case.<br/><br/>Code: <a>[Select]</a>The Prime minister, in Brussels for an EU summit where Greece's debt crisis is<br/>among items on the agenda, said: "Britain is out of the euro - I think we will<br/>stay out of the euro and certainly as long as I am doing this job there is no<br/>prospect of Britain even contemplating joining the euro."<br/>The Greek parliament has to pass fresh austerity measures next week before the<br/>country can gain vital bail-out funds to prevent it defaulting on its loan<br/>payments, due in mid-July.<br/>Mr Blair told BBC One's Politics Show, in an interview to be broadcast on<br/>Sunday, he had backed the idea of Britain joining the euro when he came to<br/>power - but had accepted that the conditions had to be right.<br/>Text3.txt - 7th line: July changed to july<br/><br/>Code: <a>[Select]</a>The prime minister, in Brussels for an EU summit where Greece's debt crisis is<br/>among items on the agenda, said: "Britain is out of the euro - I think we will<br/>stay out of the euro and certainly as long as I am doing this job there is no<br/>prospect of Britain even contemplating joining the euro."<br/>The Greek parliament has to pass fresh austerity measures next week before the<br/>country can gain vital bail-out funds to prevent it defaulting on its loan<br/>payments, due in mid-july.<br/>Mr Blair told BBC One's Politics Show, in an interview to be broadcast on<br/>Sunday, he had backed the idea of Britain joining the euro when he came to<br/>power - but had accepted that the conditions had to be right.<br/>Text4.txt - Last line: had changed to Had<br/><br/>Code: <a>[Select]</a>The prime minister, in Brussels for an EU summit where Greece's debt crisis is<br/>among items on the agenda, said: "Britain is out of the euro - I think we will<br/>stay out of the euro and certainly as long as I am doing this job there is no<br/>prospect of Britain even contemplating joining the euro."<br/>The Greek parliament has to pass fresh austerity measures next week before the<br/>country can gain vital bail-out funds to prevent it defaulting on its loan<br/>payments, due in mid-July.<br/>Mr Blair told BBC One's Politics Show, in an interview to be broadcast on<br/>Sunday, he had backed the idea of Britain joining the euro when he came to<br/>power - but Had accepted that the conditions had to be right.<br/>Code: <a>[Select]</a>C:\&gt;fc Text1.txt Text2.txt<br/>Comparing files Text1.txt and TEXT2.TXT<br/>***** Text1.txt<br/>The prime minister, in Brussels for an EU summit where Greece's debt crisis is<br/>among items on the agenda, said: "Britain is out of the euro - I think we will<br/>***** TEXT2.TXT<br/>The Prime minister, in Brussels for an EU summit where Greece's debt crisis is<br/>among items on the agenda, said: "Britain is out of the euro - I think we will<br/>*****<br/><br/><br/>C:\&gt;fc Text1.txt Text3.txt<br/>Comparing files Text1.txt and TEXT3.TXT<br/>***** Text1.txt<br/>country can gain vital bail-out funds to prevent it defaulting on its loan<br/>payments, due in mid-July.<br/>Mr Blair told BBC One's Politics Show, in an interview to be broadcast on<br/>***** TEXT3.TXT<br/>country can gain vital bail-out funds to prevent it defaulting on its loan<br/>payments, due in mid-july.<br/>Mr Blair told BBC One's Politics Show, in an interview to be broadcast on<br/>*****<br/><br/><br/>C:\&gt;fc Text1.txt Text4.txt<br/>Comparing files Text1.txt and TEXT4.TXT<br/>***** Text1.txt<br/>Sunday, he had backed the idea of Britain joining the euro when he came to<br/>power - but had accepted that the conditions had to be right.<br/>***** TEXT4.TXT<br/>Sunday, he had backed the idea of Britain joining the euro when he came to<br/>power - but Had accepted that the conditions had to be right.<br/>*****<br/><br/><br/><br/><br/>This is in the middle of the file. The two files differ: Nicole and <a href="https://interviewquestions.tuteehub.com/tag/nicol-2196019" style="font-weight:bold;" target="_blank" title="Click to know more about NICOL">NICOL</a> <br/><br/>Line 388 shows only the last 8 characters of the 136-char line above<br/>Line 390 shows the last 32 chars of the end of line 389 (I removed some spaces from its 160 chars for viewing) <br/><br/> 388: 70126 F<br/> 389: CN 00003336163300276801 SMITH, NICOLE 20110510 007076730 319.45 <br/> 390: F+000000000+000000000<br/><br/>So, it looks like lines are limited to 128 characters. The line above shows the tail end after the first 128. The line below shows the overflow beyond 128 chars of the line that differs. <br/><br/>Rings a bell. It's been some time since I've used this but I do look at DOS text files well exceeding 128 character line lengths. <br/><br/>Now I know what I'm looking at! Could not compute yesterday ; ) <br/><br/>Thanks.<br/><br/><br/></body></html>
8892.

Solve : Batch file set /p not working?

Answer» <html><body><p>If I make a batch and place set /p=whatever? inside an if statement, it doesn't work. However, if it is outside of the if statement, it does.<br/><br/>Works:<br/>Code: <a>[Select]</a>@echo off<br/>set /p thing=enter choice(y/n)?<br/><br/>Doesn't:<br/>Code: <a>[Select]</a>@echo off<br/>if exist C:\WINDOWS\blabal.exe (<br/> set /p thing=enter choice(y/n)?<br/>)<br/><br/>Can anyone help me make the set command work inside the if statement? I have tried setlocal expansion thing.<br/><br/>Thanks.Put a caret ^ before the <a href="https://interviewquestions.tuteehub.com/tag/brackets-768929" style="font-weight:bold;" target="_blank" title="Click to know more about BRACKETS">BRACKETS</a>. Your code <em>should</em> be:<br/>Quote</p><blockquote>@echo off<br/>if exist C:\WINDOWS\blabal.exe (<br/> set /p thing=enter choice<strong>^</strong>(y/n<strong>^</strong>)?<br/>)</blockquote>Quote from: Helpmeh on June 14, 2011, 03:33:31 PM<blockquote>Put a caret ^ before the brackets. Your code <em>should</em> be:<br/></blockquote><br/>As has been noted, ordinary brackets have a special meaning in batch scripts. I tend to use <a href="https://interviewquestions.tuteehub.com/tag/square-344042" style="font-weight:bold;" target="_blank" title="Click to know more about SQUARE">SQUARE</a> brackets e.g. <br/><br/>set /p answer="Do you want to dance [y/n]? " <br/><br/>and I like to use quotes to space the console cursor away from the end of the prompt string.<br/>Salmon, I noticed that you put quotes around it. I found that using the quotes eliminates the need for the ^ even if I use (y/n).<br/><br/>Thanks for the help.Quote from: Linux711 on June 14, 2011, 04:43:33 PM<blockquote>I noticed that you put quotes around it. I found that using the quotes eliminates the need for the ^ even if I use (y/n).<br/></blockquote><br/>Yes, I forgot to mention that. I do that with set /p user prompt messages because I like to not have the console blinking cursor straight after the end of the prompt. With quotes I can add a space. But quotes are useful in other ways too. You can get rid of a lot of special-character-in-string problems if you quote the string.<br/>Quotes aren't necessary to add the extra space, but like you said Salmon, it does eliminate special character issues.Quote from: Helpmeh on June 15, 2011, 05:40:02 PM<blockquote>Quotes aren't necessary to add the extra space</blockquote><br/>What other way is there of addding the extra space?<br/><br/><br/>Quote from: Salmon Trout on June 15, 2011, 11:53:49 PM<blockquote>What other way is there of addding the extra space?<br/></blockquote><br/>I know about using a non-printing space (Hex FF or Alt+255)<br/><br/>Just to summarize:<br/><br/>The OP found that a structure of this <a href="https://interviewquestions.tuteehub.com/tag/type-238192" style="font-weight:bold;" target="_blank" title="Click to know more about TYPE">TYPE</a> didn't do what he expected:<br/><br/>IF X=Y (<br/> set /p blabla=Answer yes or no (/y/n)<br/> )<br/><br/>The reason was that the round brackets around "y/n" break the parenthetical (bracketed) multiline IF structure.<br/><br/>The OP was offered a number of solutions:<br/><br/><ul><li>Escape the opening and closing brackets around y/n with carets</li><li>Use different (square) brackets </li><li>Quote the prompt string</li></ul><br/>Following this, the OP pronounced himself satisfied.<br/><br/>Quote from: Salmon Trout on June 15, 2011, 11:53:49 PM<blockquote>What other way is there of addding the extra space?<br/></blockquote><br/>Adding a space at the end...:facepalm:<br/><br/>Code: <a>[Select]</a>@echo off<br/>title BOTSAY<br/>echo Between:<br/>echo.^| ^|<br/>:loop<br/>set /p msg= <br/>echo %msg% &gt; SAY.txt<br/>goto loopThe space does exist in the original code, it just gets eliminated by the forum software.Quote from: Helpmeh on June 20, 2011, 04:25:36 PM<blockquote>Adding a space at the end...:facepalm:<br/><br/>Code: <a>[Select]</a>@echo off<br/>title BOTSAY<br/>echo Between:<br/>echo.^| ^|<br/>:loop<br/>set /p msg= <br/>echo %msg% &gt; SAY.txt<br/>goto loopThe space does exist in the original code, it just gets eliminated by the forum software.<br/></blockquote><br/>What are you talking about exactly? This has nothing to do with the point I was making.<br/><br/><br/><br/>Quote from: Salmon Trout on June 20, 2011, 11:59:55 PM<blockquote>What are you talking about exactly? This has nothing to do with the point I was making.<br/></blockquote>Quote from: Salmon Trout on June 15, 2011, 11:53:49 PM<blockquote>What other way is there of addding the extra space?<br/></blockquote>I answered the <a href="https://interviewquestions.tuteehub.com/tag/question-25051" style="font-weight:bold;" target="_blank" title="Click to know more about QUESTION">QUESTION</a>. Batch files themselves don't need the quotes, the forum software does, because it truncates trailing spaces.</body></html>
8893.

Solve : Actual MS-DOS?

Answer» <html><body><p>#1 Rule...<br/><br/>If you find yourself digging a hole it's best to put the <a href="https://interviewquestions.tuteehub.com/tag/shovel-1206528" style="font-weight:bold;" target="_blank" title="Click to know more about SHOVEL">SHOVEL</a> down...<br/><br/>No offense intende here but in this instance you're wrong...other than the semantics which can never be argued effectively...Quote from: Geek-9pm on June 06, 2011, 01:49:24 PM</p><blockquote>The OP did not make it clear why he wants "actual DOS". Perhaps some users night believe that the old DOS has primitive utilities that can better manage the hard drive. Not so. <br/></blockquote>Quite right, and I do agree with you here. I don't think I would ever say fdisk is easier to use- or understand- then <a href="https://interviewquestions.tuteehub.com/tag/something-25913" style="font-weight:bold;" target="_blank" title="Click to know more about SOMETHING">SOMETHING</a> like Disk Management or GParted, unless one has already had experience using it.<br/><br/>Quote<blockquote>These utilities wee written before significant changes were made in Hared Drive geometry and do not perform as the user might wish.</blockquote>"These utilities"; they only talk about fdisk, and there is no significant danger from running fdisk on a drive, since it will not rewrite the boot code of the MBR, only the partition table.<br/><br/>Quote<blockquote>The MAR is not just an area one the hard drive where some address are stored.</blockquote>I never said it was. It is one area of the hard drive, though. the first sector of the drive, to be exact. Exactly 512 bytes. The offsets of important data are in fact standardized. All MBR's will have the Partition table (4 16-byte entries) at offset 446 within the sector. This is never different, regardless of the operating system. All that changes is the bytes before that, which determine the actual code used to start the boot loader itself. NT's boot loader differed from Win9x/MSDOS because it needed to have rudimentary support for NTFS to be able to find the boot loader, additionally it needed to know to look for NTLDR. Windows Vista's MBR boot code differs from XP and earlier in that they changed the boot loader to bootmgr, which has far more capabilities than NTLDR. Either way, the only task of the boot code in the MBR is to start this boot loader. That's it. It doesn't determine or change the "layout" of data on the drive, excepting of course the partition table.<br/><br/><br/>Quote<blockquote>There are rules as ton what can be placed there.</blockquote>Yes. That's what I've been saying.<br/><br/>Quote<blockquote>The rules have changed.</blockquote>No they haven't. The code area of the MBR is still the first 446 bytes. the partition table is still 4 16 byte entries. the MBR signature that follows is still 2 bytes. What rules have changed with Vista? none- the only difference is that there is a different boot code to look for the new boot loader. Does the boot loader operate differently? Of course. But GRUB also operates differently from NTLDR and LILO operates different from BOOTMGR, but for some reason nobody is saying that a tool like GPARTED will cause the MBR to become "corrupted".<br/><br/>Quote<blockquote>The rules are not consistent</blockquote>Yes. they are really quite simple. Certain data is stored at specific offsets. 4 partitions per drive. the size of logical drives in the extended partition(which can be used to work past the "4-partition limit" are stored in EBR (Extended Boot Records) within the Extended partition. This has not changed with Vista.<br/><br/>Quote<blockquote>The full set of rules is not seen by a casual examination of the area.</blockquote>Yes, they are. the fact that the Vista and XP MBR's both conform to the given <em>standard</em> for MBR layout sort of confirms that there is a full set of rules and they are being used by both operating <a href="https://interviewquestions.tuteehub.com/tag/systems-239492" style="font-weight:bold;" target="_blank" title="Click to know more about SYSTEMS">SYSTEMS</a>.<br/><br/><br/>Quote<blockquote>The rules have been a moving target. </blockquote>They were never a moving target. In fact, the layout of the MBR has been entirely unchanged since MS-DOS 2.00 when the original Hard disk support was added. Probably earlier. No Operating System that runs on a PC has used a on-disk format that didn't have an MBR. This includes Vista x64 when the drives are partitioned using GPT, since those drives also have a valid MBR- GPT acts as an extension.<br/>Quote<blockquote>That is why the GUID is now the way to go.<br/></blockquote>GPT is the preferred choice over the longer course simply because it extends the limitations of MBR. with MBR, no one partition can exceed 2TB in size, and no one partition can have an offset larger then 2TB from the start of the disk. needless to say this causes problems when you have drives larger than 2TB, which are starting to become available on the consumer market. It also adds redundant partition tables to mitigate the issues with the MBR's partition table (which, to repeat, is always at offset 446 and is always 16*4 bytes in size), where there was only one copy and if it got corrupted for any reason the disk was pretty <a href="https://interviewquestions.tuteehub.com/tag/much-249971" style="font-weight:bold;" target="_blank" title="Click to know more about MUCH">MUCH</a> unsalvageable (without tools like MIRROR, of course). From the looks of things GPT merely brings to the lower level structures of the disk what file systems like NTFS, HPFS, Ext2/3/4 and so forth have been providing as file systems for years- that is, larger sized partitions, more partitions, and better resilience.I use Partition Manager 8 booted from a DOS floppy or a bootable USB drive. PM8 will see as much of the drive as your BIOS allows.<br/><br/>PM8 will do just about anything you need to do a hard drive - partitioning, format FAT, FAT32, NTFS (all versions) etc. You can hide partitions, pick which partion you want active etc. Version 4 or 5 will format HPFS if you need it.<br/><br/>If you have the Windows version you can create the 'rescue disks' if you have a 1.4 <a href="https://interviewquestions.tuteehub.com/tag/mb-546939" style="font-weight:bold;" target="_blank" title="Click to know more about MB">MB</a> floppy drive. I use these disks to boot to Calerdra DOS.</body></html>
8894.

Solve : Ping Command Crashing DOS?

Answer» <html><body><p>Quote from: H2O on July 11, 2011, 11:38:02 PM</p><blockquote>Also Linux, I tried to upload my pingpath and ping files but they weren't accepted by the site. Any ideas?<br/></blockquote><br/>Open in Notepad and copy and paste into a forum post. That's what most people do.<br/>I'm not exactly sure how to run it under 32-bit actually, and if Somebody knows then feel free to share. That time was for a picture but if I even just run the "ping" it closes. It even closes if I enter in "ping /?" which I find even more unnerving. Quote from: H2O on July 12, 2011, 05:58:50 PM<blockquote>I'm not exactly sure how to run it under 32-bit actually, and if Somebody knows then feel free to share. That time was for a picture but if I even just run the "ping" it closes. It even closes if I enter in "ping /?" which I find even more unnerving.<br/></blockquote><br/>your ping.exe file is corrupted. use sfc /scannow or a Repair install with the windows disc handy.<br/><br/>(32-bit command prompt is cmd.exe; 16-bit is command.com. Salmon Trout already answered that question in an earlier post.)<br/><br/>Also, what is a "pingpath" file?Thanks for clearing that up. I believe I will need to order a new disc as I haven't seen mine for over seven years <br/><br/>I really don't know what pingpath is exactly. I did a search for "ping" on my system32 folder to find and run it from system32 as you recommended. It brought up my ping command as expected but also pingpath as well, which I thought seemed important. When I opened it, the same thing happens as when I ran ping- command box, randomness, <a href="https://interviewquestions.tuteehub.com/tag/terminate-659753" style="font-weight:bold;" target="_blank" title="Click to know more about TERMINATE">TERMINATE</a>. I'm thinking it's some outdated type of file associated with ping that might have become obsolete in newer models. If nobody else has it though I'll be a little suspicious.Quote from: BC_Programmer on July 12, 2011, 06:11:38 PM<blockquote>your ping.exe file is corrupted. use sfc /scannow or a Repair install with the windows disc handy.<br/><br/>(32-bit command prompt is cmd.exe; 16-bit is command.com. Salmon Trout already answered that question in an earlier post.)<br/><br/>Also, what is a "pingpath" file?<br/></blockquote><br/>He means PathPing, I'm pretty sure, which is a network utility supplied in Windows NT and beyond that combines the functionality of ping with that of tracert, with additional information that neither of those tools provides. PathPing sends packets to each router on the way to a final destination over a period of time, and then computes results based on the packets returned from each hop. Since PathPing shows the degree of packet loss at any given router or link, you can pinpoint which routers or links might be causing network problems.<br/><br/><a href="https://technet.microsoft.com/en-gb/library/cc958876.aspx">http://technet.microsoft.com/en-gb/library/cc958876.aspx</a><br/><br/><a href="https://en.wikipedia.org/wiki/PathPing">http://en.wikipedia.org/wiki/PathPing</a><br/><br/>Example (My IP obfuscated):<br/><br/>Code: <a>[Select]</a>C:\Users\Salmon&gt;pingpath<br/>'pingpath' is not recognized as an internal or external command,<br/>operable program or <a href="https://interviewquestions.tuteehub.com/tag/batch-893737" style="font-weight:bold;" target="_blank" title="Click to know more about BATCH">BATCH</a> file.<br/><br/>C:\Users\Salmon&gt;pathping<br/><br/>Usage: pathping [-g host-list] [-h maximum_hops] [-i address] [-n]<br/> [-p period] [-q num_queries] [-w timeout]<br/> [-4] [-6] target_name<br/><br/>Options:<br/> -g host-list Loose <a href="https://interviewquestions.tuteehub.com/tag/source-244756" style="font-weight:bold;" target="_blank" title="Click to know more about SOURCE">SOURCE</a> route along host-list.<br/> -h maximum_hops Maximum number of hops to search for target.<br/> -i address Use the specified source address.<br/> -n Do not resolve addresses to hostnames.<br/> -p period Wait period milliseconds between pings.<br/> -q num_queries Number of queries per hop.<br/> -w timeout Wait timeout milliseconds for each reply.<br/> -4 Force using IPv4.<br/> -6 Force using IPv6.<br/><br/>C:\Users\Salmon&gt;pathping www.google.com<br/><br/>Tracing route to www.l.google.com [209.85.229.147]<br/>over a maximum of 30 hops:<br/> 0 Salmon-And-Tuna.cable.virginmedia.net [99.99.999.99]<br/> 1 10.15.176.1<br/> 2 aztw-geam-1a-ge134.network.virginmedia.net [80.1.242.49]<br/> 3 aztw-core-1a-ae0-0.network.virginmedia.net [80.1.241.9]<br/> 4 winn-bb-1a-as0-0.network.virginmedia.net [213.105.175.157]<br/> 5 manc-bb-1b-as7-0.network.virginmedia.net [212.43.163.189]<br/> 6 tele-ic-3-ae0-0.network.virginmedia.net [212.43.163.70]<br/> 7 158-14-250-212.static.virginmedia.com [212.250.14.158]<br/> 8 209.85.255.175<br/> 9 209.85.253.94<br/>10 72.14.232.134<br/>11 209.85.252.83<br/>12 209.85.243.85<br/>13 ww-in-f147.1e100.net [209.85.229.147]<br/><br/>Computing statistics for 325 seconds...<br/> Source to Here This Node/Link<br/>Hop <a href="https://interviewquestions.tuteehub.com/tag/rtt-615567" style="font-weight:bold;" target="_blank" title="Click to know more about RTT">RTT</a> Lost/Sent = Pct Lost/Sent = Pct Address<br/> 0 Salmon-And-Tuna.cable.virginmedia.net [82.33.185.47]<br/> 0/ 100 = 0% |<br/> 1 --- 100/ 100 =100% 100/ 100 =100% 10.15.176.1<br/> 0/ 100 = 0% |<br/> 2 17ms 0/ 100 = 0% 0/ 100 = 0% aztw-geam-1a-ge134.network.virginmedia.net [80.1.242.49]<br/> 0/ 100 = 0% |<br/> 3 15ms 0/ 100 = 0% 0/ 100 = 0% aztw-core-1a-ae0-0.network.virginmedia.net [80.1.241.9]<br/> 0/ 100 = 0% |<br/> 4 19ms 0/ 100 = 0% 0/ 100 = 0% winn-bb-1a-as0-0.network.virginmedia.net [213.105.175.157]<br/> 0/ 100 = 0% |<br/> 5 25ms 0/ 100 = 0% 0/ 100 = 0% manc-bb-1b-as7-0.network.virginmedia.net [212.43.163.189]<br/> 0/ 100 = 0% |<br/> 6 31ms 0/ 100 = 0% 0/ 100 = 0% tele-ic-3-ae0-0.network.virginmedia.net [212.43.163.70]<br/> 0/ 100 = 0% |<br/> 7 29ms 0/ 100 = 0% 0/ 100 = 0% 158-14-250-212.static.virginmedia.com [212.250.14.158]<br/> 0/ 100 = 0% |<br/> 8 27ms 0/ 100 = 0% 0/ 100 = 0% 209.85.255.175<br/> 0/ 100 = 0% |<br/> 9 26ms 0/ 100 = 0% 0/ 100 = 0% 209.85.253.94<br/> 0/ 100 = 0% |<br/>10 32ms 0/ 100 = 0% 0/ 100 = 0% 72.14.232.134<br/> 0/ 100 = 0% |<br/>11 37ms 0/ 100 = 0% 0/ 100 = 0% 209.85.252.83<br/> 0/ 100 = 0% |<br/>12 37ms 0/ 100 = 0% 0/ 100 = 0% 209.85.243.85<br/> 0/ 100 = 0% |<br/>13 33ms 0/ 100 = 0% 0/ 100 = 0% ww-in-f147.1e100.net [209.85.229.147]<br/><br/>Trace complete.<br/><br/>C:\Users\Salmon&gt;<br/><br/><br/><br/>Thank you once again Salmon. I appreciate your zeal in this forum. I just tried the PathPing command out on my computer and I'm please that it works just fine. I visited the links and it appears that PathPing can do what Ping does, but better (although it takes a bit longer). Would it make a difference if I forgot about Ping and use PathPing instead?Quote from: H2O on July 13, 2011, 08:46:44 PM<blockquote>Thank you once again Salmon. I appreciate your zeal in this forum. I just tried the PathPing command out on my computer and I'm please that it works just fine. I visited the links and it appears that PathPing can do what Ping does, but better (although it takes a bit longer). Would it make a difference if I forgot about Ping and use PathPing instead?<br/></blockquote><br/>I suggest you try both and <a href="https://interviewquestions.tuteehub.com/tag/see-630247" style="font-weight:bold;" target="_blank" title="Click to know more about SEE">SEE</a> which one suits you best.<br/></body></html>
8895.

Solve : Why do we still use DOS today??

Answer» <html><body><p>why do we still need DOS today?I boot into pure DOS to run <a href="https://interviewquestions.tuteehub.com/tag/partition-238933" style="font-weight:bold;" target="_blank" title="Click to know more about PARTITION">PARTITION</a> Magic 8 to set up all my hard drives. I find I get <a href="https://interviewquestions.tuteehub.com/tag/better-895998" style="font-weight:bold;" target="_blank" title="Click to know more about BETTER">BETTER</a> control over the drive without Windows around.Quote from: ymaldonado on June 27, 2011, 06:05:32 PM</p><blockquote>why do we still need DOS today?<br/></blockquote>Who are "we" in this case.<br/>Many who use DOS will never come here hand tell you why.The just use it in their work and it never occurs to them that they should change it.<br/><br/>To illustrate the point, consider vehicles. Autos the travel on highways must meet safety rules. Rules can change. But vehicles that do service off of any highway do not have to comply with new highway rules.<br/><br/>Many business users continue to run their accounting software on a DOS based system. The use it the same way, <a href="https://interviewquestions.tuteehub.com/tag/day-244454" style="font-weight:bold;" target="_blank" title="Click to know more about DAY">DAY</a> after day. They make backups. They make print outs. They post invoices. The system is a part of their business operation. They <em>never</em> get on the internet. They<em> never </em>let anybody <a href="https://interviewquestions.tuteehub.com/tag/put-11868" style="font-weight:bold;" target="_blank" title="Click to know more about PUT">PUT</a> anything on the business computer.<br/><br/>There are some very powerful implication programs the still run on DOS based <a href="https://interviewquestions.tuteehub.com/tag/systems-239492" style="font-weight:bold;" target="_blank" title="Click to know more about SYSTEMS">SYSTEMS</a>. As long as the stay away from the public internet, they will continue to benefit from those old systems until the wear out.<br/><br/>And if they ever need replacement parts, they will pay extra just to get a 486 motherboard that fits the old case and runs they old software. No joke.<br/></body></html>
8896.

Solve : Trouble with Incrementing a Variable?

Answer» <html><body><p>I am attempting to <a href="https://interviewquestions.tuteehub.com/tag/write-746491" style="font-weight:bold;" target="_blank" title="Click to know more about WRITE">WRITE</a> a program that will ping a list of machines on our network and <a href="https://interviewquestions.tuteehub.com/tag/increment-244556" style="font-weight:bold;" target="_blank" title="Click to know more about INCREMENT">INCREMENT</a> a variable based on whether or not a reply is received. The program reads the IP's from a host file and should ping each machine X amount of times. Then the variables for successes and failures will be compared (this part isn't written yet) and run some commands. However, I can not seem to get the counterOK and counterFailed variables to increment. I have been working on this for two days and I think I just need another set of eyes to point me in the right direction. This is the what I have so far.<br/><br/><br/><br/>@<a href="https://interviewquestions.tuteehub.com/tag/echo-11626" style="font-weight:bold;" target="_blank" title="Click to know more about ECHO">ECHO</a> off<br/>title Network Monitor<br/>REM set variables for batch file<br/>set NrOfPings=3<br/>set counterOK=0<br/>set counterFailed=0<br/>set dPath=c:\users\%username%\desktop\monitor\<br/>set hostfile=%dPath%myhosts.txt<br/>set pingLog=%dPath%ping.txt<br/><br/>if EXIST del %pingLog%<br/><br/>REM echo %hostfile%<br/>REM echo %pingLog%<br/>REM echo %counterOK%<br/>REM echo %counterFailed%<br/>REM pause<br/><br/><br/>REM create a loop to go through the ip addresses in the host file<br/>for /f %%z in (%hostfile%) do ( <br/>set counterOK=0<br/>set counterFailed=0<br/> rem create a loop to ping each machine 10 times<br/>for /l %%i in (1, 1, %NrOfPings%) do (<br/>echo this is attempt %%i for IP %%z<br/><br/><br/>ping -n 1 %%z &gt; %pingLog%<br/>find "Reply from" %pingLog%<br/>IF ERRORLEVEL 0 set /a counterOK=%counterOK%+1<br/>IF NOT ERRORLEVEL 0 set /a counterFailed=%counterFailed%+1<br/>echo good:%counterOK% bad:%counterFailed%<br/>echo.<br/>PAUSE<br/>ECHO.<br/>)<br/>)<br/><br/>del %pingLog%<br/>pause<br/><br/>exit<br/><br/><br/><br/><br/><br/>Any help would be greatly appreciated.<br/>not sure how to count++ increment in batch either, so I will be keeping an eye on this thread for how. Its easy in other languages. Just never done it in batch to be able to show how.This is an oldie but goodie. I knew when I saw the thread title what the problem was. Everybody who reaches the level in batch scripting of using loops seems to wonder "Why don't my variables change value in a loop?" The answer is to do with the way that the command interpreter expands variables before running a script. Variables which are set (and read) inside a loop or other parenthetical structure such as a FOR loop or extended IF structure or a &amp;&amp; or || block will NOT change unless you use DELAYED EXPANSION. <br/><br/>1. Put this command before the loop. At the top of the batch file straight under the @echo off <a href="https://interviewquestions.tuteehub.com/tag/line-239358" style="font-weight:bold;" target="_blank" title="Click to know more about LINE">LINE</a> is as good as anywhere else.<br/><br/>setlocal enabledelayed expansion<br/><br/>2. The variables inside the loop don't have percent signs before and after - they use exclamation <a href="https://interviewquestions.tuteehub.com/tag/marks-238132" style="font-weight:bold;" target="_blank" title="Click to know more about MARKS">MARKS</a> instead.<br/><br/>3. There are a zillion web pages about it... take your pick...<br/><br/><a href="https://www.google.com/search?source=ig&amp;hl=en&amp;rlz=&amp;q=delayed+expansion&amp;aq=0&amp;aqi=g3g-v4g-m3&amp;aql=&amp;oq=delayed+expa">http://www.google.com/search?source=ig&amp;hl=en&amp;rlz=&amp;q=delayed+expansion&amp;aq=0&amp;aqi=g3g-v4g-m3&amp;aql=&amp;oq=delayed+expa</a><br/><br/><br/><br/><br/><br/>Code: <a>[Select]</a>setlocal enabledelayedexpansion<br/>REM create a loop to go through the ip addresses in the host file<br/>for /f %%z in (%hostfile%) do (<br/>set counterOK=0<br/>set counterFailed=0<br/>rem create a loop to ping each machine 10 times<br/> for /l %%i in (1, 1, %NrOfPings%) do (<br/> echo this is attempt %%i for IP %%z<br/> ping -n 1 %%z &gt; %pingLog%<br/> find "Reply from" %pingLog%<br/> IF !errorlevel! equ 0 (<br/> set /a counterOK+=1<br/> ) else (<br/> set /a counterFailed+=1<br/> ) <br/> echo good:!counterOK! bad:!counterFailed!<br/> echo.<br/> PAUSE<br/> ECHO.<br/> )<br/>)Humm. The batch command <br/><br/>setlocal enabledelayed expansion<br/><br/>is a Windows Batch command, not an MS-DOS batch comand. Won't work with MS-DOS 6.x or PC-DOS 7.<br/><br/><br/>I don't believe that MS-DOS has a counter batch command native to it.<br/><br/>Years ago in the 80's &amp; 90's I used an MS-DOS executable that I called from the batch file when I needed a counter. I can't recall the exact name but when I'm home next week I'll see if I can dig it out.Quote from: aoresteen on June 22, 2011, 03:10:59 PM</p><blockquote>Humm. The batch command <br/><br/>setlocal enabledelayed expansion<br/><br/>is a Windows Batch command, not an MS-DOS batch comand.</blockquote><br/>Yes, we know! Your point is?<br/><br/>It's not just Windows - the OP's code is clearly Windows NT family batch scripting language.<br/><br/>PC-DOS 7 has Rexx.<br/><br/><br/><br/><br/><br/>Better to pipe the output of Ping into FIND and look for the text "TTL", because "Reply from" in the output of PING does not always indicate a positive response. You may receive a message from a router such as: Reply from 192.168.1.254: Destination Net Unreachable. <br/><br/>Also no need for log.txt.<br/><br/>Code: <a>[Select]</a>setlocal enabledelayedexpansion<br/>REM create a loop to go through the ip addresses in the host file<br/>for /f %%z in (%hostfile%) do (<br/>set counterOK=0<br/>set counterFailed=0<br/>rem create a loop to ping each machine 10 times<br/> for /l %%i in (1, 1, %NrOfPings%) do (<br/> echo this is attempt %%i for IP %%z<br/> ping -n 1 %%z | find "TTL=" &gt; nul<br/> IF !errorlevel! equ 0 (<br/> set /a counterOK+=1<br/> ) else (<br/> set /a counterFailed+=1<br/> )<br/> echo good:!counterOK! bad:!counterFailed!<br/> echo.<br/> PAUSE<br/> ECHO.<br/> )<br/>)I made the changes suggested in the replies but the variables still refuse to increment. I should have mentioned this in the beginning but this batch file will be running in a Windows 7/Server 2008 environment. Here is what I have changed the code to<br/><br/><br/>@echo off<br/>setlocal enabledelayedexpansion<br/>title Network Monitor<br/><br/>REM set variables for batch file<br/>set NrOfPings=3<br/>set counterOK=0<br/>set counterFailed=0<br/>set dPath=c:\users\%username%\desktop\monitor\<br/>set hostfile=%dPath%myhosts.txt<br/><br/>REM create a loop to go through the ip addresses in the host file<br/>for /f %%z in (%hostfile%) do ( <br/>set counterOK=0<br/>set counterFailed=0<br/>rem create a loop to ping each machine 10 times<br/>for /l %%i in (1, 1, %NrOfPings%) do (<br/>echo this is attempt %%i for IP %%z<br/><br/><br/>ping -n 1 %%z | find "TTL" &gt; nul<br/>IF !ERRORLEVEL! equ 0 (<br/>set /a counterOK+=1<br/>) else (<br/>set /a counterFailed+=1<br/>)<br/>echo good:%counterOK% bad:%counterFailed%<br/>echo.<br/>PAUSE<br/>ECHO.<br/>)<br/>)<br/><br/>pause<br/><br/>exit<br/><br/>Code: <a>[Select]</a>echo good:%counterOK% bad:%counterFailed%<br/>I told you already you need to use exclamation marks, not percent signs, with delayed expansion in loops.<br/>sorry I missed that line. It works now! <br/><br/>Thanks!!Quote from: Salmon Trout on June 22, 2011, 03:43:43 PM<blockquote>Yes, we know! Your point is?<br/><br/>It's not just Windows - the OP's code is clearly Windows NT family batch scripting language.<br/><br/>PC-DOS 7 has Rexx.<br/></blockquote><br/>Sorry Salmon. I don't see where in the OP posting he says he's using Windows:<br/><br/>"..I am attempting to write a program that will ping a list of machines on our network and increment a variable based on whether or not a reply is received. The program reads the IP's from a host file and should ping each machine X amount of times. Then the variables for successes and failures will be compared (this part isn't written yet) and run some commands. However, I can not seem to get the counterOK and counterFailed variables to increment. I have been working on this for two days and I think I just need another set of eyes to point me in the right direction. This is the what I have so far."<br/><br/>I guess since I'm a DOS guy I didn't consider Windows batch code.<br/><br/>My main DOS is PC DOS 7 and I do use REXX on occasion but I never assume every DOS user has REXX available to them. Glad he's sorted it out.<br/><br/>Quote from: aoresteen on June 27, 2011, 08:42:27 PM<blockquote>Sorry Salmon. I don't see where in the OP posting he says he's using Windows:<br/></blockquote><br/>In his code the use of for /f and for /l (absent in MS-DOS and Win 9x) confirm that he is writing for cmd.exe, the NT family command interpreter. In his revised code, the second line, where he invokes delayed variable expansion, identifies the environment as a Windows 2000 or later version of cmd.exe. <br/><br/><br/><br/></body></html>
8897.

Solve : xml file rename problem?

Answer» <html><body><p>I have to rename a image file based on an xml file. Here is the xml.<br/><br/><br/><br/>sales<br/>abc company<br/>lexmark_Jun_23_2011_15_27_40_504.tif<br/><br/><br/>so the image file would be<br/>c:\scans\lexmark_Jun_23_2011_15_27_40_504.tif<br/><br/>The XML and image file are in the same folder.<br/>I want to end up with "sales_abc company.tif" and have the orginal tif and xml deleted<br/><br/>Can you help? I was going to <a href="https://interviewquestions.tuteehub.com/tag/go-468886" style="font-weight:bold;" target="_blank" title="Click to know more about GO">GO</a> to php but say another post where you did it with <a href="https://interviewquestions.tuteehub.com/tag/vb-242183" style="font-weight:bold;" target="_blank" title="Click to know more about VB">VB</a> so I thought I would ask.Code: <a>[Select]</a>@echo off<br/>set xmlfile=test.xml<br/>for /f "tokens=1-2 delims=^&lt;^&gt;" %%A in ( ' type %xmlfile% ^| find "imagefile" ' ) do set imagename=%%B<br/>ren "%imagename%" "sales_abc company.tif"<br/>del "%xmlfile%"<br/><br/>So Bill has graduated from just being a damned nuisance to poisoning threads with malicious "code". Please ignore the troll. His post contains an attempt at <a href="https://interviewquestions.tuteehub.com/tag/sabotage-629116" style="font-weight:bold;" target="_blank" title="Click to know more about SABOTAGE">SABOTAGE</a>. This line would obliterate the image file! <br/><br/>Code: <a>[Select]</a>echo hello &gt; %imagename%<br/>I sure hope the OP does not act upon any PM he may have received.<br/><br/><br/><br/>Posts removed.<br/>Sorry didn't catch it sooner Salmon...<br/><br/>patio.Quote from: patio on June 25, 2011, 12:54:58 PM</p><blockquote>Posts removed.<br/>Sorry didn't catch it sooner Salmon...<br/><br/>patio.<br/></blockquote><br/>Never mind... it enlivened the thread a bit... <br/>The script I posted above will correctly process the xml file posted by the OP to isolate the TIF filename. It then proceeds to rename the TIF, and delete the xml file, which, as the OP says... <br/><br/>Quote<blockquote>are in the same folder.</blockquote><br/>I have tested this with an actual TIF from my scanned images folder. It works. It would work with any arbitrarily named file. <br/><br/>Since a certain troll <a href="https://interviewquestions.tuteehub.com/tag/insists-1045939" style="font-weight:bold;" target="_blank" title="Click to know more about INSISTS">INSISTS</a> on polluting this thread, I am disabling notification of replies to avoid recurrent annoyance from this character.<br/><br/><br/><br/>This might be a <a href="https://interviewquestions.tuteehub.com/tag/bad-389290" style="font-weight:bold;" target="_blank" title="Click to know more about BAD">BAD</a> time to point out that I don't like your poetry.Quote from: BC_Programmer on June 27, 2011, 12:46:22 PM<blockquote>This might be a bad time to point out that I don't like your poetry.<br/></blockquote><br/>Did you mean me? Or the idiot?<br/>Quote from: Salmon Trout on June 27, 2011, 01:10:31 PM<blockquote>Did you mean me? Or the idiot?<br/></blockquote>The latter of course. You mean you haven't read my poetry?<br/><br/>I'll go out on a limb here and guess bill ain't real good at poetry...A good idea to lock this thread?<br/>done</body></html>
8898.

Solve : How to enlarge the window "code included"?

Answer» <html><body><br/>I have been messing around with the code bellow.<br/>How can you enlarge the <a href="https://interviewquestions.tuteehub.com/tag/window-11540" style="font-weight:bold;" target="_blank" title="Click to know more about WINDOW">WINDOW</a> wihout draging with the mouse.<br/><br/>I would like to set the size of the window within the code.<br/><br/>How do i do it.<br/><br/><br/><br/>@echo off<br/>@color 0a<br/>title Buddy Box<br/>:a<br/>cls<br/>echo =========================<br/>echo Windows 7 <a href="https://interviewquestions.tuteehub.com/tag/64bit-330960" style="font-weight:bold;" target="_blank" title="Click to know more about 64BIT">64BIT</a> BuddyBox<br/>echo =========================<br/>echo.<br/>echo 1) Mozilla Firefox<br/>echo 2) Internet Explorer<br/>echo 3) Windows Media Player<br/>echo 4) Notepad<br/>echo 5) Regedit<br/>echo 6) Calculator<br/>echo 7) Wordpad<br/>echo 8) Command Prompt<br/>echo 9) Charactor Map<br/>echo 10) On-Screen Keyboard<br/>echo 11) Disk Cleanup<br/>echo <a href="https://interviewquestions.tuteehub.com/tag/12-241884" style="font-weight:bold;" target="_blank" title="Click to know more about 12">12</a>) Command Prompt<br/>echo 13) Computer Management<br/>echo 14) Control Panel<br/>echo 15) Component Services<br/>echo 16) Disk Defragmenter<br/>echo 17) DirectX Diagnostic Tool<br/>echo 18) Privatee Character Editor<br/>echo 19) Event Viewer<br/>echo 20) Volume Mixer<br/>echo 21) Snipping Tool<br/>echo 22) Sound Recorder<br/>echo 23) Sticky Notes<br/>echo 24) Create Restore Point<br/>echo <a href="https://interviewquestions.tuteehub.com/tag/25-237028" style="font-weight:bold;" target="_blank" title="Click to know more about 25">25</a>) Windows Task Manager<br/>echo 26) User Account Control Settings<br/><br/><br/><br/><br/><br/><br/>echo.<br/>set /p op=Choose which application to open:<br/>if %op%==1 goto 1<br/>if %op%==2 goto 2<br/>if %op%==3 goto 310<br/><br/>if %op%==4 goto 4<br/>if %op%==5 goto 5<br/>if %op%==6 goto 6<br/>if %op%==7 goto 7<br/>if %op%==8 goto 8<br/>if %op%==9 goto 9<br/>if %op%==10 goto 10<br/>if %op%==11 goto 11<br/>if %op%==12 goto 12<br/>if %op%==13 goto 13<br/>if %op%==14 goto 14<br/>if %op%==15 goto 15<br/>if %op%==16 goto 16<br/>if %op%==17 goto 17<br/>if %op%==18 goto 18<br/>if %op%==19 goto 19<br/>if %op%==20 goto 20<br/>if %op%==21 goto 21<br/>if %op%==22 goto 22<br/>if %op%==23 goto 23<br/>if %op%==24 goto 24<br/>if %op%==25 goto 25<br/>if %op%==26 goto 26<br/><br/><br/><br/><br/>:1<br/>start firefox.exe<br/>goto a<br/>:2<br/>start iexplore.exe<br/>goto a<br/>:3<br/>start wmplayer.exe<br/>goto a<br/>:4<br/>start notepad.exe<br/>goto a<br/>:5<br/>start regedit.exe<br/>goto a<br/>:6<br/>start calc.exe<br/>goto a<br/>:7<br/>start Wordpad.exe<br/>goto a<br/>:8<br/>start cmd.exe<br/>goto a<br/>:9<br/>start charmap.exe<br/>goto a<br/>:10<br/>start osk.exe<br/>goto a<br/>:11<br/>start cleanmgr.exe<br/>goto a<br/>:12<br/>start cmd.exe<br/>goto a<br/>:13<br/>start CompMgmtLauncher.exe<br/>goto a<br/>:14<br/>start control.exe<br/>goto a<br/>:15<br/>start dcomcnfg.exe<br/>goto a<br/>:16<br/>start dfrgui.exe<br/>goto a<br/>:17<br/>start dxdiag.exe<br/>goto a<br/>:18<br/>start eudcedit.exe<br/>goto a<br/>:19<br/>start eventvwr.exe<br/>goto a<br/>:20<br/>start SndVol.exe<br/>goto a<br/>:21<br/>start SnippingTool.exe<br/>goto a<br/>:22<br/>start SoundRecorder.exe<br/>goto a<br/>:23<br/>start StikyNot.exe<br/>goto a<br/>:24<br/>start SystemPropertiesProtection.exe<br/>goto a<br/>:25<br/>start taskmgr.exe<br/>goto a<br/>:26<br/>start UserAccountControlSettings.exe<br/><br/>goto aUse the <strong>mode</strong> command after the <strong>@echo</strong> off statement:<br/><br/><strong>MODE CON[:] [COLS=c] [LINES=n]</strong><br/><br/>Good luck. <br/><br/>This is what i used.<br/><br/>MODE CON:cols=50 lines=32<br/><br/>Thank you<br/>Much appreciated<br/><br/>Ya know?..... I had never <a href="https://interviewquestions.tuteehub.com/tag/done-958312" style="font-weight:bold;" target="_blank" title="Click to know more about DONE">DONE</a> that before, but I just tried it and it works great, but.....<br/>I had to use much higher numbers, due to the resolution of my screen. 150 and 65 worked great for me.<br/><br/>Thanks for that helpful tip. This day has not been wasted! Now I'm going to the movies. <br/><br/>Nice tip.<br/><br/>thanx</body></html>
8899.

Solve : creating batch file to start up programs after one another, not at the same time?

Answer» <html><body><p>Sorry I tried searching the forum and goggling this, but can't seem to get anything to work.<br/><br/>I have a basic batch file to startup some programs and it works fine. But I am now trying to make it where one program starts after the one before it is finished.<br/><br/>I tried the /wait and timeout .<br/>timeout 10 works in Win7, but not on XP, haven't tried it on vista.<br/>/wait starts up the first program and won't start the <a href="https://interviewquestions.tuteehub.com/tag/rest-11386" style="font-weight:bold;" target="_blank" title="Click to know more about REST">REST</a> of the programs unless I close the one before it.<br/><br/>This is my basic batch file.<br/>Code: <a>[Select]</a>@echo off<br/><br/>start "" "C:\Program Files\GIMP-2.0\bin\gimp-2.6.exe"<br/>start "" "C:\Program Files\iTunes\iTunes.exe"<br/>start "" "C:\Program Files\Corel\Corel Paint Shop Pro Photo XI\Corel Paint Shop Pro Photo.exe"<br/>start "" "C:\Program Files\CoreFTP\coreftp.exe"<br/><br/>exit<br/><br/>Thank you for your assisstance.Not sure it's necessary to use <strong>start</strong> or <strong>wait</strong> or any sort of <strong>timeout</strong>. Try keeping it <a href="https://interviewquestions.tuteehub.com/tag/simple-1208262" style="font-weight:bold;" target="_blank" title="Click to know more about SIMPLE">SIMPLE</a>:<br/><br/>Code: <a>[Select]</a>@echo off<br/><br/>"C:\Program Files\GIMP-2.0\bin\gimp-2.6.exe"<br/>"C:\Program Files\iTunes\iTunes.exe"<br/>"C:\Program Files\Corel\Corel Paint Shop Pro Photo XI\Corel Paint Shop Pro Photo.exe"<br/>"C:\Program Files\CoreFTP\coreftp.exe"<br/><br/>exit<br/><br/>Good luck. Quote</p><blockquote>But I am now trying to make it where one program starts after the one before it is finished.</blockquote><br/>Quote<blockquote>/wait starts up the first program and won't start the rest of the programs unless I close the one before it.</blockquote><br/>According to the first quote above, this is what you want, isn't it?<br/><br/><br/>Quote from: Salmon Trout on July 08, 2011, 01:02:14 PM<blockquote>According to the first quote above, this is what you want, isn't it?<br/></blockquote><br/>no I want program 1 to startup ...<br/>then once it has finished loading, I want to keep that program open and then <br/>program 2 starts up, and so on.<br/><br/>I want all programs to be open, but in a sequence. is that possible?Use <br/><br/>start "" "program 1.exe"<br/>PING 127.0.0.1 -n X &gt;nul<br/>start "" "program 2.exe"<br/>PING 127.0.0.1 -n X &gt;nul<br/>start "" "program 3.exe"<br/>PING 127.0.0.1 -n X &gt;nul<br/><br/><em>[etc]</em><br/><br/>Replace X with a number, which is 1 more than the number of seconds delay you require, e.g. for 10 seconds delay replace X with <a href="https://interviewquestions.tuteehub.com/tag/11-243645" style="font-weight:bold;" target="_blank" title="Click to know more about 11">11</a>.<br/><br/><br/><br/><br/>Quote from: Salmon Trout on July 08, 2011, 01:25:43 PM<blockquote>Use <br/><br/>start "" "program 1.exe"<br/>PING 127.0.0.1 -n X &gt;nul<br/>start "" "program 2.exe"<br/>PING 127.0.0.1 -n X &gt;nul<br/>start "" "program 3.exe"<br/>PING 127.0.0.1 -n X &gt;nul<br/><br/><em>[etc]</em><br/><br/>Replace X with a number, which is 1 more than the number of seconds delay you require, e.g. for 10 seconds delay replace X with 11.<br/></blockquote><br/>-AH! Thank you very much!! That worked!<br/>What does all that mean if you don't mind explaining?<br/><br/>I wonder why I have to use PING for XP<br/>but Win7 reads it fine with timeout #?<br/><br/>very confusing for me :p<br/><br/>Much appreciated!Quote from: sehana on July 08, 2011, 01:30:46 PM<blockquote>What does all that mean if you don't mind explaining?</blockquote><br/>When you use start like this ("title" can just be 2 quotes "" but cannot be left out) <strong>start "title" "program.exe" </strong> then the script starts program.exe and then returns at once, leaving program.exe running. So now you want to wait for a period of time before starting the next program. Ping can provide that delay and works with all versions of Windows. 127.0.0.1 is the IP address of the same computer that the script is running on. Its name is localhost. The ping command can take a parameter -n followed by a number which is the number of times to ping. The standard ping interval is 1 second. So ping -n 11 sends the first request and it gets a reply immediately, waits one second, sends the next request, gets an immediate reply, and so on – for the ten requests after the first. So to localhost those 11 times takes exactly 10 seconds. We redirect the output to nul so we don't see the ping command or its output on the screen.<br/><br/>Quote<blockquote>I wonder why I have to use PING for XP but Win7 reads it fine with timeout #?</blockquote><br/>The reason why you cannot use timeout with XP is that the timeout.exe program was not included with XP. It was first introduced in Vista.<br/><br/>Thank You!!<br/>I understand it much better now <br/><br/>I was wondering what the ping was for and didn't understand it, but now I understand, thank you Quote from: sehana on July 08, 2011, 02:36:11 PM<blockquote>I was wondering what the ping was for and didn't understand it, but now I understand, thank you </blockquote><br/><a href="https://en.wikipedia.org/wiki/Ping">http://en.wikipedia.org/wiki/Ping</a><br/><br/>Reading the OP's request I'm wondering why nobody has given the answer yet. <br/><br/>I've been doing the same thing in batch files for somewhere around 30 years, or so.<br/><br/>This would be my <a href="https://interviewquestions.tuteehub.com/tag/solution-25781" style="font-weight:bold;" target="_blank" title="Click to know more about SOLUTION">SOLUTION</a>:<br/><br/><strong>@Echo off<br/>cls<br/>call program1<br/>call program2<br/>call program3<br/>Rem this batch file will close after program3 runs.</strong><br/><br/>The rule for the "Call" command is that it will maintain the entire batch file in memory till the last program being called closes.<br/>No line can execute till the previous line has completed.<br/><br/>Without the call command, the batch file would close when the first program runs and the subsequent programs would never run at all. <br/><br/>I do hope this helps.<br/><br/><br/>PS: Or more specifically......<br/><br/><strong>@Echo off<br/>cls<br/>Call "C:\Program Files\GIMP-2.0\bin\gimp-2.6.exe"<br/>Call "C:\Program Files\iTunes\iTunes.exe"<br/>Call "C:\Program Files\Corel\Corel Paint Shop Pro Photo XI\Corel Paint Shop Pro Photo.exe"<br/>Call "C:\Program Files\CoreFTP\coreftp.exe"<br/></strong>Quote from: TheShadow on July 09, 2011, 08:42:02 AM<blockquote>Reading the OP's request I'm wondering why nobody has given the answer yet. </blockquote><br/>You <a href="https://interviewquestions.tuteehub.com/tag/appear-2437800" style="font-weight:bold;" target="_blank" title="Click to know more about APPEAR">APPEAR</a> to be answering a question other than the one the OP asked. If you read the whole thread, you will see that he (or she) wishes to start a program, wait a short while, then start a second program, then wait a short while, then start a third program, and so on. He does not wish to run the programs in sequence, closing one before running the next.<br/><br/>Quote<blockquote>Without the call command, the batch file would close when the first program runs and the subsequent programs would never run at all. </blockquote><br/>This only applies to other batch files. You can start an executable program and depending on the syntax used for the start command, control will return to the batch script either at once or when the program has terminated.<br/><br/></body></html>
8900.

Solve : Rename multiple folders using Dos commands?

Answer» <html><body><p>Hi There,<br/><br/>I am a content uploader for mobile phones. I need to format various content provided by the vendors to ours standard format. so, plz help me to rename multiple FOLDERS at one time to our desired format. <br/><br/>Example:<br/><br/>From Format<br/>30x30png<br/>40x30bmp<br/>120x300_bmp<br/>BMP270x300<br/><br/>To Format<br/>png30x30<br/>bmp40x30<br/>bmp120x300<br/>bmp270x300<br/><br/>Thanks!Hello,<br/>The problem you have <a href="https://interviewquestions.tuteehub.com/tag/presented-2950178" style="font-weight:bold;" target="_blank" title="Click to know more about PRESENTED">PRESENTED</a> can easily be done in a batch file. However, there is some information that you have not given. What assurance is there that these file names are unique and will not encounter duplication when they are converted?<br/>Here's why I ask. Programming involves more than just finding some code that takes care of a specific issue. Programming also involves foresight as to conflicts. Some mechanism is needed to guarantee the file names be unique.<br/>This leads to the prospect of using a different method rather than just changing names in batch files. Without knowing more about what kind of system you're using, there should be some kind of library, database or index is able to keep track of files and a sign them a suitable alias reusing your system. Imperatively changing a file name can have serious consequences. The so-called DOS environment does not have a recursive tracking the history of a file, such as who the author was, what its original name was and other information like that. If you're doing <a href="https://interviewquestions.tuteehub.com/tag/anything-380254" style="font-weight:bold;" target="_blank" title="Click to know more about ANYTHING">ANYTHING</a> on a very large scale you should be using some kind of database or library system and not relying just on DOS.<br/>Okay. That is the end of my rant. I thought appropriate to say this because you indicate your going to be doing this over a large-scale and many other people would be affected by what you do. End of rant.<br/><br/>Somebody will come here and give you a neat clean solution to your problem using only DOS and no third-party programs.The folder names have no pattern, so writing a script would be problematic. <br/><br/>Folders 1 &amp; 2: move three trailing characters to be three leading characters<br/>Folder 3: same as two above folders and eliminate the underscore<br/>Folder 4: Replace three leading uppercase characters with lowercase characters<br/><br/>The logic for folder 1,2,3 can be combined into a single script block. Folder 4 <a href="https://interviewquestions.tuteehub.com/tag/presents-605084" style="font-weight:bold;" target="_blank" title="Click to know more about PRESENTS">PRESENTS</a> a problem. Not only will it require a separate script block, but there is no characteristic to key off of in order to determine when to activate that script block.<br/><br/>This little snippet will handle folders 1,2,3:<br/><br/>Code: <a>[<a href="https://interviewquestions.tuteehub.com/tag/select-630282" style="font-weight:bold;" target="_blank" title="Click to know more about SELECT">SELECT</a>]</a>@echo off<br/>setlocal enabledelayedexpansion<br/><br/>for /f "tokens=* delims=*" %%i in ('dir /b /ad') do (<br/> set dirname=%%i<br/> set dirname1=!dirname:_=!<br/> set prefix=!dirname1:~-3!<br/> set suffix=!dirname1:~0,-3!<br/> ren !dirname! !prefix!!suffix!<br/>) <br/><br/>Path information is your responsibility. As for folder #4, converting uppercase to lowercase can be done, but as mentioned there is nothing inherent in the folder name to distinguish it from the other three.<br/><br/>Good luck. <br/><br/>I would humbly suggest brute force:<br/><br/>Code: <a>[Select]</a>@echo off<br/>ren 30x30png png30x30<br/>ren 40x30bmp bmp40x30<br/>ren 120x300_bmp bmp120x300<br/>ren BMP270x300 bmp270x300<br/><br/>Hi Sidewinder/Geek-9pm,<br/><br/>I really appreciate your support for the scripts and about letting me know the scale of the problem.<br/><br/>Thanks!<br/>Sravan<br/>Hi, <br/><br/>Guys can we execute the script based on the idea..<br/><br/>(special character)(file type:png/bmp)(special character)[size](special character)(file type:png/bmp)(special character)<br/><br/>Special character= all wild characters like (.,_-$#@!%^&amp;*..etc)<br/>Size=100x100, 200x100 ..etc<br/>file type: png/bmp Lower case letters.<br/>I'm just not getting it. The original solution was specific to the sample folder names you posted. <br/><br/>What is this?<br/>Quote</p><blockquote>(special character)(file type:png/bmp)(special character)[size](special character)(file type:png/bmp)(special character)<br/></blockquote> <br/><br/>Depending on the language, special characters need to be <em>escaped</em>, or not, depending on their usage. You're creating unneeded problems.<br/><br/>Pattern matching and replacements can be accomplished by using regular expressions (RegEx). The RegEx engine in batch is next to useless, but VBScript, Powershell, Python, and Perl along with many UNIX utilities can handle most tasks. Is that a possibilty?<br/><br/>The easiest solution of course would be to tell your vendors what format to supply their content in.<br/><br/>Let use know. Hi,<br/><br/>Thanks for the advice..i won't be <a href="https://interviewquestions.tuteehub.com/tag/worrying-2336823" style="font-weight:bold;" target="_blank" title="Click to know more about WORRYING">WORRYING</a> any of us..will go with the brute force as you mentioned..its easy..and more over..i am new to programming and interested to write scripts..so i wish to try.. anyways will stay connected to learn.<br/><br/>Regards,<br/>Sravan Hello,<br/>I am also in the similar situation, trying to rename folders. I just need to get rid of "_den" suffix from folders' name. For e.g. <br/>I want to rename "Warde_den" to "Warde"; "Divide_NW_den" to "Divide_NW"; "Tripoli_NW_SE_den" to "Tripoli_NW_SE" etc...<br/><br/>Should be easy..but I am new to programming and need help.<br/><br/>Plz help..<br/><br/>Nav</body></html>