

InterviewSolution
Saved Bookmarks
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.
101. |
Solve : how to execute this command through batch file..???? |
Answer» <html><body><p>"setup.exe -sa -<a href="https://interviewquestions.tuteehub.com/tag/ver-1734849" style="font-weight:bold;" target="_blank" title="Click to know more about VER">VER</a> isolated -path "C:\tsdct\ETAS\ASCET-DIFF\V6_1_0_BETA2","C:\TSDE_Workarea\ETASData\ASCET-DIFF\V6_1_0_BETA2" -title "ASCET-DIFF V6.1.0_CS_Alpha_1_RC1" -reg 6_1_0BETA -isolated 6_1_0 -silent"<br/><br/>I would like to execute this command through 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>..<a href="https://interviewquestions.tuteehub.com/tag/please-601513" style="font-weight:bold;" target="_blank" title="Click to know more about PLEASE">PLEASE</a> help me as i am new to this..??<br/><br/>Any suggestions/help would be <a href="https://interviewquestions.tuteehub.com/tag/greatly-1012621" style="font-weight:bold;" target="_blank" title="Click to know more about GREATLY">GREATLY</a> appreciated..Thank you in advance.<br/>Guruprasad.If this is the <a href="https://interviewquestions.tuteehub.com/tag/working-243555" style="font-weight:bold;" target="_blank" title="Click to know more about WORKING">WORKING</a> command line, then literally copy the test into a file and save it with a .bat extension</p></body></html> | |
102. |
Solve : Do we have limitation on the length of the command line arguments..??? |
Answer» <html><body><p>Do we have limitation on the <a href="https://interviewquestions.tuteehub.com/tag/length-238824" style="font-weight:bold;" target="_blank" title="Click to know more about LENGTH">LENGTH</a> of the command line arguments..or what would be the maximum no of characters does a command line supports..??<br/><br/>Please help..??<br/><br/>A <a href="https://interviewquestions.tuteehub.com/tag/quick-1174961" style="font-weight:bold;" target="_blank" title="Click to know more about QUICK">QUICK</a> google came up with the following <a href="https://blogs.msdn.com/oldnewthing/archive/2003/12/10/56028.aspx">http://blogs.msdn.com/oldnewthing/archive/2003/12/10/56028.aspx</a><br/><br/>There is also <a href="https://interviewquestions.tuteehub.com/tag/another-876628" style="font-weight:bold;" target="_blank" title="Click to know more about ANOTHER">ANOTHER</a> limit your should be aware of -- you can only process 9 parameters .... use the <a href="https://interviewquestions.tuteehub.com/tag/shift-344014" style="font-weight:bold;" target="_blank" title="Click to know more about SHIFT">SHIFT</a> keyword to access param 10 onwards</p></body></html> | |
103. |
Solve : simple batch file needs little modding? |
Answer» <html><body><p>Hi there I need to create a batch file that will read a text document and create a file for each line of text I have one that almost works but the trouble is the lines of texts have spaces in them and it is creating a file for each section of text so if i have a line of text that reads 'I want only one file' it will create files called I, want, only, one and file the script I am using is<br/><br/>for /f %%i in (file.txt) do echo off> %%i <br/><br/>have tried <br/><br/>for /f %%i in (file.txt) do echo off> "%%i" <br/><br/>and <br/><br/>for /f "%%i" in (file.txt) do echo off> "%%i" <br/><br/>with no luck any help much apreciated.<br/>thanks, James.Try:<br/><br/>echo off<br/>for /f "delims=" %%i in (file.txt) do echo. > %%i<br/><br/>or if you're running it from the command prompt,<br/><br/>for /f "delims=" %i in (file.txt) do echo. > %i<br/><br/> Code: <a>[Select]</a>for /f "tokens=*" %%i in (file.txt) do echo %%i<br/><br/><br/>echoed the list of filenames I had in the file (including spaces).<br/><br/>I'm pretty <a href="https://interviewquestions.tuteehub.com/tag/sure-656539" style="font-weight:bold;" target="_blank" title="Click to know more about SURE">SURE</a> echo off will echo nothing to the file though. Quote from: Helpmeh on March 10, 2010, 04:14:15 PM</p><blockquote>Try:<br/><br/>echo off<br/>for /f "delims=" %%i in (file.txt) do echo. > %%i<br/><br/>or if you're running it from the command prompt,<br/><br/>for /f "delims=" %i in (file.txt) do echo. > %i<br/><br/><br/></blockquote> HEY! That was my 3000th post!!!<br/><br/>Anyway, BC, wouldn't "tokens=*" and "delims=" pretty much do the same thing?C:\batch><a href="https://interviewquestions.tuteehub.com/tag/type-238192" style="font-weight:bold;" target="_blank" title="Click to know more about TYPE">TYPE</a> wonker.bat<br/> Code: <a>[Select]</a>echo off<br/>setlocal enabledelayedexpansion<br/>for /f "delims=" %%i in (file.txt) do (<br/>echo %%i<br/>set newf=%%i<br/>echo Turn off > "!newf!.txt"<br/>dir "!newf!.txt"<br/>)<br/><strong>Output:</strong><br/><br/>C:\batch> wonker.bat<br/>wonker<br/> Volume in drive C has no label.<br/> Volume Serial Number is F4A3-D6B3<br/><br/> Directory of C:\batch<br/><br/>03/10/2010 05:28 PM 11 wonker.txt<br/> 1 File(s) 11 bytes<br/> 0 Dir(s) 298,567,569,408 bytes free<br/>hope<br/> Volume in drive C has no label.<br/> Volume Serial Number is F4A3-D6B3<br/><br/> Directory of C:\batch<br/><br/>03/10/2010 05:28 PM 11 hope.txt<br/> 1 File(s) 11 bytes<br/> 0 Dir(s) 298,567,569,408 bytes free<br/>works<br/> Volume in drive C has no label.<br/> Volume Serial Number is F4A3-D6B3<br/><br/> Directory of C:\batch<br/><br/>03/10/2010 05:28 PM 11 works.txt<br/> 1 File(s) 11 bytes<br/> 0 Dir(s) 298,567,569,408 bytes free<br/><br/>C:\batch><br/><br/><strong>Input:</strong><br/><br/><br/>C:\batch>type file.txt<br/>wonker<br/>hope<br/>works<br/>C:\batch>thanks to all who replied from all your suggestions I tried the easiest looking one first and with a little modding got it working perfect I ended up using <br/><br/>for /f "tokens=*" %%i in (file.txt) do echo off> %%i<br/><br/>not that its that important for me at the moment but I have in past wanted to do same thing but to <a href="https://interviewquestions.tuteehub.com/tag/make-249948" style="font-weight:bold;" target="_blank" title="Click to know more about MAKE">MAKE</a> folders instead of files but used to have same problem with it creating new folder for each word so thought Id <a href="https://interviewquestions.tuteehub.com/tag/see-630247" style="font-weight:bold;" target="_blank" title="Click to know more about SEE">SEE</a> if this would now work same for folders so I tried <br/><br/>for /f "tokens=*" %%i in (file.txt) do mkdir %%i<br/><br/>but this still made the folders for each word any ideas why that is?<br/><br/>Wrap it in quotes. Like this:<br/><br/>"%%i"brilliant had tried similar when trying to mod my original script for making files which <a href="https://interviewquestions.tuteehub.com/tag/didnt-2044153" style="font-weight:bold;" target="_blank" title="Click to know more about DIDNT">DIDNT</a> work so didnt try doing same again, but it worked on that one thanks so much for all your help this forum is great, get plenty of quick succesful responses. I'm just beginning with trying to learn some basics with making scripts and have got a few ideas of scripts I would like to create so no doubt you will here from me again within the next few days.<br/>thanks again, James.</body></html> | |
104. |
Solve : what is wrong with this? |
Answer» <html><body><p>what is wrong with this code<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/>for /f "delims=" %%a %%b %%c in (test.txt) do (<br/>set newf=%%a<br/>set newf2=%%b<br/>set newf3=%%c<br/>md "!newf!<br/>cd "!newf!<br/>echo "!newf3!" > "!newf2!.txt"<br/>cd..<br/>)<br/><br/>input<br/><br/>test1 test tset<br/>test2 teste etset<br/>test3 tester retset<br/><br/>output nothing<br/><br/>desired output<br/>3 folders called test 1-3<br/>in each folder file called test.txt teste.txt tester.txt<br/>in file tset.txt etset retsetA couple issues:<br/>1. If delims is set to "" (nul) then there will be no other tokens.<br/>2. Only 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> token name is said in the command.<br/><br/>This <a href="https://interviewquestions.tuteehub.com/tag/would-3285927" style="font-weight:bold;" target="_blank" title="Click to know more about WOULD">WOULD</a> be your code:<br/><br/>echo off<br/>setlocal enabledelayedexpansion<br/>for /f "delims= " %%a in (test.txt) do (<br/>md %%a<br/>cd %%a<br/>echo %%c > %%b.txt<br/>cd..<br/>)worked to a extent<br/>file name is %b.txt<br/>data is %cIt is.<br/><br/>%? on the command prompt is %%? in a batch file. (? being a single-letter wildcard)no the name of the file <a href="https://interviewquestions.tuteehub.com/tag/created-938398" style="font-weight:bold;" target="_blank" title="Click to know more about CREATED">CREATED</a> was %b etc.Oh, what a silly mistake. Here is the <em>proper</em> code.<br/><br/>echo off<br/>setlocal enabledelayedexpansion<br/>for /f "tokens=1-3 delims= " %%a in (test.txt) do (<br/>md %%a<br/>cd %%a<br/>echo %%c > %%b.txt<br/>cd..<br/>)<a href="https://interviewquestions.tuteehub.com/tag/thank-1731949" style="font-weight:bold;" target="_blank" title="Click to know more about THANK">THANK</a> youAny time!</p></body></html> | |
105. |
Solve : how to implement int 27h or the function 31h of int 21h?? |
Answer» <html><body><p>hello everyone,<br/> I wonder how to implement <a href="https://interviewquestions.tuteehub.com/tag/int-11513" style="font-weight:bold;" target="_blank" title="Click to know more about INT">INT</a> 27h or the function 31h of int 21h,or you can tell me how they work.if you have the source codes of the functions ,<a href="https://interviewquestions.tuteehub.com/tag/please-601513" style="font-weight:bold;" target="_blank" title="Click to know more about PLEASE">PLEASE</a> paste them or you can mail them to me.thank you.You mean the interrupt codes used in MS-DOS. <br/><a href="<klux>HTTP</klux>://spike.scu.edu.au/~barry/interrupts.html">http://spike.scu.edu.au/~barry/interrupts.html</a><br/>Are you writing in Assembly for a DOS? Which DOS?<br/>And are you wanting to use BIOS interrupts?<br/><a href="https://en.wikipedia.org/wiki/BIOS_interrupt_call">http://en.wikipedia.org/wiki/BIOS_interrupt_call</a><br/>The above link gives you the some information yhou need and refers to other placews for more information.<br/><br/> Quote</p><blockquote>INT 27h<br/>The recommended call instead of this <a href="https://interviewquestions.tuteehub.com/tag/one-241053" style="font-weight:bold;" target="_blank" title="Click to know more about ONE">ONE</a> is INT 21h function 31h,</blockquote> <br/><a href="http://www.delorie.com/djgpp/doc/dpmi/api/310c01.html">http://www.delorie.com/djgpp/doc/dpmi/api/310c01.html</a><br/><br/>Hope you know what your are doing.<br/>This is like going into a very high class restaurant and you don't see the prices. If you have to ask you can't afford it. Before you try and use these low level functions your should already have a full understanding of what they do. Otherwise you computer will crash and burn.it sounds a little crazy,but I will try.Thank you.Well, here are some samples written in C.<br/><a href="http://www.freshersworld.com/Directory/codes.asp?cat=C&subcat=Terminate%20but%20Stay%20Resident%<klux>20</klux>%28TSR%29">http://www.freshersworld.com/Directory/codes.asp?cat=C&subcat=Terminate%20but%20Stay%20Resident%20%28TSR%29</a></body></html> | |
106. |
Solve : Need to merge .xls files into one file? |
Answer» <html><body><p>Have <a href="https://interviewquestions.tuteehub.com/tag/multiple-1105557" style="font-weight:bold;" target="_blank" title="Click to know more about MULTIPLE">MULTIPLE</a> .xls files - need to merge into <a href="https://interviewquestions.tuteehub.com/tag/one-241053" style="font-weight:bold;" target="_blank" title="Click to know more about ONE">ONE</a> file for upload for processing.<br/>Would like to add <a href="https://interviewquestions.tuteehub.com/tag/code-25512" style="font-weight:bold;" target="_blank" title="Click to know more about CODE">CODE</a> to .bat file if possible.<br/><br/>Thanks Quote from: lswain on March 12, 2010, 09:55:05 AM</p><blockquote>Have multiple .xls files - need to merge into one file for upload for processing.<br/>Would like to add code to .bat file if possible.<br/></blockquote> <br/>The <a href="https://interviewquestions.tuteehub.com/tag/following-463335" style="font-weight:bold;" target="_blank" title="Click to know more about FOLLOWING">FOLLOWING</a> example is for .txt files:<br/><br/><br/> Code: <a>[Select]</a>echo off<br/><br/>dir /b a*.txt > all_a.txt<br/>echo <a href="https://interviewquestions.tuteehub.com/tag/hello-484176" style="font-weight:bold;" target="_blank" title="Click to know more about HELLO">HELLO</a> merge > merge.txt<br/><br/>for /f "delims=" %%i in (all_a.txt) do (<br/>echo %%i<br/>type "%%i" >> merge.txt<br/>)<br/>type merge.txt<br/> Quote from: greg on March 12, 2010, 06:53:37 PM<blockquote>The following example is for .txt files:<br/></blockquote> have you tried doing that way for .xls files? Quote from: ghostdog74 on March 12, 2010, 07:05:22 PM<blockquote>have you tried doing that way for .xls files?<br/></blockquote> <br/>I don't have any .xls files on my machine. <br/><br/>Will the the Ghostdog demostrate how to merge the .xlm files?<br/><br/>Thanks for you help Ghostdog.<br/><br/><a href="http://software.informer.com/getfree-view-xls-data-in-notepad/">http://software.informer.com/getfree-view-xls-data-in-notepad/</a><br/><br/><a href="http://www.monkeyjob.com/FileMonk/FAQ/Join-Merge-XLS-Files-Excel.htm">http://www.monkeyjob.com/FileMonk/FAQ/Join-Merge-XLS-Files-Excel.htm</a><br/> Quote from: greg on March 12, 2010, 11:06:20 PM<blockquote>I don't have any .xls files on my machine. <br/><br/>Will the the Ghostdog demostrate how to merge the .xlm files?<br/><br/>Thanks for you help Ghostdog.<br/><br/><a href="http://software.informer.com/getfree-view-xls-data-in-notepad/">http://software.informer.com/getfree-view-xls-data-in-notepad/</a><br/><br/></blockquote> <br/>xls/xlm(whatever it is) are binary files. you can't just concat the files like that. the best/correct way is to use the application( in this case, excel) to join them together, either by hand, or by use of vbscripting. Quote from: ghostdog74 on March 12, 2010, 11:20:58 PM<blockquote>xls/xlm(whatever it is) are binary files. you can't just concat the files like that. the best/correct way is to use the application( in this case, excel) to join them together, either by hand, or by use of vbscripting. <br/></blockquote> <br/>Please, give us an example.</body></html> | |
107. |
Solve : Dos command to get file from url? |
Answer» <html><body><p>I am a beginner.I want to know that can we use any dos command to download some file from a url <a href="https://interviewquestions.tuteehub.com/tag/like-537196" style="font-weight:bold;" target="_blank" title="Click to know more about LIKE">LIKE</a> htm ,jpg file and had a speed result ?If write a batch file ,how can i do that wget, curl.Code: <a>[Select]</a>C:\>wget http://iso.linuxquestions.org/download/290/2792/http/distro.ibiblio.org/tinycore_2.9.iso<br/>--2010-03-13 13:18:41-- http://iso.linuxquestions.org/download/290/2792/http/distro.ibiblio.org/tinycore_2.9.iso<br/>Resolving iso.linuxquestions.org... 75.126.162.205<br/>Connecting to iso.linuxquestions.org|75.126.162.205|:80... connected.<br/>HTTP request sent, awaiting response... 302 Found<br/>Location: http://distro.ibiblio.org/pub/linux/distributions/tinycorelinux/2.x/release/tinycore_2.9.iso [<a href="https://interviewquestions.tuteehub.com/tag/following-463335" style="font-weight:bold;" target="_blank" title="Click to know more about FOLLOWING">FOLLOWING</a>]<br/>--2010-03-13 13:18:41-- http://distro.ibiblio.org/pub/linux/distributions/tinycorelinux/2.x/release/tinycore_2.9.iso<br/>Resolving distro.ibiblio.org... 152.46.7.109<br/>Connecting to distro.ibiblio.org|152.46.7.109|:80... connected.<br/>HTTP request sent, awaiting response... 301 Moved Permanently<br/>Location: ftp://distro.ibiblio.org/pub/linux/distributions/tinycorelinux/2.x/release/tinycore_2.9.iso [following]<br/>--2010-03-13 13:18:41-- ftp://distro.ibiblio.org/pub/linux/distributions/tinycorelinux/2.x/release/tinycore_2.9.iso<br/> => `tinycore_2.9.iso'<br/>Connecting to distro.ibiblio.org|152.46.7.109|:21... connected.<br/>Logging in as anonymous ... Logged in!<br/>==> SYST ... done. ==> PWD ... done.<br/>==> TYPE I ... done. ==> CWD /pub/linux/distributions/tinycorelinux/2.x/release ... done.<br/>==> SIZE tinycore_2.9.iso ... 10604544<br/>==> PASV ... done. ==> RETR tinycore_2.9.iso ... done.<br/>Length: 10604544 (10M)<br/><br/>100%[============================================================================================================>] 10,604,544 176K/s in 70s<br/><br/>2010-03-13 13:19:54 (148 KB/s) - `tinycore_2.9.iso' saved [10604544]<br/>THX for ghostdog74 and Salmon Trout,your info is very helpful for me <a href="https://interviewquestions.tuteehub.com/tag/one-241053" style="font-weight:bold;" target="_blank" title="Click to know more about ONE">ONE</a> more question,if the pc can not <a href="https://interviewquestions.tuteehub.com/tag/able-361137" style="font-weight:bold;" target="_blank" title="Click to know more about ABLE">ABLE</a> or no right to <a href="https://interviewquestions.tuteehub.com/tag/install-2121155" style="font-weight:bold;" target="_blank" title="Click to know more about INSTALL">INSTALL</a> the tools.Is that possible any default dos command to dot that ?THX</p></body></html> | |
108. |
Solve : "Bad command or file name" during system restore? |
Answer» <html><body><p>I have an Emachine T2542 Desktop. I'm trying to do a complete restore using the Restore CD's that came with the computer. After inserting the disk, I reboot the computer and get the <a href="https://interviewquestions.tuteehub.com/tag/following-463335" style="font-weight:bold;" target="_blank" title="Click to know more about FOLLOWING">FOLLOWING</a>:<br/><br/>System Restore Menu/ WIndows XP<br/>1. Restore WIndows Xp<br/>2. Boot to command prompt from CD-ROM<br/><br/>Please select 1 or 2: [1,2]? 2<br/><br/>No matter which one I select, I get "Bad command or file name"<br/><br/>A:\> <<(What do I type here?)<br/><br/>Whenever I type something in the provided space, I get the same message. Please help.Do you have a floppyThe computer has a floppy drive, but I don't have a floppy disk to restore the computer.if you have a blank floppy than download this file run it and let the computer boot from the floppy run restore from there<br/><a href="http://www.allbootdisks.<klux>COM</klux>/downloads/Disks/Windows_98_Boot_Disk_Download49/Automatic%20Boot%20Disk/Windows98.exe">http://www.allbootdisks.com/downloads/Disks/Windows_98_Boot_Disk_Download49/Automatic%20Boot%20Disk/Windows98.exe</a> how are you supposed to run a Windows XP restore from a Windows 98 Boot disk?that error message sounds like a missing command interpreter Quote from: mat123 on March 08, 2010, 06:05:19 PM</p><blockquote>that error message sounds like a missing command interpreter<br/></blockquote> <br/>Well it's not. Windows NT doesn't <em>have</em> a command interpreter that is required for boot-up. <br/><br/> Quote from: tom97531 on March 07, 2010, 09:19:56 AM<blockquote>Whenever I type something in the provided space, I get the same message. Please help.<br/></blockquote> <br/>type "dir" and report what it says.After typing "dir" I get a very long list "country, bug, display, etc." followed by<br/><br/>27 files 1,422,108 bytes<br/>0 dirs 28,672 bytes free<br/><br/>Do I scrap mat123's idea about the floppy? Finally got a hold of one today but seems to be a bad disk. I can get more tomorrow.Try it again.<br/>Do NOT use the number pad.<br/>Use the numbers at the top of the keyboard.<br/><br/><br/>"Use the numbers at the top of the keyboard."<br/><br/><br/>Already tried that and just tried it again. Still get "Bad command or file name".I was guessing. <em>Bad guess.</em><br/>You said you can do the 'DIR' command, so the system is there and reads your keyboard OK. <br/>Is there an AUTOEXEC.BAT file present?'<br/>If so, Do this: (the purple letters.)<br/>A:>type autoexec.bat<br/>Also:<br/>A:>type config.sys<br/><br/><em>Maybe that will provide a clue.</em><br/> <br/>dir with the <a href="https://interviewquestions.tuteehub.com/tag/p-236832" style="font-weight:bold;" target="_blank" title="Click to know more about P">P</a> switch lets you use the spacebar to scroll thru all the info...<br/>Usage : dir /p Enter...<br/>Following "type autoexec.bat":<br/><br/>(Missing some info off top of screen), then<br/><br/>:Restore<br/><br/>echo off<br/>ghost -clone,mode=load,src=R:\T2542.gho,dst=1 -sure -ntil<br/><br/>cls<br/><br/>ECHO.<br/><br/>WINDOWS XP RESTORE COMPLETE<br/>THE HARD DISK CONTENTS HAVE BEEN <a href="https://interviewquestions.tuteehub.com/tag/restored-2990952" style="font-weight:bold;" target="_blank" title="Click to know more about RESTORED">RESTORED</a>.<br/><br/>** STORE THIS CD-ROM IN A <a href="https://interviewquestions.tuteehub.com/tag/safe-634049" style="font-weight:bold;" target="_blank" title="Click to know more about SAFE">SAFE</a> LOCATION! **<br/><br/>ECHO REMOVE THIS CD ROM FROM THE TRAY AND PRESS ANY KEY TO REBOOT THE SYSTEM..<br/><br/>a:\EJECTCD.exe r:<br/><br/>pause<br/>a:\Reboot.exe<br/><br/>goto exit<br/><br/>:exit<br/><br/>A:\><br/><br/>Pressing any key does nothing<br/><br/><br/>Following "type config.sys":<br/><br/>BUFFERS=20<br/>FILES=60<br/>DOS=HIGH,UMB<br/>stacks=9,256<br/>lastdrive=z<br/>shell=a:\command.com a:\ /p<br/>devicehigh=ansi.sys<br/>devicehigh=oakcdrom.sys /D:GEMCD001<br/>REM Uncomment4UK<br/>rem devicehigh=display.sys con=(ega,,1)<br/>rem country=044,850,country.sys<br/>A:\><br/><br/><br/>Following "dir /p":<br/><br/>ANSI SYS 9,719<br/>AUTOEXEC BAT 2,134<br/>CHKDSK EXE 27,968<br/>CHOICE COM 1,754<br/>COMMAND COM 93,040<br/>CONFIG SYS 242<br/>COUNTRY SYS 30,722<br/>DEBUG EXE 20,490<br/>DISPLAY SYS 13,207<br/>DOSKEY COM 15,495<br/>EDIT COM 69,854<br/>EGA CPI 58,870<br/>EJECTCD EXE 8,603<br/>EM_LOCK EXE 7,729<br/>FDISK EXE 66,060<br/>FORMAT COM 64,247<br/>GHOST EXE 644,976<br/>HIMEM SYS 4,768<br/>IO SYS 116,736<br/>KEYB COM 12,187<br/>KEYBOARD SYS 34,566<br/>MODE COM 29,239<br/>MSCDEX EXE 25,473<br/>MSDOS SYS 9<br/>OAKCDROM SYS 41,302<br/>REBOOT EXE 755<br/>SYS COM 21,943<br/><br/>27 FILES 1,422,108 BYTES<br/>0 DIRS 28,672 BYTES FREETry:<br/>A:/>TYPE AUTOEXEC.BAT|MORE<br/><br/>This will show contents of AUTOEXEC.BAT file in the MORE utility, press spacebar to advance a screen's information, and enter to advance a line. Quote from: Veltas on March 11, 2010, 03:53:49 AM<blockquote>Try:<br/>A:/>TYPE AUTOEXEC.BAT|MORE<br/></blockquote> <br/>Says:<br/><br/>Write protect error writing drive A</body></html> | |
109. |
Solve : Help me in my Batch Script? |
Answer» <html><body><p>I have a batch script which copies the targeted files from drives, for example if I want all .doc to be copied from C Drive it copies all, the <a href="https://interviewquestions.tuteehub.com/tag/thing-25656" style="font-weight:bold;" target="_blank" title="Click to know more about THING">THING</a> is I need it to copy 20, or <a href="https://interviewquestions.tuteehub.com/tag/10-236933" style="font-weight:bold;" target="_blank" title="Click to know more about 10">10</a> files not full .doc from C drive.<br/><br/>Can anyone help me in this please.<br/><br/>Here is the code for the script.<br/> Code: <a>[Select]</a>echo off<br/>SETLOCAL EnableDelayedExpansion<br/>set destfolder=D:\copiedjpegs<br/>set searchdrive="C:\"<br/>for /f "tokens=*" %%<a href="https://interviewquestions.tuteehub.com/tag/p-236832" style="font-weight:bold;" target="_blank" title="Click to know more about P">P</a> in ('dir %searchdrive%*.doc /s /b') do copy "%%P" %Desktop% Quote from: akki15623 on March <a href="https://interviewquestions.tuteehub.com/tag/12-241884" style="font-weight:bold;" target="_blank" title="Click to know more about 12">12</a>, 2010, 03:25:22 PM</p><blockquote>. . . for example if I want all .doc to be copied from C Drive it copies all, the thing is I need it to copy 20, or 10 files not full .doc from C drive.<br/></blockquote> <br/><br/>C:\batch>type akki.bat<br/> Code: <a>[Select]</a>echo off<br/>setLocal EnableDelayedExpansion<br/>set /a c=0<br/>set destfolder=<a href="https://interviewquestions.tuteehub.com/tag/e-236626" style="font-weight:bold;" target="_blank" title="Click to know more about E">E</a>:\copydoc\<br/><br/>for /f "delims==" %%i in ('dir c:\*.doc /s /b') do (<br/>echo %%~nxi<br/>set /a c+=1<br/><br/>echo c=!c!<br/>if !c! GTR 9 goto end<br/><br/>copy "%%i" %destfolder%<br/>)<br/>:end<br/><strong>Output:</strong><br/><br/>C:\batch>akki.bat<br/>longshot.doc<br/>c=1<br/> 1 file(s) copied.<br/>longshot.doc<br/>c=2<br/> 1 file(s) copied.<br/>ls.doc<br/>c=3<br/> 1 file(s) copied.<br/>winword.doc<br/>c=4<br/> 1 file(s) copied.<br/>winword2.doc<br/>c=5<br/> 1 file(s) copied.<br/>fractions.doc<br/>c=6<br/> 1 file(s) copied.<br/>third.doc<br/>c=7<br/> 1 file(s) copied.<br/>twothird.doc<br/>c=8<br/> 1 file(s) copied.<br/>What is My IP Address.doc<br/>c=9<br/> 1 file(s) copied.<br/>aarp081009.doc<br/>c=10<br/>C:\batch><br/><br/><br/>E:\copydoc>dir<br/> <br/> Directory of E:\copydoc<br/><br/>03/12/2010 06:18 PM .<br/>03/12/2010 06:18 PM ..<br/>10/23/2009 09:25 PM 20,480 fractions.doc<br/>03/06/2005 09:59 PM 4,195 longshot.doc<br/>03/06/2005 09:59 PM 4,195 ls.doc<br/>10/23/2009 08:44 PM 24,576 third.doc<br/>10/23/2009 08:45 PM 24,576 twothird.doc<br/>10/20/2009 11:27 AM 24,064 What is My IP Address.doc<br/>04/14/2008 06:00 AM 4,608 winword.doc<br/>04/14/2008 06:00 AM 1,769 winword2.doc<br/> 8 File(s) 108,463 bytes<br/> 2 Dir(s) 139,440,300,032 bytes free<br/><br/>E:\copydoc><br/> Quote from: greg on March 12, 2010, 05:24:21 PM<blockquote><br/>C:\batch>type akki.bat<br/> Code: <a>[Select]</a>echo off<br/>setLocal EnableDelayedExpansion<br/>set /a c=0<br/>set destfolder=E:\copydoc\<br/><br/>for /f "delims==" %%i in ('dir c:\*.doc /s /b') do (<br/>echo %%~nxi<br/>set /a c+=1<br/><br/>echo c=!c!<br/>if !c! GTR 9 goto end<br/><br/>copy "%%i" %destfolder%<br/>)<br/>:end</blockquote> <br/><br/>Thanks Greg, you saved my day.</body></html> | |
110. |
Solve : How to change Start type in services using batch file.? |
Answer» <html><body><p>Hi Everyone:<br/>I Know how to stop service using batch file,<br/><br/> Code: <a>[Select]</a>NET STOP "<a href="https://interviewquestions.tuteehub.com/tag/ipod-1035236" style="font-weight:bold;" target="_blank" title="Click to know more about IPOD">IPOD</a> Service"<br/>but I don't know yet how to change Start type from <strong>Automatic </strong> to <strong><a href="https://interviewquestions.tuteehub.com/tag/manual-247374" style="font-weight:bold;" target="_blank" title="Click to know more about MANUAL">MANUAL</a></strong> using batch.<br/>Could you give me advice, please?<br/><br/><br/>I am not aware of anyway to do this with batch code, but you can create a VBScript and have it run from the command prompt:<br/><br/> Code: <a>[Select]</a>strComputer = "."<br/>Set objWMIService = GetObject("winmgmts:" _<br/> & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")<br/><br/>Set colListOfServices = objWMIService.ExecQuery _<br/> ("Select * from Win32_Service Where Name = 'iPod Service'")<br/><br/>For Each objService in colListOfServices<br/> rc = objService.Change( , , , , "Manual") <br/>Next<br/><br/>Save the script with a <strong>VBS</strong> extension. Run from the command line as: <strong><a href="https://interviewquestions.tuteehub.com/tag/cscript" style="font-weight:bold;" target="_blank" title="Click to know more about CSCRIPT">CSCRIPT</a> <em>scriptname.vbs</em></strong><br/><br/>Good <a href="https://interviewquestions.tuteehub.com/tag/luck-1081575" style="font-weight:bold;" target="_blank" title="Click to know more about LUCK">LUCK</a>. Type sc /? at a command prompt<br/><br/>or<br/><br/>Check this link:<br/><a href="https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/sc.mspx?mfr=true">http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/sc.mspx?mfr=true</a><br/><br/></p></body></html> | |
111. |
Solve : BIOS/DPMS DOS and bootable disk not working ???? |
Answer» <html><body><p>Ok so today i downloaded LINUX, trying to install it on my pc. I burned it to a cd and ran it on my <a href="https://interviewquestions.tuteehub.com/tag/computer-243299" style="font-weight:bold;" target="_blank" title="Click to know more about COMPUTER">COMPUTER</a>, i thought it was <a href="https://interviewquestions.tuteehub.com/tag/working-243555" style="font-weight:bold;" target="_blank" title="Click to know more about WORKING">WORKING</a> but DPMS <a href="https://interviewquestions.tuteehub.com/tag/dos-432778" style="font-weight:bold;" target="_blank" title="Click to know more about DOS">DOS</a> popped up....<br/>My system will NOT run ANY <a href="https://interviewquestions.tuteehub.com/tag/bootable-7665304" style="font-weight:bold;" target="_blank" title="Click to know more about BOOTABLE">BOOTABLE</a> disks. Even manufactured. I checked my BIOS and made sure it was set for disk. i thought maybe it was my BIOS and thought of TRYING to <a href="https://interviewquestions.tuteehub.com/tag/reinstall-2983763" style="font-weight:bold;" target="_blank" title="Click to know more about REINSTALL">REINSTALL</a> it. Im running <br/><br/>Emachine, 2005<br/><br/>intel<br/><br/>t5026 model motherboard.<br/>Sorry i also forgot. WHen the dpms dos loads, it comes up as DR-A:\ |</p></body></html> | |
112. |
Solve : getting dos to read firewire device? |
Answer» <html><body><p>Hi I've not made any progress with this endeavor. I am trying to get dos to run firewire 1394b devices. Here are the codes I have tried so far and the error messages when they load at the startup.<br/><br/>DEVICEHIGH=C:\HIMEM.SYS /testmem:off<br/>DOS=HIGH,UMB<br/>DEVICEHIGH=C:\OAKCDROM.SYS /D:mscd001<br/><a href="https://interviewquestions.tuteehub.com/tag/device-11244" style="font-weight:bold;" target="_blank" title="Click to know more about DEVICE">DEVICE</a>=ASPIATAP.SYS /e/v<br/>{IOMEGA SCSI TO ATAPI INTERFACE MANAGER}<br/>"ADAPTER NOT PRESENT"<br/>DEVICE=ASPI1394.SYS /int/all<br/>{IOMEGA ASPI 1394 Firewire; V. 1.06}<br/>"Cannot find valid scsi adapter for ASPI driver"<br/>DEVICEHIGH=C:\EMM386.EXE /NOEMS<br/>DEVICEHIGH=C:\SMARTDRV.EXE /DOUBLE_BUFFER<br/>FILES=30<br/>STACKS=0,0<br/>BUFFERS=20<br/>LASTDRIVE=Z<br/><br/>THERE IS NO RECIPROCAL CODE IN AUTOEXEC.BAT. DOES ANYONE CARE TO TRY TO HELP OUT AND MAYBE PROVIDE SOME SOLID <a href="https://interviewquestions.tuteehub.com/tag/feedback-25484" style="font-weight:bold;" target="_blank" title="Click to know more about FEEDBACK">FEEDBACK</a> WITH THIS PROBLEM?<a href="http://www.techtalkz.com/drivers/6127-lookin-dos-driver-firewire-ieee-1394-a.html"><strong>See The 3rd Post Here...</strong></a>Ok, I went there and used those drivers and all I got was a black screen when I tried to run it. But it would be helpful to know why DOS complains with "Adapter not present" when I try to run the ASPIATAP.SYS file. Is it because I don't have the controller driver installed in DOS?Most likely...yes. Quote from: patio on March 01, 2010, 01:40:30 PM</p><blockquote><a href="http://www.techtalkz.com/drivers/6127-lookin-dos-driver-firewire-ieee-1394-a.html"><strong>See The 3rd Post Here...</strong></a><br/></blockquote> The drivers shown in the 6th Post are the only ones that work for me.<br/>Sometimes it doesn't find the drive the 1st time, so I just reboot and it will find it the 2nd time.I have temporarily suspended the firewire-dos project because of unresolved issues with those drivers. I am now trying to use dos-usb configurations. I got the Panasonic drivers USBASPI.SYS and DI1000DD.SYS in the configuration menu. It detects my usb flash drive device as EHCI, but how do I assign it a drive letter so I can get DOS to access it? I tried DI1000DD.SYS /dh but it just said 'invalid drive specification.' I want to be able to use DOS to copy my external IDE hard drive to the partition on my pc that dos doesn't reside in. When I am done, I want it to look like C:\DOS and D:\Win2K on the internal scsi drive. Of course it will have to be formatted with Fat32 as DOS won't read NTFS. I changed the bios reading from legacy floppy to FDD but it really didn't change anything. Help, cause I am stymied again.<br/><br/>Here is the configuration I am using presently.<br/><br/>Device=C:\Dos\usbaspi.sys e/ w/<br/>Devicehigh=C:\Dos\DI1000DD.SYS /df<br/><br/>Do I need a specific line in the autoexe.bat so it will provide a drive letter?<strong>config.sys</strong><br/><br/>[Menu]<br/>menuitem=1394, 1394 Firewire Mass Storage<br/>menuitem=usbaspi, ASPI USB Mass Storage<br/>menudefault=usbaspi, 30<br/><br/>[1394]<br/>devicehigh=\DOS\himem.sys<br/>devicehigh=\Drivers\aspi1394.sys /int /all<br/>devicehigh=\Drivers\di1000dd.sys<br/><br/>[usbaspi]<br/>devicehigh=\DOS\himem.sys<br/>devicehigh=\Drivers\usbaspi0.sys /norst /v /w<br/>devicehigh=\Drivers\di1000dd.sys<br/><br/>[common]<br/>dos=high,umb<br/>lastdrive=Z<br/>_______________________________________ ______________________________<br/><strong>autoexec.bat</strong> not necessary. "di1000dd.sys" provides the drive letter.<br/><br/>Well after some research, I made some useful discoveries. First, I was invited to include in a batch file various usb drivers. USBASPI0.SYS; USBASPI1.SYS; USBASPI2.SYS; USBASPI3.SYS; USBASPI4.SYS so DOS can cycle through each one and use the one it chooses. The second revalation comes in the knowledge that DOS will not open any drives that are larger than 2gig. Since my cloned hard drive is over 10gig, that option is dead. Maybe I'll just end up putting LinuxMint on the extended drive instead. Quote from: PunkA on March 06, 2010, 02:21:29 PM<blockquote>...DOS will not open any drives that are larger than 2gig....</blockquote> I don't know where you got that "fact", but it's not true. I have a 60GB USB drive and it works just fine with DOS 7 (Win98SE). I also have a USB/1394 120GB combo drive using the same DOS version.Alright, I've been wrong before. So I decided to scrap MSDOS6.22 and install 8.0 that I found on the web in winimage. I guess I am just stubborn. If anyone wants the link, just let me know. I didn't realize that your hard drive size should not be larger than 2gig to load it. DOS 6.22 is FAT16, DOS 7.1 is FAT32; that explains it.<br/>DOS 8 is from WinME, DOS7.1 is from Win95B, Win98, Win98SE<br/>I wouldn't use anything from WinME. WinME didn't use DOS.<br/><br/><a href="http://www.ntfs.com/ntfs_vs_fat.htm">http://www.ntfs.com/ntfs_vs_fat.htm</a><br/><a href="https://en.wikipedia.org/wiki/Comparison_of_x86_DOS_operating_systems">http://en.wikipedia.org/wiki/Comparison_of_x86_DOS_operating_systems</a>I suffer from the same affliction as Oscar Wilde. I can resist anything except temptation. I went copied the DOS 8.0 files to my C: drive. I would still like to be allowed to access my external hard drive with its fw interface. It gives me a choice of cd rom support at the start up. But no choice for a mouse pointer.<br/><br/>C:\Autoexec.bat<br/><br/>echo off<br/>path=C:\Windows;C:\windows\command<br/>\hibinv.exe<br/>call \checksr.bat<br/>IF "%config%"=="QUICK" Go To Quick<br/>set EXPAND=Yes<br/>set DIRCMD=/O:N<br/>set Lg l Drv=27* 26 Z 25 Y 24 X 23 W 22 V 21 U 20 T 19 S 18 R 17 Q 16 P 15<br/>set Lg l Drv=%Lg l Drv % O 14 N 13 M 12 L 11 K 10 J 9 I 8 H 7 G 6 F 5 E 4 D 3 C<br/>cls<br/>call setramd.bat %Lg l Drv%<br/>set temp=C:\<br/>set tmp=C:\<br/>path %RAMD%:\;a:\;%path%;%CDROM%:\<br/>copy command.com %RAMD%:\ >NUL<br/>set comspec=%RAMD%:\command.com<br/>copy extract.exe %RAMD%:\ >NUL<br/>copy readme.txt %RAMD%:\ >NUL<br/>:EXT<br/>%RAMD%:\extract /y /1 %RAMD%: ebd.cab >NUL<br/>echo The diagnostic tools were successfully loaded to drive %RAMD%.<br/>echo,<br/>IF "%config%"=="NOCD+ GOTO QUIT<br/>IF "%config%"=="Help" GOTO HELP<br/>LH %RAMD%"\::IF MSCDEX doesn't find a drive...<br/>IF ERRORLEVEL 1 SET CDPROB=1<br/>cls<br/>call help.bat<br/>::<br/>GOTO QUIT<br/>:QUIT<br/>call fixit.bat<br/>rem clean up environment variables<br/>set CDPROB=<br/>set CDROM=<br/>set Lg l Drv=<br/>GOTO QUICK<br/>:QUICK<br/><br/>C:\Config.sys<br/><br/>[Menu]<br/>menuitem=HELP, Help<br/>menuitem=CD, Start computer with CD support.<br/>menuitem=NOCD, Start computer without CD rom support.<br/>menuitem=QUICK, Minimal boot.<br/>menudefault=Help,30<br/>menucolor=7,0<br/>[HELP]<br/>device=Oakcdrom.sys /D:mscd001<br/>device=btdosm.sys<br/>device=flashpt.sys<br/>device=aspi2dos.sys<br/>device=aspi8dos.sys<br/>device=aspi4dos.sys<br/>device=aspi8u2.sys<br/>device=aspicd.sys \D:mscd001<br/>devicehigh=ramdrive.sys /E 2048<br/>[CD]<br/>device=oakcdrom.sys /D:mscd001<br/>device=btdosm.sys<br/>device=flashpt.sys<br/>device=btcdrom.sys<br/>device=aspi2dos.sys<br/>device=aspi4dos.sys<br/>device=aspi8dos.sys<br/>device=aspi8u2.sys<br/>device=aspicd.sys /D:mscd001<br/>devicehigh=ramdrive.sys /E 2048<br/>[NOCD]<br/>devicehigh=ramdrive.sys /E 2048<br/>[QUICK]<br/>[COMMON]<br/>files=10<br/>buffer=10<br/>dos=high,umb<br/>stacks=9,256<br/>lastdrive=z<br/>device=display.sys con=(ega ,,1)<br/>country=044,850, country.sys<br/>install=mode.com con cp prepare=((850)ega.cpi)<br/>install=mode.com con cp select=850<br/><br/>There was not a mouse driver included with the copied boot disk files to the C: drive so is it possible to import a driver to have mouse support? Also DOS 8.0 created a D:\ drive for diagnostic tools called D:\ MS-RAMDRIVE. These are the files it displays in D:<br/>ATTRIB.EXE<br/>CHKDSK.EXE<br/>COMMAND.COM<br/>DEBUG.EXE<br/>EDIT.COM<br/>EXT.EXE<br/>EXTRACT.EXE<br/>FORMAT.COM<br/>HELP.BAT<br/>MSCDEX.EXE<br/>README.TXT<br/>SCANDISK.EXE<br/>SCANDISK.INI<br/>SYS.COM<br/><br/><br/>And what about the matter of getting usb and firewire detection and assigning drive letters? Will aspi1394.sys, di1000dd.sys and usbaspi.sys, still do the trick here? At least now I have FAT32 interface going.<br/> Quote from: Computer_Commando on March 07, 2010, 03:43:11 PM<blockquote>WinME didn't use DOS.<br/></blockquote> <br/>Windows ME is still based on a DOS core exactly like windows 95, 98, and 98SE. MS just hid the option to boot into MS-DOS mode.<br/><br/>PunkA:<br/><br/>Um, and what exactly would you use mouse support <em>for</em>... you cannot use the mouse at the prompt, just within other programs.<br/><br/>I have no <a href="https://interviewquestions.tuteehub.com/tag/idea-770073" style="font-weight:bold;" target="_blank" title="Click to know more about IDEA">IDEA</a> with regards to mouse drivers; I always use mouse.com included with DOS, but since MS never <a href="https://interviewquestions.tuteehub.com/tag/actually-848884" style="font-weight:bold;" target="_blank" title="Click to know more about ACTUALLY">ACTUALLY</a> released any version of DOS beyond 6.22 and they are in fact hacked versions of the boot disks that are created by windows I don't know what would be included with them.Ok, so Mr. Billy Boy decided to X the bootable version. Does that mean a hack doesn't exit to override it so that it will boot from the hdd? I checked the format and somehow it was still formatted for FAT16. Don't know how that occurred but now I will use the system bios to change it to FAT32. Quote from: PunkA on March 09, 2010, 04:27:24 PM<blockquote>Ok, so Mr. Billy Boy decided to X the bootable version. Does that mean a hack doesn't exit to override it so that it will boot from the hdd? <br/></blockquote> it's not a "hack"... it's two commands-<br/><br/>boot to the floppy and use:<br/> Code: <a>[Select]</a>format C: /s<br/>sys C:<br/><br/>Additionally what I was saying had nothing to do with legal issues or anything like that, necessarily- I was just pointing out the fact that what you are using is a boot disk, and only includes the "bare necessity" external commands- no surprise that mouse.com is not considered a necessity. <br/><br/><br/><br/><br/> Quote from: PunkA on March 09, 2010, 04:27:24 PM<blockquote>Don't know how that occurred but now I will use the system bios to change it to FAT32. <br/></blockquote> <br/>no you won't.<br/><br/><br/><br/></body></html> | |
113. |
Solve : errorlevel->help for batch file? |
Answer» <html><body><p>I'm new to adding errorlevel logic into a <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 and looking for some help.<br/><br/>The script I have runs a few SQL <a href="https://interviewquestions.tuteehub.com/tag/commands-18925" style="font-weight:bold;" target="_blank" title="Click to know more about COMMANDS">COMMANDS</a> via OSQL and want to be notifyied if one step fails (for one reason or another) and echo out the issue into a file and email me.<br/><br/>echo on<br/>:Step 1<br/>: Call Backup_Database.bat to shutdown PS environment<br/>c:<br/>CD c:\scripts\HR83RPT<br/>ECHO Backing Database<br/>CALL Backup_Database.bat<br/>PAUSE<br/><br/>:Step 3<br/>:use osql to kill any active user sessions<br/>CD c:\scripts\HR83RPT<br/>osql -S ZVMPSESQL01 -U sa -P squamish -i c:\scripts\HR83RPT\uspkill.txt >> c:\scripts\HR83RPT\HR83RPT_refresh.txt<br/>echo User sessions have been terminated<br/>PAUSE<br/><br/>:Step 4<br/>:use isql <a href="https://interviewquestions.tuteehub.com/tag/command-11508" style="font-weight:bold;" target="_blank" title="Click to know more about COMMAND">COMMAND</a> to <a href="https://interviewquestions.tuteehub.com/tag/kick-528137" style="font-weight:bold;" target="_blank" title="Click to know more about KICK">KICK</a> off refresh executing refresh script<br/>CD c:\scripts\HR83RPT<br/>echo Refreshing Database<br/>isql -S ZVMPSESQL01 -U sa -P squamish -i c:\scripts\HR83RPT\HR83RPT.sql >> c:\scripts\HR83RPT\HR83RPT_refresh.txt<br/>echo Database Refreshed<br/><br/>echo %<a href="https://interviewquestions.tuteehub.com/tag/date-11316" style="font-weight:bold;" target="_blank" title="Click to know more about DATE">DATE</a>% %Time% >> c:\scripts\HR83RPT\HR83RPT_refresh.txt<br/>PAUSE<br/><br/>:Step 6<br/>:Send Refresh log<br/>CD c:\scripts\hr83rpt<br/>echo Sending Refresh log file<br/>CALL Refresh_Log.cmd<br/><br/>:error<br/><br/>Currently Refresh_Log.cmd above sends a list of all actions performed above and mails out to me.<br/><br/>Appreciate replies.</p></body></html> | |
114. |
Solve : Batch file needed? |
Answer» <html><body><p>Hi<br/><br/><br/> I am not familiar with batch commands. I need <a href="https://interviewquestions.tuteehub.com/tag/help-239643" style="font-weight:bold;" target="_blank" title="Click to know more about HELP">HELP</a> from you guys to create a batch file.<br/><br/>I am <a href="https://interviewquestions.tuteehub.com/tag/using-1441597" style="font-weight:bold;" target="_blank" title="Click to know more about USING">USING</a> some kind of tool that starts Building periodically every 5 mins if there are any new files or binaries placed in that folder.<br/>Now I need a batch file that recognises latest binaries and triggers the build.<br/>When the job is done, then it should inform the building tool that the binaries has been tested.<br/><br/>Thanks<br/>cnu<br/><br/><br/> Quote from: mukku on April 22, 2010, 03:48:17 AM</p><blockquote><br/>I am using some kind of tool that starts Building periodically every 5 mins if there are any new files or binaries placed in that folder.<br/><br/></blockquote> <br/>What building Tool? Post the batch file you have created.<br/><br/>The OS automatically tracks the file's name, size and creation date when a file is placed in a folder.<br/><br/>Use the dir command to display the information.<br/><br/><br/><a href="https://interviewquestions.tuteehub.com/tag/c-3540" style="font-weight:bold;" target="_blank" title="Click to know more about C">C</a>:\>dir<br/> Volume in drive C has no label.<br/> Volume Serial Number is 0652-E41D<br/><br/> Directory of C:\<br/><br/>04/16/2010 05:05 PM 1100<br/>06/10/2009 04:42 PM 24 autoexec.bat<br/>06/10/2009 04:42 PM 10 config.sys<br/>04/16/2010 08:59 PM LaserJet517<br/>04/17/2010 07:17 AM Office2003SP3Changes<br/>07/13/2009 09:37 PM PerfLogs<br/>04/24/2010 05:30 AM Program Files<br/>04/16/2010 04:19 PM Users<br/>04/23/2010 06:41 PM Windows<br/> 2 File(s) 34 bytes<br/> 7 Dir(s) 300,943,646,720 bytes free<br/><br/>C:\> Quote from: mukku on April 22, 2010, 03:48:17 AM<blockquote>Now I need a batch file that recognises latest binaries and triggers the build.<br/></blockquote> <br/><br/>C:\test>type buildlog.bat<br/> Code: <a>[Select]</a>echo off<br/><br/>if EXIST timefile*.txt del timefile*.txt<br/>dir > folderlog.txt<br/>rem for four times add dir info to log each time interval ( command line arg %1 )<br/>set /a c=0<br/>:timer<br/>if %c%==4 goto end<br/>set /a c=%c% + 1<br/>time /t > timefile%c%.txt<br/>sleep.exe %1<br/>time /t >> timefile%c%.txt<br/><br/>dir >> folderlog.txt<br/><br/>type folderlog.txt<br/>goto timer<br/>:end<br/><br/>C:\test>type timefile*.txt<br/><br/>timefile1.txt<br/><br/><br/>02:42 PM<br/>02:43 PM<br/><br/>timefile2.txt<br/><br/><br/>02:43 PM<br/>02:44 PM<br/><br/>timefile3.txt<br/><br/><br/>02:44 PM<br/>02:45 PM<br/><br/>timefile4.txt<br/><br/><br/>02:45 PM<br/>02:46 PM<br/><br/>C:\test><br/>Hi, Greg!<br/> Quote from: Salmon Trout on April 24, 2010, 02:09:04 PM<blockquote>Hi, Greg!<br/><br/></blockquote> Not again...so bill, what <a href="https://interviewquestions.tuteehub.com/tag/proxy-11644" style="font-weight:bold;" target="_blank" title="Click to know more about PROXY">PROXY</a> are you using, <a href="https://interviewquestions.tuteehub.com/tag/since-644476" style="font-weight:bold;" target="_blank" title="Click to know more about SINCE">SINCE</a> you can't use your ISP to get on?I voted... Quote from: patio on April 24, 2010, 03:16:34 PM<blockquote>I voted...<br/></blockquote> <br/>It's our duty!why is there a poll for this topic?I wanted to vote, but I had a problem. Two problems.<br/><em>There were not enough choices.<br/>The choices available were hard to discriminate</em>. Quote from: Geek-9pm on April 24, 2010, 07:05:06 PM<blockquote>The choices available were hard to discriminate[/i].<br/></blockquote> <br/>I'm not helping you find your glasses this time, Mr. Magoo.</body></html> | |
115. |
Solve : Storing current directory into a variable? |
Answer» <html><body><p>I'm <a href="https://interviewquestions.tuteehub.com/tag/working-243555" style="font-weight:bold;" target="_blank" title="Click to know more about WORKING">WORKING</a> on a concept script that requires me to save the current directory that the script is being run from in a varible to be used later:<br/><br/>Example<br/><br/>set variable = currdir<br/>...<br/>...(somewhere in here it will <a href="https://interviewquestions.tuteehub.com/tag/traverse-1426850" style="font-weight:bold;" target="_blank" title="Click to know more about TRAVERSE">TRAVERSE</a> to another directory)<br/>cp somefile %variable%/required_subdirectoryif you need the current directory then use the CD variable.<br/><br/> Code: <a>[Select]</a>set currentdir=%CD%<br/> grimbear, don't use spaces around the equals sign in batch.<br/>Grimbear<br/>You might like to check the 2 commands<br/>PUSHD<br/>POPD<br/><br/>PUSHD saves the current directory when you can go off an do other processing and POPD will then return you to where you started. Quote from: wbrost on April <a href="https://interviewquestions.tuteehub.com/tag/22-241942" style="font-weight:bold;" target="_blank" title="Click to know more about 22">22</a>, 2010, 08:20:56 AM</p><blockquote>if you need the current directory then use the CD variable.<br/><br/> Code: <a>[Select]</a>set currentdir=%CD%<br/> <br/></blockquote> Why do that when you can just use %CD%? Quote from: Helpmeh on April 23, 2010, 04:18:00 AM<blockquote>Why do that when you can just use %CD%?<br/></blockquote> <br/>because they want to use the current directory at the time they retrieve it later on when it <a href="https://interviewquestions.tuteehub.com/tag/may-557248" style="font-weight:bold;" target="_blank" title="Click to know more about MAY">MAY</a> no longer actually be the current directory?<br/><br/>gpl caught <a href="https://interviewquestions.tuteehub.com/tag/onto-586605" style="font-weight:bold;" target="_blank" title="Click to know more about ONTO">ONTO</a> the possible requirement the OP was after- pushd and popd.</body></html> | |
116. |
Solve : find and findstr help? |
Answer» <html><body><br/>"find" does partly what I want, and "findstr" does partly what I want. But neither one separately provides fully what I want to accomplish.<br/><br/>I want to count the occurrences of string1 in a text file output.txt, only if the string is at the beginning of the line. I do not want to see the lines scroll on the screen, only the number of occurrences.<br/><br/>Then I want to count the occurrences of string2 in the same file output.txt, again only at the beginning of the line and displaying only the count.<br/><br/>Then I want to compare the two counts, either with a visual check on the screen or with the comp command if I chose to send the results to two text <a href="https://interviewquestions.tuteehub.com/tag/files-20889" style="font-weight:bold;" target="_blank" title="Click to know more about FILES">FILES</a>. If the two counts are the same, I am okay; if not, echo an error message.<br/><br/>Is there a <a href="https://interviewquestions.tuteehub.com/tag/way-246442" style="font-weight:bold;" target="_blank" title="Click to know more about WAY">WAY</a> to pipe find and findstr together in one statement?<br/><br/>I can solve the problem with the following steps, but this seems like double work for each search:<br/><br/><br/>findstr/b "string1" output.txt > count1.txt<br/>findstr/b "string2" output.txt > count2.txt<br/>find/c "string1" count1.txt<br/>find/c "string2" count2.txt<br/><br/><br/>Thanks in advance. Code: <a>[Select]</a>echo off<br/><br/>echo cat dog horse>output.txt<br/>echo cat dog horse>>output.txt<br/>echo cat dog horse>>output.txt<br/>echo cat dog horse>>output.txt<br/>echo man girl boy>>output.txt<br/>echo man girl boy>>output.txt<br/>echo man girl boy>>output.txt<br/>echo man girl boy>>output.txt<br/>echo dog man cat>>output.txt<br/><br/>set string1=cat<br/>set string2=man<br/><br/>setlocal enabledelayedexpansion<br/>set count1=0<br/>set count2=0<br/>for /f "delims=" %%<a href="https://interviewquestions.tuteehub.com/tag/l-236827" style="font-weight:bold;" target="_blank" title="Click to know more about L">L</a> in (output.txt) do (<br/> echo %%L | findstr /b "%string1%">nul && set /a count1+=1<br/> echo %%L | findstr /b "%string2%">nul && set /a count2+=1<br/> )<br/><br/>if %count1% equ %count2% (<br/> echo Counts are equal<br/>) else (<br/> echo Counts are not equal<br/>)<br/><br/>echo Occurrences of %string1% at start of line = %count1%<br/>echo Occurrences of %string2% at start of line = %count2% <br/> Code: <a>[Select]</a>Counts are equal<br/>Occurrences of cat at start of line = 4<br/>Occurrences of man at start of line = 4Thanks a lot.download <a href="http://gnuwin32.sourceforge.net/packages/grep.htm">grep for windows</a> and then do this<br/><br/> Code: <a>[Select]</a>C:\test><a href="https://interviewquestions.tuteehub.com/tag/type-238192" style="font-weight:bold;" target="_blank" title="Click to know more about TYPE">TYPE</a> file<br/>cat dog horse<br/> cat dog horse<br/>cat dog horse<br/> cat dog horse<br/> man girl boy<br/> man girl boy<br/>man girl boy<br/>man girl boy<br/>dog man cat<br/><br/>if you want to display strings "cat" or "man" (data stolen from ST), <br/> Code: <a>[Select]</a>C:\test>grep -E "^[[:<a href="https://interviewquestions.tuteehub.com/tag/space-239477" style="font-weight:bold;" target="_blank" title="Click to know more about SPACE">SPACE</a>:]]*(cat|man)" file<br/>cat dog horse<br/> cat dog horse<br/>cat dog horse<br/> cat dog horse<br/> man girl boy<br/> man girl boy<br/>man girl boy<br/>man girl boy<br/><br/>to search "cat" or "man" at beginning and display count<br/> Code: <a>[Select]</a>C:\test>grep -Ec "^[[:space:]]*cat" file<br/>4<br/><br/>C:\test>grep -Ec "^[[:space:]]*man" file<br/>4<br/><br/>to get total count<br/> Code: <a>[Select]</a>C:\test>grep -Ec "^[[:space:]]*(cat|man)" file<br/>8<br/> Quote from: ghostdog74 on April 22, 2010, 05:34:24 PM<blockquote>download <a href="http://gnuwin32.sourceforge.net/packages/grep.htm">grep for windows</a> and then do this . . .<br/><br/> </blockquote> <br/>Or use wc -l.<br/><br/>C:\>type output.txt<br/>cat dog horse<br/>cat dog horse<br/>cat dog horse<br/>cat dog horse<br/>man girl boy<br/>man girl boy<br/>man girl boy<br/>man girl boy<br/>dog man cat<br/><br/>C:\>findstr "^cat" output.txt | E:\bin\wc -l<br/> 4<br/><br/>C:\>findstr "^man" output.txt | E:\bin\wc -l<br/> 4<br/><br/>C:\><br/></body></html> | |
117. |
Solve : Batch to rename multiple files...? |
Answer» <html><body><p>I have a number of folders named <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 yyyymmdd format, i.e., 20100419. <br/><br/>Inside each folder I have anywhere from 40 to 75 files and the individual file names are used in nearly every folder.<br/><br/>What I need is a batch file that will prepend the folder name (20100419) followed by a <a href="https://interviewquestions.tuteehub.com/tag/period-246409" style="font-weight:bold;" target="_blank" title="Click to know more about PERIOD">PERIOD</a> to the front of every file name in each folder.<br/><br/>Can anyone <a href="https://interviewquestions.tuteehub.com/tag/help-239643" style="font-weight:bold;" target="_blank" title="Click to know more about HELP">HELP</a>? Quote from: NyteOwl on April 19, 2010, 01:01:01 PM</p><blockquote>I have a number of folders named using a yyyymmdd format, i.e., 20100419. <br/><br/>What I need is a batch file that will prepend the folder name (20100419) followed by a period to the front of every file name in each folder.<br/></blockquote> <br/>dir /b > oldname.txt<br/><a href="https://interviewquestions.tuteehub.com/tag/c-3540" style="font-weight:bold;" target="_blank" title="Click to know more about C">C</a>:\20100419>type newname.bat<br/> Code: <a>[Select]</a>echo off<br/>set /p fold=%1<br/>for /f "delims=" %%i in (oldname.txt) do (<br/>copy %%i %fold%%%i )<br/>rem rename %%i %fold%%%i<br/>rem del %%i )<br/>C:\20100419>newname.bat 20100419<br/>20100419<br/> 1 file(s) copied.<br/> 1 file(s) copied.<br/> 1 file(s) copied.<br/> 1 file(s) copied.<br/> 1 file(s) copied.<br/><br/>C:\20100419>dir<br/> Volume in drive C has no label.<br/> Volume Serial Number is 0652-E41D<br/><br/> Directory of C:\20100419<br/><br/>04/24/2010 04:32 PM .<br/>04/24/2010 04:32 PM ..<br/>04/24/2010 04:06 PM 9 20100419file1.txt<br/>04/24/2010 04:06 PM 9 20100419file2.txt<br/>04/24/2010 04:06 PM 9 20100419file3.txt<br/>04/24/2010 04:06 PM 9 20100419file4.txt<br/>04/24/2010 04:07 PM 9 20100419file5.txt<br/>04/24/2010 04:06 PM 9 file1.txt<br/>04/24/2010 04:06 PM 9 file2.txt<br/>04/24/2010 04:06 PM 9 file3.txt<br/>04/24/2010 04:06 PM 9 file4.txt<br/>04/24/2010 04:07 PM 9 file5.txt<br/>04/24/2010 04:31 PM 139 newname.bat<br/>04/24/2010 04:29 PM 55 oldname.txt<br/> 12 File(s) 284 bytes<br/> 2 Dir(s) 300,677,402,624 bytes free<br/><br/>C:\20100419>1. Hi Greg!<br/>2. I think you need 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> the question again.<br/>Thanks for the responses, but I got the job done with an inexpensive app called Rename Maestro. <br/></body></html> | |
118. |
Solve : Question about error handling in bat or command files? |
Answer» <html><body><p>I have a <a href="https://interviewquestions.tuteehub.com/tag/problem-25530" style="font-weight:bold;" target="_blank" title="Click to know more about PROBLEM">PROBLEM</a> with 1 of the command file but I don’t know how to fix it yet.<br/>And here is the script that causes the problem<br/>Assume I have many .sql script files and I want to run in <a href="https://interviewquestions.tuteehub.com/tag/different-951434" style="font-weight:bold;" target="_blank" title="Click to know more about DIFFERENT">DIFFERENT</a> schema of some database.<br/>The next statement will dump the script to a file call MyScripts.cmd and will run it when the process on line2 is done.<br/>MyScript.cmd looks <a href="https://interviewquestions.tuteehub.com/tag/perfect-1150611" style="font-weight:bold;" target="_blank" title="Click to know more about PERFECT">PERFECT</a> but the process stopped after line2 and line3 and line4 were skipped.<br/>Could you tell me why it skipped line 3 and 4?<br/><br/>Line1: Echo : Before create MyScript.cmd file > MyLog.log<br/>Line2: for %%f in (*.sql) do DoA.cmd %%f<br/>Line3: Echo : Ready to run my script file > MyLog.log<br/>Line4: MyScript.cmd<br/> Quote from: jdang67 on April <a href="https://interviewquestions.tuteehub.com/tag/26-242610" style="font-weight:bold;" target="_blank" title="Click to know more about 26">26</a>, 2010, 09:16:12 AM</p><blockquote><br/>Could you tell me why it skipped line 3 and 4?<br/><br/></blockquote> <br/>if you want to come <a href="https://interviewquestions.tuteehub.com/tag/back-389278" style="font-weight:bold;" target="_blank" title="Click to know more about BACK">BACK</a> after DoA.cmd use CALL.<br/></body></html> | |
119. |
Solve : Command freeze?? |
Answer» <html><body><a href="https://interviewquestions.tuteehub.com/tag/hi-479908" style="font-weight:bold;" target="_blank" title="Click to know more about HI">HI</a> all, <br/>so windows 7 killed itself for the first time on my computer to the point where windows fails to start. After <a href="https://interviewquestions.tuteehub.com/tag/looking-1079184" style="font-weight:bold;" target="_blank" title="Click to know more about LOOKING">LOOKING</a> around in the recovery options I was <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 get a command prompt up and running so <br/>Hi all,<br/>windows 7 killed itself for the first time on my computer to the point where windows fails to start. After looking around in the recovery options I was able to get a command prompt up and running and began to copy my files to an external drive. <br/><br/>The problem I'm having is that the command prompt will copy all of the files till it gets to a big file (around 123mb) where it will the freeze. It'll show the file it had attempted to copy and viewing the drive the file will actually be there, but after that it does nothing and doesn't allow input. I really have no idea what would cause this. I've switched out external drives and nothing changed. <br/><br/>Here's the code: Xcopy documents h:\backup /s<br/><br/>any <a href="https://interviewquestions.tuteehub.com/tag/help-239643" style="font-weight:bold;" target="_blank" title="Click to know more about HELP">HELP</a> would be awesome!!<br/>Thanks!!!<br/><br/>--Chris<br/><br/>any help would be awesome!!<br/>Thanks!!!<br/>If your goal is trying to recover files, Why don't you do it an easier way. Boot the computer to another (<a href="https://interviewquestions.tuteehub.com/tag/good-1009017" style="font-weight:bold;" target="_blank" title="Click to know more about GOOD">GOOD</a>) operating system, and use the other OP to copy your data.<br/>One of the easiest is Barts PE.<br/><a href="http://www.nu2.nu/pebuilder/">http://www.nu2.nu/pebuilder/</a> Quote from: Orangedog22 on April 19, 2010, 12:40:03 PM<blockquote><br/>The problem I'm having is that the command prompt will copy all of the files till it gets to a big file (around 123mb) where it will the freeze.<br/></blockquote> <br/>Check your RAM.<br/><br/>Shutdown all startup programs not needed. ( start ,run [ msconfig ], click startup and disable all programs not needed. Buy more Ram?</body></html> | |
120. |
Solve : DOS login scripts for Windows XP? |
Answer» <html><body><p>What I'm trying to do is use a .bat file to add or remove a <a href="https://interviewquestions.tuteehub.com/tag/login-11607" style="font-weight:bold;" target="_blank" title="Click to know more about LOGIN">LOGIN</a> script to a local user account on <a href="https://interviewquestions.tuteehub.com/tag/windows-22662" style="font-weight:bold;" target="_blank" title="Click to know more about WINDOWS">WINDOWS</a> XP. I'm looking for <a href="https://interviewquestions.tuteehub.com/tag/something-25913" style="font-weight:bold;" target="_blank" title="Click to know more about SOMETHING">SOMETHING</a> I can use to display a system warning message when a specific user logs into the local computer without having to go to Local Security Settings > Security Options > Interactive login: Message <a href="https://interviewquestions.tuteehub.com/tag/text-11613" style="font-weight:bold;" target="_blank" title="Click to know more about TEXT">TEXT</a> for users attempting to login. This option will display the same message for all users. Is there a way 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 specific message as a .bat file and use another batch file to add and remove it from a local users account login script and not have it effect all users with the same message??</p></body></html> | |
121. |
Solve : Another thing.? |
Answer» <html><body><p>Well, I have another question (and it might be to hard for examples).<br/>But, in WoW, the characters speak certrain languages, but lets say that you <a href="https://interviewquestions.tuteehub.com/tag/hear-479705" style="font-weight:bold;" target="_blank" title="Click to know more about HEAR">HEAR</a> it, but then again, don't know it, how would that work? A parser of sorts (or thats what the dudes who rigged it up called it).<br/>And also, another question relating to the last one, how could I maybe say something to everyone around the character, instead of just to one person.This has exactly what to with Microsoft DOS?<br/>I meant with a chat program in batch, I know, I probably should have written that -_-.This thread could be part of a "How to ask a question that <a href="https://interviewquestions.tuteehub.com/tag/nobody-580017" style="font-weight:bold;" target="_blank" title="Click to know more about NOBODY">NOBODY</a> will bother to answer" guide.<br/> Quote from: tommyroyall on April 24, <a href="https://interviewquestions.tuteehub.com/tag/2010-290294" style="font-weight:bold;" target="_blank" title="Click to know more about 2010">2010</a>, 10:48:14 PM</p><blockquote>I meant with a chat program in batch, I know, I probably should have written that -_-.<br/></blockquote> I designed a chat program which works over the internet, although there are not many features, you can send messages to anyone. Try using FTP...it works (depending on the host) quite well (as well as a batch file can be, that is). Quote from: Helpmeh on April 25, 2010, 02:51:12 PM<blockquote>I designed a chat program which works over the internet, although there are not many features, you can send messages to anyone. Try using FTP...it works (depending on the host) quite well (as well as a batch file can be, that is).<br/></blockquote> <br/>So did I. (about 5/6 years ago) but mine used TCP/IP and worked <a href="https://interviewquestions.tuteehub.com/tag/like-537196" style="font-weight:bold;" target="_blank" title="Click to know more about LIKE">LIKE</a> an actual chat program by <a href="https://interviewquestions.tuteehub.com/tag/sending-1200600" style="font-weight:bold;" target="_blank" title="Click to know more about SENDING">SENDING</a> packets back and forth.<br/><br/>It only works on windows 9x and I'm too lazy to find out why. Or release it either. I don't even know if I still have it...</body></html> | |
122. |
Solve : my for command is not working? |
Answer» <html><body><p>could someone please tell why this does not work<br/><br/>echo off<br/>setlocal enabledelayedexpansion<br/>for /<a href="https://interviewquestions.tuteehub.com/tag/f-236701" style="font-weight:bold;" target="_blank" title="Click to know more about F">F</a> "tokens=1-3 delims=" %%a in (REG QUERY "hklm\software\microsoft\windows nt\currentversion" /v CurrentVersion) do (<br/>if !%%c==! goto:eof<br/>echo %%c >>ver.txt<br/>)<br/><br/>single quotes needed around command <a href="https://interviewquestions.tuteehub.com/tag/string-11290" style="font-weight:bold;" target="_blank" title="Click to know more about STRING">STRING</a><br/>What error message do you get?<br/>Can you explain what this does?<br/>Orr what you expect it to do?<br/> Code: <a>[Select]</a>if !%%c==! goto:eof<br/>Have you already tried it with <strong>echo on</strong> to see what is happening?Geek, did you see my post? Did you bother to read it?<br/> Quote from: Salmon Trout on April 24, 2010, 05:20:01 PM</p><blockquote>Geek, did you see my post? Did you bother to read it?<br/></blockquote> Sorry I was typing when you posted .<br/>Why does it need the single quote?<br/>What error message do you get?<br/> Code: <a>[Select]</a>the system cannot find the file regCan you explain what this does?<br/> Code: <a>[Select]</a>writes the version number to ver.txtOrr what you expect it to do?<br/> Code: <a>[Select]</a>create a txt file called ver.txt with the windows version numberCode:<br/>Have you already tried it with echo on to see what is happening?<br/>this<br/> Code: <a>[Select]</a>C:\Documents and Settings\admin-matthew\Desktop>setlocal enabledelayedexpansion<br/><br/><br/>C:\Documents and Settings\admin-matthew\Desktop>for /F "tokens=1-3 delims=" %a i<br/>n (REG QUERY "hklm\software\microsoft\windows nt\currentversion" /v CurrentVersi<br/>on) do (<br/>if !%c == ! goto A<br/> echo %c 1>ver.txt<br/>)<br/>The system cannot find the file REG.<br/><br/>C:\Documents and Settings\admin-matthew\Desktop>echo teste<br/>teste<br/><br/>C:\Documents and Settings\admin-matthew\Desktop>pause<br/>Press any key to continue . . .aahhhh!<br/>THIS IS WAY OVER MY HEAD!<br/> Code: <a>[Select]</a>Examples:<br/><br/> REG QUERY HKLM\Software\Microsoft\ResKit /v Version<br/> Displays the value of the registry value Version<br/><br/> REG QUERY HKLM\Software\Microsoft\ResKit\Nt\Setup /s<br/> Displays all subkeys and values under the registry key Setup<br/><br/>Microsoft Windows XP [Version 5.1.2600]<br/>(C) Copyright 1985-2001 Microsoft Corp.<br/><br/>C:\>REG QUERY HKLM\Software\Microsoft\ResKit\Nt\Setup /s<br/><br/>Error: The system was unable to find the specified registry key or val<br/><br/>C:\><br/> Code: <a>[Select]</a>echo off<br/>setlocal enabledelayedexpansion<br/>for /f "skip=4 tokens=1-3" %%a in ('REG QUERY "hklm\software\microsoft\windows nt\currentversion" /v currentversion') do (<br/> if !%%c==! goto:eof<br/> echo %%c >> ver.txt<br/>)<br/><br/><strong>A few notes:</strong> <br/><br/>The default delimiter is a space which is how the output is delimited. Overriding it with no delimiters defeats the purpose of the delims= parameter.<br/><br/>You need single quotes around a command in the <strong>for</strong> statement, and double quotes around parameters with embedded spaces (ie: windows nt).<br/><br/>Reg Query outputs lines which are not needed, easiest to skip over.<br/><br/>Good luck. Quote from: Geek-9pm on April 24, 2010, 06:21:36 PM<blockquote>aahhhh!<br/>THIS IS WAY OVER MY HEAD!<br/> Code: <a>[Select]</a>Examples:<br/><br/> REG QUERY HKLM\Software\Microsoft\ResKit /v Version<br/> Displays the value of the registry value Version<br/><br/> REG QUERY HKLM\Software\Microsoft\ResKit\Nt\Setup /s<br/> Displays all subkeys and values under the registry key Setup<br/><br/>Microsoft Windows XP [Version 5.1.2600]<br/>(C) Copyright 1985-2001 Microsoft Corp.<br/><br/>C:\>REG QUERY HKLM\Software\Microsoft\ResKit\Nt\Setup /s<br/><br/>Error: The system was unable to find the specified registry key or val<br/><br/>C:\><br/><br/></blockquote> That's not the issue. The issue is that in a FOR <a href="https://interviewquestions.tuteehub.com/tag/loop-345124" style="font-weight:bold;" target="_blank" title="Click to know more about LOOP">LOOP</a>, to get the output of a command, you <a href="https://interviewquestions.tuteehub.com/tag/wrap-1461765" style="font-weight:bold;" target="_blank" title="Click to know more about WRAP">WRAP</a> it in ', to use a string you use " and to get the output from a file you don't use any quotes.<br/><br/>An example of each:<br/> Code: <a>[Select]</a>rem Command<br/>for /f "tokens=3" %%c in ('findstr /c:price^: item.txt') do (<br/> commands<br/> commands<br/>)<br/> Code: <a>[Select]</a>rem String<br/>for /f "tokens=1,3-5" %%A in (this sentence is very long and will not have many parts displayed after) do echo %%A %%B %%C %%D<br/> Code: <a>[Select]</a>rem File<br/>rem The for loop will preform each task for as many lines are in the file, just like any<br/>rem other type of output.<br/>for /f "delims=," %%b in (filename.ext) do (<br/> echo %%b<br/>)thank you <a href="https://interviewquestions.tuteehub.com/tag/sidewinder-7737530" style="font-weight:bold;" target="_blank" title="Click to know more about SIDEWINDER">SIDEWINDER</a> Quote from: Sidewinder on April 24, 2010, 06:40:51 PM<blockquote> Code: <a>[Select]</a>echo off<br/>setlocal enabledelayedexpansion<br/>for /f "skip=4 tokens=1-3" %%a in ('REG QUERY "hklm\software\microsoft\windows nt\currentversion" /v currentversion') do (<br/> if !%%c==! goto:eof<br/> echo %%c >> ver.txt<br/>)<br/><br/></blockquote> <br/>I cannot get the above code to run correctly. I'm using windows 7.<br/><br/><br/>C:\test>type matt2.bat<br/>echo off<br/>setlocal enabledelayedexpansion<br/>for /f "skip=4 tokens=1-3" %%a in ('REG QUERY "hklm\software\microsoft\windows n<br/>t\currentversion" /v currentversion') do (<br/> if !%%c==! goto:eof<br/> echo %%c >> ver.txt<br/>)<br/><br/>C:\test>matt2.bat<br/><br/>C:\test>type ver.txt<br/><strong>The system cannot find the file specified.</strong><br/><br/>C:\test><br/><br/>What file cannot be found? I tested the code as given. <br/><br/>Please help.The original code is so amazingly, awfully, ridiculously, mind-boggingly wrong that I grow suspicious. It reads like code that was designed by somebody who thinks that keywords and commands are like Lego bricks that can be snapped together to produce something that works, without the snapper having to do any thinking or learning. Alternatively it reads like a piece of working batch code that somebody has deliberately edited to introduce as many glaring errors as possible. Who would do that? Somebody who starts threads as one person as then jumps in as another with an "answer". A pathetic individual like Greg/Marvin/Bill? <br/><br/><br/>echo off<br/>setlocal enabledelayedexpansion<br/>for /f "tokens=1-3 delims=" %%a in (REG QUERY "hklm\software\microsoft\windows nt\currentversion" /v CurrentVersion) do (<br/><br/> ^ ^<br/> nonsense; 3 tokens when commands here need single quotes<br/> the delims are the start and<br/> end of the line?<br/><br/>if !%%c==! goto:eof<br/> ^<br/> Mad IF test and strange mishmash of<br/> loop metavariable and delayed ordinary<br/> variable that does not even make sense<br/> and a crazy goto<br/><br/><br/>echo %%c >>ver.txt<br/> ^<br/>and APPEND the (never to appear) result to poor little ver.txt? <br/><br/>)<br/><br/><br/>I presume the idea is to extract the NT major and minor version numbers. Maybe running the REG command at the prompt would have been a good starting point? Anyhow, it's all nonsense anyhow, I reckon. (See above)<br/><br/><br/><br/>Salmon Trout I just can't make for loops.<br/><br/><br/>marvinengland the batch file takes a second to make the file<br/>also it is going to say 6.1 not 7 Code: <a>[Select]</a>echo off<br/>set commandstring='REG QUERY "hklm\software\microsoft\windows nt\currentversion" /v currentversion'<br/>for /f "skip=2 tokens=1-3" %%a in (%commandstring%) do set versionstring=%%c<br/>echo %versionstring%<br/>if "%versionstring%"=="6.1" echo Windows 7<br/> Quote from: mat123 on April 24, 2010, 04:44:20 PM<blockquote>Would someone please tell why this does not work.<br/></blockquote> <br/><br/>C:\test>type ver617.bat<br/> Code: <a>[Select]</a>echo off<br/>for /f "skip=1 tokens=1-4" %%i in ('ver') do (<br/>echo %%k %%l<br/>set ver61=%%i %%j %%k %%l<br/>)<br/>echo %ver61%<br/>if "%ver61%"=="Microsoft Windows [Version 6.1.7600]" echo Windows 7<br/><strong>OUTPUT:</strong><br/><br/>C:\test>ver617.bat<br/>[Version 6.1.7600]<br/>Microsoft Windows [Version 6.1.7600]<br/>Windows 7<br/>C:\test></body></html> | |
123. |
Solve : Program Rescue? |
Answer» <html><body><p>Program Rescue<br/>Hello!<br/>I am again compelled to address to you for the help. Unfortunately at Russian-speaking forums do not give attention to questions connected with MS DOS.<br/>I have a program rescue, necessary for creation and use saving diskettes. But it it is obvious not full.<br/>At its start, the program does not suggest to create saving a diskette as well as is written in its <a href="https://interviewquestions.tuteehub.com/tag/description-25691" style="font-weight:bold;" target="_blank" title="Click to know more about DESCRIPTION">DESCRIPTION</a>, and at once <a href="https://interviewquestions.tuteehub.com/tag/requests-1185613" style="font-weight:bold;" target="_blank" title="Click to know more about REQUESTS">REQUESTS</a> what area it is necessary to correct, and as the image for corrections is not present, the program does nothing.<br/>I long searched for a full variant of this program on the Internet, but anything could not find.<br/>Can be at somebody there is this program and can <a href="https://interviewquestions.tuteehub.com/tag/send-630341" style="font-weight:bold;" target="_blank" title="Click to know more about SEND">SEND</a> to me to the electronic address. I will be very grateful.<br/>Or somebody knows as to <a href="https://interviewquestions.tuteehub.com/tag/solve-647535" style="font-weight:bold;" target="_blank" title="Click to know more about SOLVE">SOLVE</a> such problem?<br/>Operational system MS DOS 6.22.<br/>It is possible for Windows 95.<br/>I ask to excuse me for weak knowledge of English language.Программа спасательной <br/>Hello! <br/>Я опять вынужден обратиться к Вам за помощью. К сожалению, на русский язык форумов не обратить внимание на вопросы, связанные с MS DOS. <br/>У меня есть программа спасения, необходимые для создания и использования экономии дискетах. Но это очевидно не полон. <br/>На старт, программа не предлагает создать экономии дискете, а так, как написано в описании, и сразу же просит какой области необходимо исправить, и в качестве изображения для корректировки нет, программа не делает ничего. <br/>Я долго искал полный вариант этой программы в Интернете, но ничего не могли найти. <br/>Может быть на кого-то есть эта программа, и можете прислать мне на электронный адрес. Я буду очень признателен. <br/>Или кто-то знает как решить такую проблему? <br/>Операционная система MS DOS 6.22. <br/>Вполне возможно, для Windows 95. <br/>Прошу извинить меня за слабого знания английского языка. <br/>Создать на русском языке и перевод на английский <br/><a href="https://translate.google.com/"><a href="https://interviewquestions.tuteehub.com/tag/http-11424" style="font-weight:bold;" target="_blank" title="Click to know more about HTTP">HTTP</a>://translate.google.com/</a></p></body></html> | |
124. |
Solve : MS DOS...? |
Answer» <html><body><p>MS Dos means Microsoft disk operating system. it was developed by microsoft IBM.It was standed operating system.DOS is still a 16-bit operating system.in markets a <a href="https://interviewquestions.tuteehub.com/tag/version-1444891" style="font-weight:bold;" target="_blank" title="Click to know more about VERSION">VERSION</a> of DOS <a href="https://interviewquestions.tuteehub.com/tag/called-907796" style="font-weight:bold;" target="_blank" title="Click to know more about CALLED">CALLED</a> DR-OpenDOS that extends MS-DOS in significant ways...<br/><br/>thanks.... Quote from: frankken2 on May 21, 2010, 12:51:34 AM</p><blockquote>MS Dos means Microsoft disk operating system. it was developed by microsoft IBM.It was standed operating system.DOS is still a 16-bit operating system.in markets a version of DOS called DR-OpenDOS that extends MS-DOS in significant ways...<br/><br/></blockquote> <br/>After MS DOS, Windows was invented and MS DOS is not used by most people.<br/><br/>There is a subset of the DOS commands available under the <a href="https://interviewquestions.tuteehub.com/tag/command-11508" style="font-weight:bold;" target="_blank" title="Click to know more about COMMAND">COMMAND</a> prompt (CMD) of windows.<br/>The old MS Dos is not used. And few people drive a Model-T ford.<br/><br/>Only nerds continue to use the old dos commands. Quote from: frankken2 on May 21, 2010, 12:51:34 AM<blockquote>MS Dos means Microsoft disk operating system. it was developed by microsoft IBM.It was standed operating system.DOS is still a 16-bit operating system.in markets a version of DOS called DR-OpenDOS that extends MS-DOS in significant ways...<br/><br/>thanks....<br/></blockquote> <br/>More news from frankken2... the sky is blue, and when it is not "night", contains a flaming orb called "the sun", and also (when it is "night") a gentler more silvery light called <em>luna</em>. Another interesting fact is that bears or <em>orsos</em> crap in the woods! The more discreet ones do their "business" behind a tree (or in front of it, depending on your point of view)<br/><br/> <br/><br/>Plus a load of crap (not from bears or woods however) from Marvin <a href="https://interviewquestions.tuteehub.com/tag/lunatic-545548" style="font-weight:bold;" target="_blank" title="Click to know more about LUNATIC">LUNATIC</a>. Is frankken2 Marvin?<br/> Quote from: frankken2 on May 21, 2010, 12:51:34 AM<blockquote>thanks....<br/></blockquote> Say What?<br/><br/> Windows wasn't "Invented" either. it was written.What was the point to this thread? If the OP had said something like how MS DOS was developed from QDOS (quick and dirty operating system) it might have added something than not everyone knows.<br/><br/>Otherwise, I agree with ST. Quote from: rthompson80819 on May 24, 2010, 04:57:37 PM<blockquote>What was the point to this thread?<br/></blockquote> <br/>Good question..I <a href="https://interviewquestions.tuteehub.com/tag/believe-395244" style="font-weight:bold;" target="_blank" title="Click to know more about BELIEVE">BELIEVE</a> frankken is asking for clarification of his statement...sounds like a homework question.<br/><br/>But to clarify:<br/><br/>MS-DOS(all the versions) were 16-Bit OSs.<br/>Windows X.X, 95, 98, ME were 16-Bit/32-Bit Hybrids(Still based upon MS-DOS)<br/>Windows NT, 2000, XP were pure 32-Bit OSs<br/>Windows XP(64 Bit), Vista, 7 are pure 64-Bit OSs.<br/>Frankken:<br/><br/>"Windows wasn't "Invented" either. it was written."<br/><br/>The point is it does not matter whether Windows was written, created or invented.<br/><br/>The point is Windows replaced DOS as an improved Operating System.</body></html> | |
125. |
Solve : Need Help reading a date? |
Answer» <html><body><p>Hi,<br/>I need to <a href="https://interviewquestions.tuteehub.com/tag/ftp-20066" style="font-weight:bold;" target="_blank" title="Click to know more about FTP">FTP</a> a file each day. The file comes from another program with today's date in the name. I can't change the name of the file so I need a way to have the name change each day in the batch file. <br/><br/>So lets say todays file is <br/><br/>06172010bob.txt<br/>The next day is<br/>06182010bob.txt<br/><br/>Any ideas on how to change the name in the script to add todays file name when FTP'n?<br/><br/>Thanks<br/><br/>This question, in one form or another has been asked and answered numerous times. If you are in a rush, you might save time by doing a forum search.<br/><br/>In the meantime we need to know the format of your system date. Please run<br/><strong>echo %date%</strong> from the <a href="https://interviewquestions.tuteehub.com/tag/command-11508" style="font-weight:bold;" target="_blank" title="Click to know more about COMMAND">COMMAND</a> prompt window and post the result along with your batch file. <br/><br/> Sorry if this has been covered. I think I over looked it.<br/><br/>My machine date is like this....<br/><br/>Fri 06/18/2010<br/><br/>The file I am FTP'n is named 20100618ABCD.txt<br/><br/>If the name was static I would be all set to send the files but with the change of the date each day I have to edit my batch to change the file name to the date.<br/><br/>Thanks for your help<br/>Your posts are contradictory. One shows the dates in the file names as mmddyyyy and the other shows the file names as yyyymmdd.<br/><br/>This snippet is for the mmddyyyy format:<br/> Code: <a>[Select]</a>echo off<br/>setlocal enabledelayedexpansion<br/>for /f "tokens=2" %%v in ("%date%") do (<br/> set today=%%v<br/> set today=!today:/=!<br/>) <br/><br/>echo %today%<br/><br/>This snippet is for the yyyymmdd format:<br/> Code: <a>[Select]</a>echo off<br/>for /f "tokens=1-4 delims=/ " %%i in ("%date%") do (<br/> set today=%%l%%j%%k<br/>)<br/><br/>echo %today% <br/><br/>Choose which snippet meets your needs. The <strong>today</strong> variable is set to the current date. You didn't post your batch file so I can't assist there but there may be problems with the FTP environment "<em>seeing</em>" the cmd shell environment variables.<br/><br/>Good luck. Thank you.<br/><br/>What I am using for the batch file is really 2 files. The first is a batch file and the 2nd is a text file.<br/><br/>Xfer.bat<br/>ftp -n -s:E:\ctftp\dataxfer.txt xxx.xxx.xxx.xxx<br/>PAUSE<br/><br/><br/><br/>dataxfer.txt<br/><br/>user <a href="https://interviewquestions.tuteehub.com/tag/username-238054" style="font-weight:bold;" target="_blank" title="Click to know more about USERNAME">USERNAME</a> password<br/>put E:\ctftp\20100618ABCD.txt<br/>rename 20100618ABCD.txt ack<br/>bye<br/><br/>I need to see the text of the transfer and found this does it for me. <br/><br/>Thanks again!<br/> Quote</p><blockquote>Choose which snippet meets your needs. The today variable is set to the current date. You didn't post your batch file so I can't assist there but there may be problems with the FTP environment "seeing" the cmd shell environment variables.<br/></blockquote> <br/>Can you give me a hand with this? I posted what I am using now but it sounds like you have a better way to do things.<br/><br/>Thanks<br/> Quote from: Spoiler on June 21, 2010, 12:06:25 PM<blockquote>Can you give me a hand with this? I posted what I am using now but it sounds like you have a better way to do things.<br/><br/>Thanks<br/><br/></blockquote> <br/>You give me way too much credit. If what you're are using works, then it's a success story. An alternative way would be to create the dataxfer.txt file on the fly.<br/><br/> Code: <a>[Select]</a>echo off<br/>for /f "tokens=1-4 delims=/ " %%i in ("%date%") do (<br/> set today=%%l%%j%%k<br/>)<br/><br/>> E:\ctftp\dataxfer.txt echo username password <br/>>> E:\ctftp\dataxfer.txt echo put E:\ctftp\%today%ABCD.txt <br/>>> E:\ctftp\dataxfer.txt echo ren E:\ctftp\%today%ABCD.txt ack <br/>>> E:\ctftp\dataxfer.txt echo bye <br/><br/>ftp -n -s:E:\ctftp\dataxfer.txt xxx.xxx.xxx.xxx<br/>del E:\ctftp\dataxfer.txt<br/>pause<br/><br/>I couldn't determine if the ABCD part of the file name was static or <a href="https://interviewquestions.tuteehub.com/tag/changed-913862" style="font-weight:bold;" target="_blank" title="Click to know more about CHANGED">CHANGED</a> from day to day. The snippet may need further tweaks.<br/><br/>Good luck. Howdy,<br/><br/>Thanks I will give it a try and see if it works out ok. The ABCD.TXT part of the file name stays the same. The only part of the file name that changes is the date. <br/><br/>Thanks again.<br/><br/> Quote<blockquote>> E:\ctftp\dataxfer.txt echo username password </blockquote> <br/>I had to make a small change so it read echo user username password<br/><br/>Things work great now. Thanks again for your help!<br/><br/></body></html> | |
126. |
Solve : Running shortcut with target? |
Answer» <html><body><p>I need to run a shortcut or program to load so I don't have to manually access it. The file I am using is a batch file to load all my start programs in the morning. I use /pause between each program to give each one time to load so I can easily show in what <a href="https://interviewquestions.tuteehub.com/tag/order-238912" style="font-weight:bold;" target="_blank" title="Click to know more about ORDER">ORDER</a> I open my programs if a issue arises. It helps to be consistent.<br/><br/>The only problem software I have is one that has something like this:<br/><br/>"C:\Program Files\program1.exe" /launch "Program 2"<br/><br/>How in the world can I get a batch file to load it? I would even be willing to make a short cut but the short cut gives that <a href="https://interviewquestions.tuteehub.com/tag/plus-591752" style="font-weight:bold;" target="_blank" title="Click to know more about PLUS">PLUS</a> a separate "start in" folder. <br/><br/>Thanks all! Quote from: armymil on June 24, 2010, 06:52:49 AM</p><blockquote><br/>"C:\Program Files\program1.exe" /launch "Program 2"<br/><br/></blockquote> <br/>I have not tested the following:<br/><br/>( Try a different placement to the quote symbols. )<br/><br/>1) "C:\Program Files\program1.exe /launch Program 2"<br/><br/>or<br/>2) Use Call instead of Start. You might call a Label and not another batch.<br/><br/>Good Luck<br/><br/>:label<br/>"C:\Program Files\program1.exe /launch Program 2"<br/>I tried them both. It didnt seem to work. <br/><br/>The program 1 is softgrid. The program 2 is software that <a href="https://interviewquestions.tuteehub.com/tag/loads-1076721" style="font-weight:bold;" target="_blank" title="Click to know more about LOADS">LOADS</a> from it. cd C:\Program Files\Microsoft Application Virtualization Client\<br/>call "sfttray.exe" "Program 2"<br/>pause<br/><br/><br/>This solved issue. The call feature <a href="https://interviewquestions.tuteehub.com/tag/helped-2697962" style="font-weight:bold;" target="_blank" title="Click to know more about HELPED">HELPED</a>.</body></html> | |
127. |
Solve : Batch help: search for file in profiles, then delete? |
Answer» <html><body><p>Hey there team...Newb to the forum...from my searching around it looks like a <a href="https://interviewquestions.tuteehub.com/tag/quite-1175131" style="font-weight:bold;" target="_blank" title="Click to know more about QUITE">QUITE</a> knowledgeable group...i've got 10+ yrs in the IT/IS field, but have never really had to script anything until now (except for back in college...i know i know...don't use it you lose it)<br/><br/>all PCs are XP Pro<br/><br/>i'm trying to get a batch going that will search for a *.mht file in every profile on the PC and delete it. when i build the PCs for everyone, they have a MHT file that all the agents use and so i always save it to the all users desktop folder. after a long run, they have recently updated the file and i need to replace it...so it needs to be deleted from the all users and actual user's profiles on the PCs...<br/><br/>i start off by having the batch create a txt file that has all the *.mht file locations and then i use the "for /f" command to delete the contents of the txt file, but it can't get anywhere because the file format of the txt file is C:\Documents and Settings\...and i can't get the txt file to create the path with " " around the path. the reason i want it gone from only the DocSettings folder is that some of the agents have requested to still have a copy of the old file...i've instructed them to save it to another folder on their hd...so i don't want to have a blanket delete<br/><br/>is there something that i'm missing? a simpler way to accomplish this? i used the same method when i created a batch for deleting all the $*unin*$ files w/no probs but it was never forced to deal with paths with spaces...this seems simple enough but for some reason i'm pulling a blank...<br/><br/> Code: <a>[Select]</a>echo off<br/>C:<br/>cd "\Documents and Settings"<br/>dir /b /s *.mht > oldAppGate.txt<br/>for /F %%i in (oldAppGate.txt) do <a href="https://interviewquestions.tuteehub.com/tag/del-947443" style="font-weight:bold;" target="_blank" title="Click to know more about DEL">DEL</a> /<a href="https://interviewquestions.tuteehub.com/tag/q-236607" style="font-weight:bold;" target="_blank" title="Click to know more about Q">Q</a> %%i<br/><br/>this is the content of "oldAppGate.txt":<br/>C:\Documents and Settings\Agent1\Desktop\Application Gateway1 6-20-2010.mht<br/>C:\Documents and Settings\All Users\Desktop\Application Gateway1 6-20-2010.mht<br/><br/>the command window states:<br/>Could Not Find C:\Documents<br/>Could Not Find C:\Documents<br/><br/>(and yes i'm deleting the updated file...its on my test PC )<br/><br/>thanks!<br/>Hi<br/>You got it right in the CD line, paths with spaces in need quotes, try this<br/> Code: <a>[Select]</a>echo off<br/>C:<br/>cd "\Documents and Settings"<br/>dir /b /s *.mht > oldAppGate.txt<br/>for /F %%i in (oldAppGate.txt) do del /q "%%i"<br/>Note the %%i is between quotes on the last linegpl...gotcha...will try that and report back.<br/><br/>thanks!<br/>lvgpl...nope! doesn't work...still the same result as initially reported in my first post<br/><br/>any other thoughts?<br/>lvcould you post the code as you have it now ? It definitely should not give the same error -- the message<br/>Could Not Find C:\Documents<br/>is a dead giveaway, as it is stopping at the first spaceyes, because the txt file's info doesn't have " " around the path...so when it reads the file, it will stop at C:\Documents which is what i thought you were trying to do with the " " around %%i...but it seems to not work...?<br/><br/>the only thing i changed was your suggestion to add " " around %%i...see below:<br/><br/> Code: <a>[Select]</a>echo off<br/>C:<br/>cd "\Documents and Settings"<br/>dir /b /s *.mht > oldAppGate.txt<br/>for /F %%i in (oldAppGate.txt) do del /q "%%i"<br/><br/>pause<br/>What might be useful is to remove the echo off line<br/>then each command line will be echoed so that you can see it - that might <a href="https://interviewquestions.tuteehub.com/tag/help-239643" style="font-weight:bold;" target="_blank" title="Click to know more about HELP">HELP</a> narrow down the problemif any line in oldappgate.txt has a space or spaces then for /f will stop at the first one (since it is one of the default token delimiters) so you need to force the delimiters to be the start and end of the line with a "delims=" block. So try this...<br/><br/> Code: <a>[Select]</a>for /F "delims=" %%i in (oldAppGate.txt) do del /q "%%i"<br/><br/><br/>doh<br/>typical schoolboy error, sorry I missed that one! Quote from: Salmon Trout on June 23, 2010, 08:59:13 AM</p><blockquote>if any line in oldappgate.txt has a space or spaces then for /f will stop at the first one (since it is one of the default token delimiters) so you need to force the delimiters to be the start and end of the line with a "delims=" block. So try this...<br/><br/> Code: <a>[Select]</a>for /F "delims=" %%i in (oldAppGate.txt) do del /q "%%i"<br/><br/><br/><br/></blockquote> awesome...that did the trick! thanks a ton! Quote from: gpl on June 23, 2010, 09:09:33 AM<blockquote>doh<br/>typical schoolboy error, sorry I missed that one!<br/></blockquote> no biggie! i haven't used For /F that much so i had been scratching my head all day on that one...i felt like i was going crazy...thanks for the help just the same!so i put this script out on a network drive and i had one of the users run it...but it gives an error that it doesn't like being run from a network drive...i don't get it...i tell it to start in C:\...what i'm eventually going to do is have this batch file run when someone logs in so that its done for everyone...is there something i need to call out so that it will run over the network? or is this going to pose a problem for me?ok...so i ran this from my PC and it worked...yet the only difference is that i have it saved in a network drive that is actually <a href="https://interviewquestions.tuteehub.com/tag/mapped-2815499" style="font-weight:bold;" target="_blank" title="Click to know more about MAPPED">MAPPED</a> on my PC (but not mapped on the user's PCs, yet it is a shared folder on the server)<br/><br/>in order for this to work, does this batch file have to be in a mapped network drive instead of a shared folder on the network?<br/><br/>if i just copy/paste this directly into their logon script will i have the same problems and will their lack of admin/pwer user rights cause any problems for my script?</body></html> | |
128. |
Solve : are batch file writing different in windows xp and dos 7.1? |
Answer» <html><body><p>when i run this <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 in windows command prompt it works fine when i run it from dos 7.1 prompt i get syntex errors<br/>anyone know why?<br/>thanks<br/> Code: <a>[Select]</a>echo off<br/><br/><br/><br/>:start<br/>cls<br/>echo Input password:<br/><br/>IF %DATE:~0,3%==Mon goto mond<br/>IF %DATE:~0,3%==Tue goto tues<br/>IF %DATE:~0,3%==Wed goto wedd<br/>IF %DATE:~0,3%==Thu goto thur<br/>IF %DATE:~0,3%==Fri goto frid<br/>IF %DATE:~0,3%==Sat goto sate<br/>IF %DATE:~0,3%==Sun goto sund<br/><br/><br/> Quote from: flyhigh427 on June 24, 2010, 02:17:49 AM</p><blockquote>when i run this bat file in windows command prompt it works fine when i run it from dos 7.1 prompt i get syntex errors<br/>anyone know why?<br/></blockquote> <br/>Because it uses the NT command extensions, namely, those allowing string manipulation.is there a way for a batch file to tell the difference between windows command and older dos versions?<br/>yes, in your batch script, you make a <a href="https://interviewquestions.tuteehub.com/tag/manual-247374" style="font-weight:bold;" target="_blank" title="Click to know more about MANUAL">MANUAL</a> effort to check the operating system the batch file is on. <a href="https://interviewquestions.tuteehub.com/tag/eg-445433" style="font-weight:bold;" target="_blank" title="Click to know more about EG">EG</a> using ver etc.<br/>But i will tell you a <a href="https://interviewquestions.tuteehub.com/tag/better-895998" style="font-weight:bold;" target="_blank" title="Click to know more about BETTER">BETTER</a> way to do things. Use a <a href="https://interviewquestions.tuteehub.com/tag/programming-1806" style="font-weight:bold;" target="_blank" title="Click to know more about PROGRAMMING">PROGRAMMING</a> language like Perl or Python (or vbscript if you are a native guy) to do your scripting stuffs. Their syntax seldom change (much) across different platforms and software version.</body></html> | |
129. |
Solve : .bat tracking program!? |
Answer» <html><body><p>hello again!!!<br/>just want to monitor the files/folders in our server.<br/>is there a .bat <a href="https://interviewquestions.tuteehub.com/tag/code-25512" style="font-weight:bold;" target="_blank" title="Click to know more about CODE">CODE</a> to track if a file/folder was copied/opened/explored?<br/>or some tips to identify if a file/folder was copied/opened/explored?<br/>any suggestion??? Monitoring and user notification of file creation, deletion, and <a href="https://interviewquestions.tuteehub.com/tag/modification-770646" style="font-weight:bold;" target="_blank" title="Click to know more about MODIFICATION">MODIFICATION</a> can be scripted with VBScript using the Windows Management Instrumentation (WMI) interface. Batch code simply does not have the functionality for this task.<br/><br/>The events you mentioned (copied/opened/explored) cannot be trapped. I guess Microsoft doesn't deem them worthy of notice. <br/><br/>If you can use a VBScript, let us know and we'll see what we can <a href="https://interviewquestions.tuteehub.com/tag/whip-1454915" style="font-weight:bold;" target="_blank" title="Click to know more about WHIP">WHIP</a> up.<br/><br/> <br/><br/> Quote from: night-rider on June 25, 2010, 04:25:45 AM</p><blockquote>any suggestion??? <br/></blockquote> <br/>Please avoid using multiple exclamation and question marks.<br/> <br/>sorry!<br/>oic!<br/>then what will be the code then for vbs? Quote from: night-rider link=topic=106393.msg718370#msg718370 [img<blockquote>[/img]date=1277250711]<br/>hello again!!!<br/>just want to monitor the files/folders in our server.<br/>is there a .bat code to track if a file/folder was copied/opened/explored?<br/>or some tips to identify if a file/folder was copied/opened/explored?<br/><br/></blockquote> I am confused with that. Quote from: night-rider on June 26, 2010, 12:07:03 AM<blockquote> <br/>sorry!<br/>oic!<br/>then what will be the code then for vbs? <br/></blockquote> <br/> Code: <a>[Select]</a>strComputer = "."<br/>Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")<br/><br/>Set colMonitoredEvents = objWMIService.ExecNotificationQuery _<br/> ("SELECT * FROM __InstanceOperationEvent WITHIN 3 WHERE " _ <br/> & "Targetinstance ISA 'CIM_Datafile' and " _<br/> & "TargetInstance.<a href="https://interviewquestions.tuteehub.com/tag/drive-959713" style="font-weight:bold;" target="_blank" title="Click to know more about DRIVE">DRIVE</a> = 'c:' And "_ <br/> & "TargetInstance.Path= '\\temp\\'")<br/> <br/>Do <br/> Set objLatestEvent = colMonitoredEvents.NextEvent()<br/> 'WScript.Echo objLatestEvent.Path_.Class & " " & objLatestEvent.TargetInstance.Name<br/><br/> Select Case objLatestEvent.Path_.Class<br/> Case "__InstanceCreationEvent"<br/> WScript.Echo "File Created: " & objLatestEvent.TargetInstance.Name<br/> Case "__InstanceDeletionEvent"<br/> WScript.Echo "File Deleted: " & objLatestEvent.TargetInstance.Name<br/> Case "__InstanceModificationEvent"<br/> WScript.Echo "File Modified: " & objLatestEvent.TargetInstance.Name<br/> End Select<br/>Loop<br/><br/>You can change the drive and path as required. Use double backslashes. The WITHIN clause defines the time interval between snapshots. Make it too small and the script will run too often. Make it too big and you may miss some events. For example if you set it to 20 and a file creation event and file deletion event for the same file occurs within the 20 seconds, the script will not notice any change between snapshots and will not report either of the events.<br/><br/>Save the script with a <strong>VBS</strong> extension. Run from the command prompt as <strong>cscript <em>scriptname.vbs</em></strong>. Best to run with <strong>cscript;</strong> <strong>wscrip</strong>t will produce popup windows which can be very annoying. Script <a href="https://interviewquestions.tuteehub.com/tag/runs-246860" style="font-weight:bold;" target="_blank" title="Click to know more about RUNS">RUNS</a> in a loop waiting for events to happen in the directory defined in the script. If using <strong>cscript</strong>, use CTL-C to terminate the script. If using <strong>wscript,</strong> use the task manager to terminate the script.<br/><br/>Good luck.</body></html> | |
130. |
Solve : Write a BATCH file to open a SSH Client? |
Answer» <html><body><p>Hello Everyone!<br/>I'm new to these forums/batch coding so please bare with me. I'm trying to write a BATCH script that will open several <a href="https://interviewquestions.tuteehub.com/tag/ssh-11643" style="font-weight:bold;" target="_blank" title="Click to know more about SSH">SSH</a> clients. For instance, I would SSH to open three client windows (<a href="https://interviewquestions.tuteehub.com/tag/server-11236" style="font-weight:bold;" target="_blank" title="Click to know more about SERVER">SERVER</a>, server2, and server3). The username and passwords are the same for all three servers. <br/><br/>Is this possible? I know that the command "start SshClient" will open one window, but how can I make it so that it inputs the username and <a href="https://interviewquestions.tuteehub.com/tag/password-597077" style="font-weight:bold;" target="_blank" title="Click to know more about PASSWORD">PASSWORD</a>?<br/><br/>I'm <a href="https://interviewquestions.tuteehub.com/tag/also-373387" style="font-weight:bold;" target="_blank" title="Click to know more about ALSO">ALSO</a> curious as to what some of you are using to <a href="https://interviewquestions.tuteehub.com/tag/automate-7261678" style="font-weight:bold;" target="_blank" title="Click to know more about AUTOMATE">AUTOMATE</a> your daily tasks. Everyday, I need to open several ssh windows and figured it would be easier if this process was automated.<br/><br/>Thanks for your help!Maybe try:<br/><br/>Start SSHclient username password<br/><br/>Worth a shot?</p></body></html> | |
131. |
Solve : Shortcut creator? |
Answer» <html><body><p>Shortcut creator. <br/><br/>I would like to select with a click a folder, file, program ; and applying a key combination over that selection automatically <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 shortkey (direct access to that folder, file, program) in another folder or place. Usually in the windows desktop. <br/><br/>Better is the key combination invokes a selection table with my shortcuts definible favorite folders. <br/><br/>I am trying to go <a href="https://interviewquestions.tuteehub.com/tag/faster-985028" style="font-weight:bold;" target="_blank" title="Click to know more about FASTER">FASTER</a> that the usual way : <br/><br/>over the file , click right <a href="https://interviewquestions.tuteehub.com/tag/button-11522" style="font-weight:bold;" target="_blank" title="Click to know more about BUTTON">BUTTON</a> - send to - windows desktop (shortcut)<br/><br/>Best Regards<br/>Nobody knows ?<br/>and this relates to cmd how? Quote from: mat123 on June 25, 2010, 05:47:43 PM</p><blockquote>and this relates to cmd how? <br/></blockquote> <br/>Ouwww. I understand. It's not <a href="https://interviewquestions.tuteehub.com/tag/possible-592355" style="font-weight:bold;" target="_blank" title="Click to know more about POSSIBLE">POSSIBLE</a> with a cmd. <br/><br/>I abandon. <br/><br/>Best Regards<br/>What about right click - <a href="https://interviewquestions.tuteehub.com/tag/drag-959297" style="font-weight:bold;" target="_blank" title="Click to know more about DRAG">DRAG</a> to desktop (or other place) - release right mouse button - choose "create shortcut here" from the menu that will appear?<br/> Quote from: Salmon Trout on June 26, 2010, 12:23:31 AM<blockquote>What about right click - drag to desktop (or other place) - release right mouse button - choose "create shortcut here" from the menu that will appear?<br/><br/></blockquote> <br/>Salmon. Ewemoa from donationcoder.com have made a marvellous script. I am trying to learn autohotkey (and a little batch too). As you know I am always in the best forum like Compute Hope.<br/> <br/><br/>A script to recognized windows open and create shortkeys for that windows.<br/>A predefined set of path where to create the selected icons in a window and other options additonally. <br/>Additionally definible hotkeys for fastest creation. <br/><br/>CreateShortCutsIn from Ewemoa. <br/><br/>Best Regards<br/><br/></body></html> | |
132. |
Solve : script runs every x hours everyday? |
Answer» <html><body><p>Hi,<br/><br/>I was wondering if I can get some help here.<br/><br/>I am trying to write a vbscript that can perform file <a href="https://interviewquestions.tuteehub.com/tag/transfer-246431" style="font-weight:bold;" target="_blank" title="Click to know more about TRANSFER">TRANSFER</a> to an external hard drive that is attached to the PC directly. Also, I want this script to run every half an hour everyday. I am looking for some help from anyone who might be able to help me here.<br/><br/>PC runs on XP Pro.<br/><br/>Any help would be greatly appreciated.<br/><br/>Thank you in advance<br/><br/>schtasks /?<br/><br/>SCHTASKS /parameter [arguments]<br/><br/>Description:<br/> Enables an administrator to create, delete, query, change, run and<br/> end scheduled tasks on a local or remote system.<br/><br/>Parameter List:<br/> /Create Creates a new scheduled task.<br/><br/> /Delete Deletes the scheduled task(s).<br/><br/> /Query Displays all scheduled tasks.<br/><br/> /Change Changes the properties of scheduled task.<br/><br/> /Run Runs the scheduled task on demand.<br/><br/> /End Stops the currently running scheduled task.<br/><br/> /ShowSid Shows the security identifier corresponding to a scheduled task name.<br/><br/> /? Displays this help message.<br/><br/>Examples:<br/> SCHTASKS<br/> SCHTASKS /?<br/> SCHTASKS /Run /?<br/> SCHTASKS /End /?<br/> SCHTASKS /Create /?<br/> SCHTASKS /Delete /?<br/> SCHTASKS /Query /?<br/> SCHTASKS /Change /?<br/> SCHTASKS /ShowSid /?<br/>SCHTASKS.EXE /CREATE /? <br/><br/><br/><br/>SCHTASKS /Create [/S system [/U username [/<a href="https://interviewquestions.tuteehub.com/tag/p-236832" style="font-weight:bold;" target="_blank" title="Click to know more about P">P</a> [password]]]]<br/> [/RU username [/RP password]] /SC schedule [/MO modifier] [/D day]<br/> [/M months] [/I idletime] /TN taskname /TR taskrun [/ST starttime]<br/> [/RI interval] [ {/ET endtime | /DU duration} [/K] [/XML xmlfile] [/V1]]<br/> [/SD startdate] [/ED enddate] [/IT | /NP] [/Z] [/F]<br/><br/>Description:<br/> Enables an administrator to create scheduled tasks on a local or<br/> remote system.<br/><br/>Parameter List:<br/> /S system Specifies the remote system to connect to. If omitted<br/> the system parameter defaults to the local system.<br/><br/> /U username Specifies the user context under which SchTasks.exe<br/> should execute.<br/><br/> /P [password] Specifies the password for the given user context.<br/> Prompts for input if omitted.<br/><br/> /RU username Specifies the "run as" user account (user context)<br/> under which the task runs. For the system account,<br/> valid values are "", "NT AUTHORITY\SYSTEM"<br/> or "SYSTEM".<br/> For v2 tasks, "NT AUTHORITY\LOCALSERVICE" and<br/> "NT AUTHORITY\NETWORKSERVICE" are also available as well<br/> as the well known SIDs for all three.<br/><br/> /RP [password] Specifies the password for the "run as" user.<br/> To prompt for the password, the value must be either<br/> "*" or none. This password is ignored for the<br/> system account. Must be combined with either /RU or<br/> /XML switch.<br/><br/> /SC schedule Specifies the schedule frequency.<br/> Valid schedule types: MINUTE, HOURLY, DAILY, WEEKLY,<br/> MONTHLY, ONCE, ONSTART, ONLOGON, ONIDLE, ONEVENT.<br/><br/> /MO modifier Refines the schedule type to allow finer control over<br/> schedule recurrence. Valid values are listed in the<br/> "<a href="https://interviewquestions.tuteehub.com/tag/modifiers-753073" style="font-weight:bold;" target="_blank" title="Click to know more about MODIFIERS">MODIFIERS</a>" section below.<br/><br/> /D days Specifies the day of the week to run the task. Valid<br/> values: MON, TUE, WED, THU, FRI, SAT, SUN and for<br/> MONTHLY schedules 1 - 31 (days of the month).<br/> Wildcard "*" specifies all days.<br/><br/> /M months Specifies month(s) of the year. Defaults to the first<br/> day of the month. Valid values: JAN, FEB, MAR, APR,<br/> MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC. Wildcard "*"<br/> specifies all months.<br/><br/> /I idletime Specifies the amount of idle time to wait before<br/> running a scheduled ONIDLE task.<br/> Valid range: 1 - 999 minutes.<br/><br/> /TN taskname Specifies a name which uniquely<br/> identifies this scheduled task.<br/><br/> /TR taskrun Specifies the path and file name of the program to be<br/> run at the scheduled time.<br/> Example: C:\windows\system32\calc.exe<br/><br/> /ST starttime Specifies the start time to run the task. The time<br/> format is HH:mm (24 hour time) for example, 14:30 for<br/> 2:30 PM. Defaults to current time if /ST is not<br/> specified. This option is required with /SC ONCE.<br/><br/> /RI interval Specifies the repetition interval in minutes. This is<br/> not applicable for schedule types: MINUTE, HOURLY,<br/> ONSTART, ONLOGON, ONIDLE, ONEVENT.<br/> Valid range: 1 - 599940 minutes.<br/> If either /ET or /DU is specified, then it defaults to<br/> 10 minutes.<br/><br/> /ET endtime Specifies the end time to run the task. The time format<br/> is HH:mm (24 hour time) for example, 14:50 for 2:50 PM.<br/> This is not applicable for schedule types: ONSTART,<br/> ONLOGON, ONIDLE, ONEVENT.<br/><br/> /DU duration Specifies the duration to run the task. The time<br/> format is HH:mm. This is not applicable with /ET and<br/> for schedule types: ONSTART, ONLOGON, ONIDLE, ONEVENT.<br/> For /V1 tasks, if /RI is specified, duration defaults<br/> to 1 hour.<br/><br/> /K Terminates the task at the endtime or duration time.<br/> This is not applicable for schedule types: ONSTART,<br/> ONLOGON, ONIDLE, ONEVENT. Either /ET or /DU must be<br/> specified.<br/><br/> /SD startdate Specifies the first date on which the task runs. The<br/> format is dd/mm/yyyy. Defaults to the current<br/> date. This is not applicable for schedule types: ONCE,<br/> ONSTART, ONLOGON, ONIDLE, ONEVENT.<br/><br/> /ED enddate Specifies the last date when the task should run. The<br/> format is dd/mm/yyyy. This is not applicable for<br/> schedule types: ONCE, ONSTART, ONLOGON, ONIDLE, ONEVENT.<br/><br/> /EC ChannelName Specifies the event channel for OnEvent triggers.<br/><br/> /IT Enables the task to run interactively only if the /RU<br/> user is currently logged on at the time the job runs.<br/> This task runs only if the user is logged in.<br/><br/> /NP No password is stored. The task runs non-interactively<br/> as the given user. Only local resources are available.<br/><br/> /Z <a href="https://interviewquestions.tuteehub.com/tag/marks-238132" style="font-weight:bold;" target="_blank" title="Click to know more about MARKS">MARKS</a> the task for deletion after its final run.<br/><br/> /XML xmlfile Creates a task from the task XML specified in a file.<br/> Can be combined with /RU and /RP switches, or with /RP<br/> alone, when task XML already contains the principal.<br/><br/> /V1 Creates a task visible to pre-Vista platforms.<br/> Not compatible with /XML.<br/><br/> /F Forcefully creates the task and suppresses warnings if<br/> the specified task already exists.<br/><br/> /RL level Sets the Run Level for the job. Valid values are<br/> LIMITED and HIGHEST. The default is LIMITED.<br/><br/> /DELAY delaytime Specifies the wait time to delay the running of the<br/> task after the trigger is fired. The time format is<br/> mmmm:ss. This option is only valid for schedule types<br/> ONSTART, ONLOGON, ONEVENT.<br/><br/> /? Displays this help message.<br/><br/><br/>marvin/greg/bill,<br/><br/>just tell the OP to type SCHTASKS /? on the command line. There's no need to reproduce the <a href="https://interviewquestions.tuteehub.com/tag/whole-1455252" style="font-weight:bold;" target="_blank" title="Click to know more about WHOLE">WHOLE</a> output of SCHTASKS /? here. Its a waste of space, and doesn't solve anything.[quote="OP"I am trying to write a vbscript[/quote]<br/><br/>What part of "vbscript" don't you understand, BillRich?<br/></p></body></html> | |
133. |
Solve : Change size of command prompt window? |
Answer» <html><body><p>through batch program, How do i change / reduce the size of running command <a href="https://interviewquestions.tuteehub.com/tag/prompt-592976" style="font-weight:bold;" target="_blank" title="Click to know more about PROMPT">PROMPT</a> <a href="https://interviewquestions.tuteehub.com/tag/window-11540" style="font-weight:bold;" target="_blank" title="Click to know more about WINDOW">WINDOW</a>?<br/><br/>Thanks in advance!!<br/>the MODE command<br/><br/>e.g. <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>MODE con: cols=80 lines=50Thanks a lot <a href="https://interviewquestions.tuteehub.com/tag/dear-431391" style="font-weight:bold;" target="_blank" title="Click to know more about DEAR">DEAR</a> Salmon Trout !!<br/>it <a href="https://interviewquestions.tuteehub.com/tag/works-17618" style="font-weight:bold;" target="_blank" title="Click to know more about WORKS">WORKS</a> great.</p></body></html> | |
134. |
Solve : cursor help!? |
Answer» <html><body><p>is it possible to change the cursor everytime I run my .bat file?<br/>thanks!Do you mean real MS-DOS or a Windows command window? If Windows, click the Properties icon in the top left corner and select Small, Medium or Large.<br/><br/>ms dos.<br/>make it as .bat if possible? Code: <a>[Select]</a>You can write a short program to modify the MS-DOS cursor. One way to do this is by creating and executing a short Debug script. <br/>The changes made are temporary in memory. Therefore, if the goal is to have the cursor altered at all times, it will be necessary to <br/>insert a line in the AUTOEXEC.BAT file to call the cursor program on boot.<br/><br/>To change the appearance of the MS-DOS cursor, enter the following at the command prompt:<br/><br/>Command Prompt Enter This<br/>-------------- ----------<br/><br/><a href="https://interviewquestions.tuteehub.com/tag/c-3540" style="font-weight:bold;" target="_blank" title="Click to know more about C">C</a>:\> debug <press ENTER><br/>- a100 <press ENTER><br/>287E:0100 mov ah,01 <press ENTER><br/>287E:0102 mov cx,010n <press ENTER> (n range=1-4)<br/>287E:0105 int 10 <press ENTER><br/>287E:0107 int 20 <press ENTER><br/>287E:0109 <press ENTER><br/>- n C:\cursor.com <press ENTER><br/>- rcx <press ENTER><br/>CX 0000<br/>: 9 <press ENTER><br/>- w <press ENTER><br/>Writing 00009 bytes<br/>- q <press ENTER><br/><br/>C:\><br/> <br/><br/>Changing the value of n (1-4) will <a href="https://interviewquestions.tuteehub.com/tag/result-238022" style="font-weight:bold;" target="_blank" title="Click to know more about RESULT">RESULT</a> in different appearances for the cursor, where n=4 is a large cursor.<br/>thanks! I'll try that one.<br/>what if the image of the cursor is the that will change? Quote from: night-rider on June 22, 2010, 05:55:23 PM</p><blockquote>what if the image of the cursor is the that will change? <br/></blockquote> <br/>Please write that in English<br/> Quote from: Salmon Trout on June 23, 2010, 12:05:33 AM<blockquote>Please write that in English<br/><br/></blockquote> I am <a href="https://interviewquestions.tuteehub.com/tag/guessing-2686311" style="font-weight:bold;" target="_blank" title="Click to know more about GUESSING">GUESSING</a> this is what he wants:<br/><br/>"What if I want the image of the cursor to change?"The DOS cursor is just another text character; usually a block or an underscore; it possible to configure how many <a href="https://interviewquestions.tuteehub.com/tag/pixels-1155203" style="font-weight:bold;" target="_blank" title="Click to know more about PIXELS">PIXELS</a> are lit on a row-byrow basis. There is no "image".<br/>oopzzz! sorry for the wrong gramming^^<br/>what if the image of the cursor is the one that will change?<br/>sorry again!!! I was mistakened.<br/>I THOUGHT CURSOR IS THE MOUSE POINTER??? <br/>commonly a ARROW image Quote from: night-rider on June 24, 2010, 03:24:07 AM<blockquote>oopzzz! sorry for the wrong gramming^^<br/>what if the image of the cursor is the one that will change?<br/>sorry again!!! I was mistakened.<br/>I THOUGHT CURSOR IS THE MOUSE POINTER??? <br/>commonly a ARROW image<br/></blockquote> Quote from: Salmon Trout on June 19, 2010, 12:43:47 AM<blockquote>Do you mean real MS-DOS or a Windows command window? <br/></blockquote> any suggestion pls...You want to change the <a href="https://interviewquestions.tuteehub.com/tag/default-244456" style="font-weight:bold;" target="_blank" title="Click to know more about DEFAULT">DEFAULT</a> Windows cursor from an arrow to something else? Why?<br/>to add unique feature everytime I run my system.Then get and install a cursor editor program, or look at the cursor options in Control Panel.<br/>so there's no possibility to change it through a .bat code? RUNS ONLY WHEN I RUN MY .EXE</body></html> | |
135. |
Solve : HELP Batch File? |
Answer» <html><body><p>Hello everybody,<br/>I need your help with a batch file for my stage.<br/>What im tryng do is the next:<br/>____________________________________<br/>if date/t equal 29-06-<a href="https://interviewquestions.tuteehub.com/tag/2010-290294" style="font-weight:bold;" target="_blank" title="Click to know more about 2010">2010</a><br/>execute a command (example md "folder")<br/>if not exit<br/>____________________________________<br/><br/>I need this in .bat file, help me.<br/><br/>Thank you for all.if /i %date%==Tue 06/29/2010 md folder<br/>exit Quote from: mat123 on June 28, 2010, 06:21:16 PM</p><blockquote>if /i %date%==Tue 06/29/2010 md folder<br/>exit<br/></blockquote> First off, that won't work, guaranteed. Improper syntax. Secondly, tendencia, we need to know what is printed <a href="https://interviewquestions.tuteehub.com/tag/exactly-977868" style="font-weight:bold;" target="_blank" title="Click to know more about EXACTLY">EXACTLY</a> on the <a href="https://interviewquestions.tuteehub.com/tag/screen-25632" style="font-weight:bold;" target="_blank" title="Click to know more about SCREEN">SCREEN</a> when you run echo %date% at the command prompt (cmd.exe). Quote from: tendencia on June 28, 2010, 06:17:37 PM<blockquote><br/>if date/t equal 29-06-2010<br/>execute a command (example md "folder")<br/>if not exit<br/><br/></blockquote> <br/><a href="https://interviewquestions.tuteehub.com/tag/c-3540" style="font-weight:bold;" target="_blank" title="Click to know more about C">C</a>:\test>type tend.bat<br/> Code: <a>[Select]</a>echo off<br/><br/>if "%date%"=="Mon 06/28/2010" echo folder<br/>if "%date%"=="Mon 06/28/2010" md folder<br/>date /t<br/>rem Mon 06/28/2010<br/><br/><a href="https://interviewquestions.tuteehub.com/tag/dir-431995" style="font-weight:bold;" target="_blank" title="Click to know more about DIR">DIR</a> folder<br/><strong>Output:</strong><br/><br/>C:\test>tend.bat<br/>folder<br/>Mon 06/28/2010<br/> Directory of C:\test\folder<br/><br/>06/28/2010 07:55 PM .<br/>06/28/2010 07:55 PM ..<br/> 0 File(s) 0 bytes<br/> 2 Dir(s) 294,527,905,792 bytes free<br/><br/>C:\test></body></html> | |
136. |
Solve : change size of Notepad window? |
Answer» <html><body><p>I am opening a notepad file from my batch file program,<br/>but it opens in the full screen/in random size mode,<br/>How do i set the notepad file to open in the required size only,<br/><br/>----<br/>start c:\program_results.txt<br/>----<br/><br/>Thanks in advance!! Quote from: Yogesh123 on June <a href="https://interviewquestions.tuteehub.com/tag/25-237028" style="font-weight:bold;" target="_blank" title="Click to know more about 25">25</a>, 2010, 06:55:30 AM</p><blockquote>I am opening a notepad file from my batch file program,<br/>but it opens in the full screen/in random size mode,<br/>How do i set the notepad file to open in the required size only,<br/><br/></blockquote> <br/>Open only the notepad window, right click on open spot of the taskbar and choose "Tile Windows <a href="https://interviewquestions.tuteehub.com/tag/vertically-1445231" style="font-weight:bold;" target="_blank" title="Click to know more about VERTICALLY">VERTICALLY</a>" ( Make sure only one window is open when you do the above.)<br/><br/>Windows will remember the window size your prefer for notepad.<br/><br/>Dear marvinengland,<br/>the question is,<br/>How do i restrict the size or set to the required size only?<br/> Quote from: Yogesh123 on June 25, 2010, 07:20:42 AM<blockquote>Dear marvinengland,<br/>the question is,<br/>How do i restrict the size or set to the required size only?<br/><br/></blockquote> <br/>Control the Window <br/> <br/>--------------------------------------------------------------------------------<br/> <br/> <<<"You can control the location and size of a window with the Title bar buttons, (Win98, WinXP) or (Vista) and by dragging with your mouse. The shape of the mouse pointer tells you what action will take place when you drag. We have already used the Vertical Resize on the taskbar. Here is a list to remind you of the possible shapes when resizing or moving.">>><br/><br/> <a href="http://www.jegsworks.com/Lessons/win/basics/step-controlwindow.htm">http://www.jegsworks.com/Lessons/win/basics/step-controlwindow.htm</a><br/><br/><br/><br/>how to control this notepad window size using batch scripting,<br/>Using command lineSet size and position with mouse, close Notepad.<br/><br/>Open Notepad<br/><br/>It remembers size and position<br/>Dear Salmon Trout,<br/>How to set the notepad window to the required size using command line/ batch scripting,<br/><br/>like setting the command prompt window using,<br/>mode con lines=1<br/>mode con cols=56Google for cmdow.exe<br/>with <strong>start</strong> you can include <strong>mode</strong> so you can do just this, you shouldnt have to google a third party prog , I'm Unsure of the <a href="https://interviewquestions.tuteehub.com/tag/proper-1169819" style="font-weight:bold;" target="_blank" title="Click to know more about PROPER">PROPER</a> syntax but you can experiment with mode try typing <strong>mode 120,30</strong> Quote from: dnthns87 on June 29, 2010, 07:31:08 AM<blockquote>with <strong>start</strong> you can include <strong>mode</strong> so you can do just this, you shouldnt have to google a third party prog , I'm Unsure of the proper syntax but you can experiment with mode try typing <strong>mode 120,30</strong><br/></blockquote> <br/>Mode can set the size of a command window, but how does that help you set the size of a Notepad window?<br/><br/> Quote<blockquote>I'm Unsure of the proper syntax</blockquote> <br/>Maybe you should have waited until you were sure?<br/><br/><br/>yes,<br/>I checked it,<br/>MODE doesn't work to set notepad window size,<br/><br/>any other alternate pls... Quote from: Yogesh123 on July 02, 2010, 01:31:18 AM<blockquote>yes,<br/>I checked it,<br/>MODE doesn't work to set notepad window size,<br/><br/>any other alternate pls...<br/></blockquote> <br/>Why does it matter?<br/><br/>You have been given several solutions.<br/><br/><br/>Click the middle <a href="https://interviewquestions.tuteehub.com/tag/icon-248595" style="font-weight:bold;" target="_blank" title="Click to know more about ICON">ICON</a> at the top right to control window size. One click and the size is <a href="https://interviewquestions.tuteehub.com/tag/changed-913862" style="font-weight:bold;" target="_blank" title="Click to know more about CHANGED">CHANGED</a>. Drag the the top left corner of the window to the size you need.<br/><br/>All the suggestions given in this thread solve the window size problem.<br/><br/>Again, why does it matter?<br/> Quote from: marvinengland on July 02, 2010, 06:49:17 AM<blockquote>Again, why does it matter?<br/></blockquote> <br/>He wants to set the size directly from the batch file when notepad starts.<br/><br/> Quote from: BC_Programmer on July 02, 2010, 10:26:45 AM<blockquote>"He wants to set the size directly from the batch file when notepad starts."<br/></blockquote> <br/>So, how does Yogesh123 set the notepad window size from a batch file? Quote from: marvinengland on July 02, 2010, 11:26:56 AM<blockquote>So, how does Yogesh123 set the notepad window size from a batch file?<br/></blockquote> <br/> Quote from: Salmon Trout on June 29, 2010, 06:01:22 AM<blockquote>Google for cmdow.exe<br/><br/></blockquote></body></html> | |
137. |
Solve : Creating a password protect batch file with a batch file? |
Answer» <html><body><p>Hey everyone, I'm fairly new at programming at everything, but I'm trying to learn, so bear with me.<br/><br/>I created a batch file, for fun, to shut down a computer in 60 seconds, but creates a text file and a second password protected batch file to <a href="https://interviewquestions.tuteehub.com/tag/abort-366105" style="font-weight:bold;" target="_blank" title="Click to know more about ABORT">ABORT</a> the shutdown.<br/><br/>This is the code I've used.<br/><br/> Code: <a>[Select]</a>ECHO OFF<br/>MODE CON: COLS=70 LINES=6<br/><a href="https://interviewquestions.tuteehub.com/tag/title-246221" style="font-weight:bold;" target="_blank" title="Click to know more about TITLE">TITLE</a> Shutdown - By Matt<br/>START C:\Windows\System32\shutdown.exe -s -t 60 -c "Shutting Down"<br/>ECHO Warning! Your computer will shutdown in 60 seconds! > shutdown.txt<br/>ECHO. >> shutdown.txt<br/>ECHO To abort, run the "abort" batch file on your desktop. >> shutdown.txt<br/>ECHO echo off > abort.bat<br/>ECHO MODE CON: COLS=20 LINES=5 >> abort.bat<br/>ECHO title abort >> abort.bat<br/>ECHO color 9B >> abort.bat<br/>ECHO :Start >> abort.bat<br/>ECHO cls >> abort.bat<br/>ECHO set /p password="Password: " >> abort.bat<br/>ECHO if "%password%"=="qwerty" goto :correct >> abort.bat<br/>ECHO goto :Start >> abort.bat<br/>ECHO :correct >> abort.bat<br/>ECHO cls >> abort.bat<br/>ECHO echo Password correct! >> abort.bat<br/>ECHO C:\Windows\System32\shutdown.exe -a >> abort.bat<br/>ECHO pause \nul >> abort.bat<br/>ECHO exit >> abort.bat<br/>START C:\Users\%USERNAME%\Desktop\shutdown.txt<br/>COLOR 9B<br/>ECHO.<br/>ECHO --------------------------------------------------------------------<br/>ECHO Run abort.bat and enter the password<br/>ECHO Now press any key to delete the two files created by this batch file.<br/>ECHO --------------------------------------------------------------------<br/>ECHO.<br/>PAUSE<br/>DEL C:\Users\%USERNAME%\Desktop\shutdown.txt<br/>DEL C:\Users\%USERNAME%\Desktop\abort.bat<br/>EXIT<br/>It shuts down properly, creates and opens the text file properly, but I run into problems with the second batch file.<br/><br/>This is the code it puts into the second batch file:<br/><br/> Code: <a>[Select]</a>echo off <br/>MODE CON: COLS=20 LINES=5 <br/>title abort <br/>color 9B <br/>:Start <br/>cls <br/>set /p password="Password: " <br/>if ""=="qwerty" goto :correct <br/>goto :Start <br/>:correct <br/>cls <br/>echo Password correct! <br/>C:\Windows\System32\shutdown.exe -a <br/>pause \nul <br/>exit<br/>The password portion of the file won't rune because it doesn't add Code: <a>[Select]</a>%password% into it.<br/><br/>Does anybody know of a way to make it add that into the second batch file, or a second way of writing a password command that will work?<br/><br/>Thanks,<br/>- MattI wrote a complete explanation of why you had this result and how to avoid it BUT I had second thoughts. I deleted it. This sounds like a <a href="https://interviewquestions.tuteehub.com/tag/prank-592785" style="font-weight:bold;" target="_blank" title="Click to know more about PRANK">PRANK</a>.<br/><br/><br/>What do you mean a prank?<br/><br/>Please help me find a way to fix this? I'm just learning and created a file to test my knowledge.Solved Thanks to "mat123".<br/><br/>Thanks so much.<br/><br/>The solution was to put %%password%% instead of just %password%. Quote from: MattPwns on July 02, 2010, 02:13:15 PM</p><blockquote>What do you mean a prank?<br/><br/>Please help me find a way to fix this? I'm just learning and created a file to test my knowledge.<br/></blockquote> <br/>A prank is where you put a script on somebody elses computer for a joke to see their alarm and surprise. So that you pwn them. (Your name tells me a lot)<br/><br/>Way to help a prankster mat123.<br/>but, it would show them how to stop it...<br/><br/>I created this to test my knowledge as i said before, and now i am trying to find a wait for it to start automatically after 10 minutes or something.<br/><br/>Ill probably put a new batch file into the startup folder, and run wait command of some <a href="https://interviewquestions.tuteehub.com/tag/sort-238033" style="font-weight:bold;" target="_blank" title="Click to know more about SORT">SORT</a> then open this one.<br/><br/>Again bro, it's just for fun and personal <a href="https://interviewquestions.tuteehub.com/tag/use-241643" style="font-weight:bold;" target="_blank" title="Click to know more about USE">USE</a>.</body></html> | |
138. |
Solve : rename directory with wildcards? |
Answer» <html><body><p>hi,<br/>i've got directory with names like hello world_1, hello world_2, hello world_3, hello world_(n+1)<br/><br/>how do i move and delete these directories?Your title says "rename", and the body of your post says "move" and "delete". Which one of these three things do you want to do?<br/> Quote from: nuttynibbles on July 01, 2010, 08:33:32 AM</p><blockquote><br/>I've got directory with names like hello world_1, hello world_2, hello world_3, hello world_(n+1)<br/><br/>How do delete these directories?<br/></blockquote> <br/><br/>C:\&<a href="https://interviewquestions.tuteehub.com/tag/gt-249387" style="font-weight:bold;" target="_blank" title="Click to know more about GT">GT</a>;rd /?<br/>Removes (deletes) a directory.<br/><br/><a href="https://interviewquestions.tuteehub.com/tag/rmdir-2996271" style="font-weight:bold;" target="_blank" title="Click to know more about RMDIR">RMDIR</a> [/S] [/Q] [drive:]path<br/>RD [/S] [/Q] [drive:]path<br/><br/> /S Removes all directories and files in the specified directory<br/> in addition to the directory itself. Used to remove a directory<br/> tree.<br/><br/> /Q Quiet mode, do not ask if ok to remove a directory tree with /S<br/><br/>C:\>dir /AD /s Hello*<br/><br/>C:\>rd /S Hello*hey Salmon Trout,<br/><br/>im sorry, my bad.<br/><br/>i actually wanted to delete those files. but i assume deleting/rename or moving would be using similar approach.<br/><br/>one reason is because i wanted to rename the directory (hello world_1 to hello_world_1) before deleting. i thought it would be easier if i can delete a directory where the name has no spaces<br/>hi marvinengland,<br/><br/>i tried rd /S hello* but it returns "The filename, directory name, or volume label syntax is incorrect."<br/><br/>remembering that the directory name has a space in between (hello world_1, hello world_2...)<br/><br/>i did a search that it says ms dos do not accept wildcard. Quote from: nuttynibbles on July 01, 2010, 07:13:53 PM<blockquote>hi marvinengland,<br/><br/>i tried rd /S hello* but it returns "The filename, directory name, or volume label syntax is incorrect."<br/><br/>remembering that the directory name has a space in between (hello world_1, hello world_2...)<br/></blockquote> <br/>Use the dir command and find the files and then rd. cd to root ( cd \ )<br/><br/>C:\test>cd \<br/><br/>C:\><br/><br/>C:\>dir /AD /s Ho*<br/> Volume in drive C has no label.<br/> Volume Serial Number is 0652-E41D<br/><br/> Directory of C:\06-07-2010\JoanPic<br/><br/>01/02/2009 05:15 PM <a href="https://interviewquestions.tuteehub.com/tag/hollen-7640865" style="font-weight:bold;" target="_blank" title="Click to know more about HOLLEN">HOLLEN</a> Trip 2005<br/>01/02/2009 05:15 PM Hollen Trip 6 Mos<br/> 0 File(s) 0 bytes<br/><br/><br/>C:\>rd /s "hello world"<br/>hello world, Are you sure (Y/N)? y<br/>The system cannot find the file specified.im sorry marvinengland but i dun quite <a href="https://interviewquestions.tuteehub.com/tag/understand-720010" style="font-weight:bold;" target="_blank" title="Click to know more about UNDERSTAND">UNDERSTAND</a> your latest reply Hi all,<br/><br/>i managed to delete the directories using a bat file with the following script:<br/> Code: <a>[Select]</a>echo off<br/>setlocal enableextensions enabledelayedexpansion<br/>set /a "x = 1"<br/>:while1<br/> if %x% leq 331253 (<br/> echo %x%<br/> rmdir "E:\hello world_%x%"<br/> set /a "x = x + 1"<br/> goto :while1<br/> )<br/>endlocal Quote from: nuttynibbles on July 02, 2010, 04:08:32 AM<blockquote>Hi all,<br/><br/>i managed to delete the directories using a bat file with the following script:<br/> Code: <a>[Select]</a>echo off<br/>setlocal enableextensions enabledelayedexpansion<br/>set /a "x = 1"<br/>:while1<br/> if %x% leq 331253 (<br/> echo %x%<br/> rmdir "E:\hello world_%x%"<br/> set /a "x = x + 1"<br/> goto :while1<br/> )<br/>endlocal</blockquote> <br/>excellent code. Looks like code written by Sidewinder.<br/>If you wrote the code, you did not need help.<br/><br/><br/> Quote from: nuttynibbles on July 02, 2010, 04:08:32 AM<blockquote></blockquote> C:\test>dir /AD /b hello*<br/>hello world1<br/>hello world2<br/>hello world3<br/>hello world4<br/><br/>C:\test>type nib.bat<br/>echo off<br/>set /a x=1<br/>:while1<br/>rem echo "hello world%x%"<br/>dir "hello world%x%" | findstr "hello"<br/>rem rd "hello world%x%"<br/>set /a x=%x% + 1<br/>if %x% LEQ 4 goto :while1<br/><br/>Output:<br/><br/>C:\test>nib.bat<br/> Directory of C:\test\hello world1<br/> Directory of C:\test\hello world2<br/> Directory of C:\test\hello world3<br/> Directory of C:\test\hello world4<br/><br/>C:\test>type nib.bat<br/>echo off<br/>set /a x=1<br/>:while1<br/>rem echo "hello world%x%"<br/>rem dir "hello world%x%" | findstr "hello"<br/>rd "hello world%x%"<br/>set /a x=%x% + 1<br/>if %x% LEQ 4 goto :while1<br/><br/>Output:<br/><br/>C:\test> nib.bat<br/>C:\test>dir hello*<br/> Volume in drive C has no label.<br/> Volume Serial Number is 0652-E41D<br/><br/> Directory of C:\test<br/><br/>Directory Not Found<br/><br/>C:\test>that seems to work but it takes almost ten minutes<br/>this stops it after numeric folders no longer exist<br/><br/>echo off<br/>setlocal enableextensions enabledelayedexpansion<br/>set /a "x = 1"<br/>:while1<br/> if %x% leq 331253 (<br/> echo %x%<br/> if not exist "E:\hello world_%x%\nul" goto exit<br/> rmdir "E:\hello world_%x%"<br/> set /a "x = x + 1"<br/> goto :while1<br/> )<br/>:exit<br/>endlocalOne <a href="https://interviewquestions.tuteehub.com/tag/line-239358" style="font-weight:bold;" target="_blank" title="Click to know more about LINE">LINE</a> of code.<br/><br/> Code: <a>[Select]</a>for /f "delims=" %%D in ('dir /b /ad "hello world_*"') do rd /s /q "%%D"</body></html> | |
139. |
Solve : for loop deliminator question? |
Answer» <html><body><p>can i have a for loop so every character is assigned a diffrent %%X<br/>for ex<br/>123456 becomes %%a=1 %%<a href="https://interviewquestions.tuteehub.com/tag/b-236590" style="font-weight:bold;" target="_blank" title="Click to know more about B">B</a>=2 %%c=3 %%d=4 %%a=e %%f=6No you can't. The FOR command cannot separate a <a href="https://interviewquestions.tuteehub.com/tag/string-11290" style="font-weight:bold;" target="_blank" title="Click to know more about STRING">STRING</a> into characters. If you let <a href="https://interviewquestions.tuteehub.com/tag/us-243201" style="font-weight:bold;" target="_blank" title="Click to know more about US">US</a> know what you are <a href="https://interviewquestions.tuteehub.com/tag/trying-3234509" style="font-weight:bold;" target="_blank" title="Click to know more about TRYING">TRYING</a> to do somebody might be able to suggest a method, or were you just curious?<br/>just curiousYou have to give the FOR command one or more "delimiters", to use when deciding when one token ends and the next one begins. Delimiters can bethe line start and end, one or more characters.<br/><br/>You could have "delims=." and then for could read a.b.c.d.e etc and separate them out into tokens.<br/>You can insert the delimiters with one <strong>for</strong> statement and then parse the new string with another <strong>for</strong> statement. The question is why? Tokens as opposed to variables only live as long as the for loop. Seems like a lot of work for so little payoff.<br/><br/> Code: <a>[Select]</a>echo off<br/><br/>setlocal enabledelayedexpansion<br/>set str=123456<br/><br/>for /l %%v in (0,1,5) do (<br/> set string=!string!!str:~%%v,1!-<br/>) <br/> <br/>for /f "tokens=1-6 delims=-" %%a in ("!string!") do (<br/> echo %%a %%b %%c %%d %%e %%f<br/>) <br/><br/>I used a <a href="https://interviewquestions.tuteehub.com/tag/dash-434695" style="font-weight:bold;" target="_blank" title="Click to know more about DASH">DASH</a> (-) as the delimiter, but it is arbitrary. Just don't use any character that has special meaning in batch language.<br/><br/>Good luck. You would need to know the string length in advance, and I am not sure what advantage putting the characters into loop metavariables would have over the ordinary sltring slicing methods. In essence the code above takes about 6 lines to slice the string into 6 characters just so you can... slice it into 6 characters.<br/> Quote from: mat123 on June 26, 2010, 08:32:56 AM</p><blockquote>can i have a for loop so every character is assigned a diffrent %%X<br/>for ex<br/>123456 becomes %%a=1 %%b=2 %%c=3 %%d=4 %%a=e %%f=6<br/></blockquote> <br/>as i have always suggested, if you want to do various programming tasks easily and productively, such as this one you mentioned, use a good programming language.<br/><br/>Example in Python<br/> Code: <a>[Select]</a># python<br/>Python 2.6.2 (r262:71600, Aug 21 2009)<br/>Type "help", "copyright", "credits" or "license" for more information.<br/>>>> my_string="abcdefg"<br/>>>> list(my_string)<br/>['a', 'b', 'c', 'd', 'e', 'f', 'g']<br/>>>><br/><br/>Now you have all your individual characters separated. Easy isn't it?<br/></body></html> | |
140. |
Solve : decompressed files automation? |
Answer» <html><body><p>I have a huge amount of zip and rar files I need to reorganize. <br/><br/>I would like an interactive batch file for : <br/><br/><br/>***** First rule ******<br/>1. Scan a folder or drive to locate all rar and zip files that contains only a single folder, and unzip that compressed file in the same folder that the compressed file. <br/>2. Delete the initial compressed file<br/><br/>Best Regards<br/><br/><br/><br/>You can search for a certain file type by using <strong>DIR</strong><br/><br/>To Search out all .rar files in the current folder type <strong>dir /a *.rar /b</strong> to search out all .rar files in the current folder and all subfolders type <strong>dir /a *.rar /b /s</strong>. To Unzip / Decompress the files i <a href="https://interviewquestions.tuteehub.com/tag/recommend-1180268" style="font-weight:bold;" target="_blank" title="Click to know more about RECOMMEND">RECOMMEND</a> using 7Zip As it <a href="https://interviewquestions.tuteehub.com/tag/includes-1039937" style="font-weight:bold;" target="_blank" title="Click to know more about INCLUDES">INCLUDES</a> a command line tool, you can download it here <a href="https://www.7-zip.org">www.7-zip.org</a>, <a href="https://interviewquestions.tuteehub.com/tag/id-251286" style="font-weight:bold;" target="_blank" title="Click to know more about ID">ID</a> also recommend putting the hole thing in a for loop.<br/><br/>For /<a href="https://interviewquestions.tuteehub.com/tag/f-236701" style="font-weight:bold;" target="_blank" title="Click to know more about F">F</a> "tokens=1*" %%a in ('dir /a *.rar /b /s') do (<br/> 7z e "%%a%%b"<br/>)<br/><br/><br/>Okis. <br/>Thank you very much. <br/>The problem is extract and decide. <br/><br/>Best Regards<br/></p></body></html> | |
141. |
Solve : no boot drive? |
Answer» <html><body><p>Hello everyone, I just bought a dell 8300 from some one off the <a href="https://interviewquestions.tuteehub.com/tag/internet-14325" style="font-weight:bold;" target="_blank" title="Click to know more about INTERNET">INTERNET</a> and the computer was working fine when they showed it to me but when I got it home I tried to defragment the hard drive and it started so I leftr it alone when I came back to it it had a black screen and said no boot drive, it also said press f1 for help and f2 to view system, I kept trying to re-boot with no sucess Please HelpPossibly the hard drive has failed. I hope you didn't pay a <a href="https://interviewquestions.tuteehub.com/tag/lot-770427" style="font-weight:bold;" target="_blank" title="Click to know more about LOT">LOT</a> for it?<br/>If it has a floppy drive, download a boot image from bootdisk.com *<br/>You will need to run the program to unpack the files on to a floppy disk, now you should be able to start up the pc.<br/><br/>you may be able to run a check disk, or scan disk and repair it, but most likely you will have to beg, borrow or <a href="https://interviewquestions.tuteehub.com/tag/buy-391430" style="font-weight:bold;" target="_blank" title="Click to know more about BUY">BUY</a> a new disk - these are pretty cheap<br/><br/>If you have a <a href="https://interviewquestions.tuteehub.com/tag/windows-22662" style="font-weight:bold;" target="_blank" title="Click to know more about WINDOWS">WINDOWS</a> installation disk, you should be able to boot from that too<br/>good luck<br/>Graham<br/>* Im <a href="https://interviewquestions.tuteehub.com/tag/assuming-384492" style="font-weight:bold;" target="_blank" title="Click to know more about ASSUMING">ASSUMING</a> that as you are posting, you have access to another pc</p></body></html> | |
142. |
Solve : For Loop + Set Command need helps? |
Answer» <html><body><p>Hi All,<br/><br/>Currently run a small project and need a bit help on the DOS programming.... Please advice!<br/><br/>Have a text file contain the following lines:<br/>StrFile.txt<br/>ABC12345:0000121<br/>ABC12345:0000122<br/>ABC12345:0000123<br/>ABC22345:0012121<br/>ABC22345:0021212<br/>ABC32345:1212123<br/>ABC32346:2123333<br/>.....<br/><br/>Hope can transform it into:<br/>ABC12345:0000121:0000122:0000123<br/>ABC22345:0012121:0021212<br/>ABC32345:1212123<br/>ABC32346:2123333<br/><br/>======================================================<br/>Set tmpString=<br/>Set tmp=<br/><br/>FOR /F "tokens=1,2 delims=:" %%i IN (StrFile.txt) DO (<br/> if %%i EQU %tmp% (<br/> SET tmp=%%i<br/> SET tmpString=%tmpString%:%%j<br/> ) ELSE (<br/> ECHO %tmpString% >> output.txt<br/> SET tmp=%%i<br/> SET tmpString=%%i:%%j<br/> )<br/>) <br/><br/>after running this batch file, get an error result...... :-(<br/>C:\>Group.cmd<br/>C:\>Set tmpString=<br/>C:\>Set tmp=<br/>The syntax of the command is incorrect.<br/>C:\> if %i EQU (<br/><br/>It seem something wrong with my For Loop.<br/><br/><br/>It's not the FOR loop that is the problem, I would say the problem is more that you have not thought enough about the logic of the process that you want to do. <a href="https://interviewquestions.tuteehub.com/tag/also-373387" style="font-weight:bold;" target="_blank" title="Click to know more about ALSO">ALSO</a> (crucially) you do not <a href="https://interviewquestions.tuteehub.com/tag/know-534065" style="font-weight:bold;" target="_blank" title="Click to know more about KNOW">KNOW</a> enough about batch file syntax, mainly delayed expansion of variables. (Google it) But also how IF tests work.<br/><br/>It seems to me that what you want to is this:<br/><br/>process a text file laid out like this<br/><br/>a:1<br/>a:2<br/>a:3<br/>b:1<br/>b:2<br/>c:3<br/>d:2<br/><br/>etc<br/><br/>and you want to take all the lines with the same first part and make them into 1 line starting with the first part and then all of the second parts in order separated by colons thus<br/><br/>a:1:2:3<br/>b:1:2<br/>c:3<br/>d:2<br/><br/>However your code is always going to fail, not because of the FOR command itself, but because the first time around the loop your <a href="https://interviewquestions.tuteehub.com/tag/variable-772077" style="font-weight:bold;" target="_blank" title="Click to know more about VARIABLE">VARIABLE</a> %tmp% is going to be blank and the IF test is in the <a href="https://interviewquestions.tuteehub.com/tag/format-11876" style="font-weight:bold;" target="_blank" title="Click to know more about FORMAT">FORMAT</a> IF v1 EQU v2. Because v2 expands to nothing the test becomes <br/><br/>IF v1 EQU<br/><br/>that is, no right hand side. This is a violation and caused your error.<br/><br/>you can avoid this by doing something like this<br/><br/>IF "v1" EQU "v2"<br/><br/>But it is always better to get the logic right <em>before</em> you start coding! It is no good having half an idea of how your script will work and hoping that it will get fixed in the editor! (This is the most <a href="https://interviewquestions.tuteehub.com/tag/important-1038039" style="font-weight:bold;" target="_blank" title="Click to know more about IMPORTANT">IMPORTANT</a> point in this post.)<br/><br/>You need to get the first line of the text file before you do any loop stuff. You can use set /p to get the first line. <br/><br/>The code below appears to do what you want. <br/><br/> Code: <a>[Select]</a>echo off<br/>setlocal enabledelayedexpansion<br/><br/>REM you may not need this but<br/>REM it seemed appropriate<br/>if exist output.txt del output.txt<br/><br/>set /p firstline=<Strfile.txt<br/>FOR /F "tokens=1,2 delims=:" %%i IN ("%firstline%") DO set token1=%%i&set token2=%%j<br/>set buildline=%token1%:%token2%<br/>set teststring=%token1%<br/>FOR /F "skip=1 tokens=1,2 delims=:" %%i IN (StrFile.txt) DO (<br/> if %%i EQU !teststring! (<br/> SET buildline=!buildline!:%%j<br/> ) ELSE (<br/> ECHO !buildline!>>output.txt<br/> SET teststring=%%i<br/> SET buildline=%%i:%%j<br/> )<br/>) <br/>essentially the logic of the script is:<br/><br/>the input file has lines which follow the format part:part2. It is required, for each sequence of one or more lines starting with the same part1, to produce one line which starts with part1, then a colon, then however many part2s there are, separated by colons. The script would do something like this:<br/><br/>Look at the first line of the input file. Get part1 and part2 into separate variables. Start building the first output line using part1, a colon and part2. <br/><br/>Now, for each line after that, until the end of the input file is reached:<br/><br/>Get part1 and part2 into separate variables. Check if part1 has changed since the previously read input line. If it has not changed, add a colon and part2 to the output line. If part1 has changed, write the output line to the output file in append mode, and then start a new output line using the new part1, a colon and part2.<br/>OP , get a good file processing tool like<a href="http://gnuwin32.sourceforge.net/packages/gawk.htm"> gawk (for windows)</a>, and use this one liner<br/><br/> Code: <a>[Select]</a>c:\> gawk -F":" "{a[$1]=a[$1]\":\"$2}END{for(i in a) print i a[i]}" file<br/>ABC32346:2123333<br/>ABC22345:0012121:0021212<br/>ABC12345:0000121:0000122:0000123<br/>ABC32345:1212123<br/><br/>Of course, if you have Perl/Python, they can do the job with ease as well.<br/>I made a typo before.<br/><br/>essentially the logic of the script is:<br/><br/>the input file has lines which follow the format part1:part2. It is required, for each sequence of one or more lines starting with the same part1, to produce one line which starts with part1, then a colon, then however many part2s there are, separated by colons. The script would do something like this:<br/><br/>Look at the first line of the input file. Get part1 and part2 into separate variables. Start building the first output line using part1, a colon and part2.<br/><br/>Now, for each line after that, until the end of the input file is reached:<br/><br/>Get part1 and part2 into separate variables. Check if part1 has changed since the previously read input line. If it has not changed, add a colon and part2 to the output line. If part1 has changed, write the output line to the output file in append mode, and then start a new output line using the new part1, a colon and part2.They say pride comes before a fall - and I was so concerned with delivering a lecture that I didn't see that my code has one big flaw, namely that it only outputs a line when the first part of the input line changes. if an input file just consists of one line, or of multiple lines with the same first part, then it would never output anything. This should be a lesson to me. I will fix it it tomorrow. because we are just now going to watch a film, "Villa Amalia" with Isabelle Huppert. And drink some red wine.<br/><br/> Code: <a>[Select]</a><br/>Echo Off<br/>Setlocal Enabledelayedexpansion<br/>Set True=1<br/>Set False=0<br/>If Exist Output.Txt Del Output.Txt<br/><br/>Set /P Firstline=<Strfile.Txt<br/><br/>For /F "Tokens=1,2 Delims=:" %%I In ("%Firstline%") Do (<br/> Set Part1=%%I<br/> Set Part2=%%J<br/> )<br/><br/>Set Buildline=%Part1%:%Part2%<br/>Set Teststring=%Part1%<br/>Set Writeflag=%False%<br/>Set Changed=%False%<br/><br/>For /F "Skip=1 Tokens=1,2 Delims=:" %%I In (Strfile.Txt) Do (<br/> Set Part1=%%I<br/> Set Part2=%%J<br/> If Not !Part1! Equ !Teststring! Set Changed=%True%<br/> If !Changed! Equ %True% (<br/> Echo !Buildline!>>Output.Txt<br/> Set Teststring=!Part1!<br/> Set Buildline=!Part1!:!Part2!<br/> Set Writeflag=%True%<br/> Set Changed=%False%<br/> ) Else (<br/> Set Buildline=!Buildline!:!Part2!<br/> Set Writeflag=%False%<br/> )<br/>) <br/> <br/>If %Writeflag% Equ %False% Echo !Buildline!>>Output.Txt<br/><br/>Echo.<br/>Echo Input File:<br/>Type Strfile.Txt<br/>Echo.<br/>Echo Output File:<br/>Type Output.Txt<br/>Echo.<br/>Pause<br/><br/>here's my output<br/><br/> Code: <a>[Select]</a>C:\test>test.bat<br/><br/>Input File:<br/>ABC12345:0000121<br/>ABC12345:0000122<br/>ABC12345:0000123<br/>ABC22345:0012121<br/>ABC22345:0021212<br/>ABC32345:1212123<br/>ABC32346:2123333<br/><br/>Output File:<br/>ABC12345:0000121:0000122:0000123<br/>ABC22345:0012121:0021212<br/>ABC32345:1212123<br/><br/>ABC32346:2123333 is missing.. or what have i done wrong?Thanks Man!<br/><br/>Your guidance will be appreciated. Thank you!<br/>Since I am not good at programing.... it took some time to understand the code...kekek<br/><br/></p></body></html> | |
143. |
Solve : batch file editing itself help.? |
Answer» <html><body><p>Ok so I want to have a batch file on my computer that when run it copies all the files from one location to another as a form of backup.<br/><br/>I can easily accomplish this with xcopy and it's attributes. I then plan to have this batch file run via window's scheduled tasks.<br/><br/>My problem is that I want the batch file to only copy files and folders changed since the last time the batch file was run. I know I would use the /d:mm-dd-yyyy attribute to do this. The problem is I am having trouble wrapping my head around how to have the batch file edit itself to change the date it was last run. I was originally trying to have it overwrite itself with echo but the problem is that if I do that it will eventually run out...<br/><br/>How do I get a batch file to edit one little part of itself?<br/><br/>thanks, sharfUse schtasks to schedule the batch file<br/><br/>C:> schtasks /?<br/><br/>for the options and directionssharf, you don't have to have the batch file edit itself. Just get it, after running xcopy, to write the date to a named text file in the same folder, overwriting the old version (if it is present) and then next time it is run it picks the previous run date from that file, and uses it for the xcopy command, and then writes the new date to that file, ready for the next time. <br/><br/>Ignore marvinengland who has (once again!) misunderstood the question.<br/>Then what do I do to write/get the file?Or you could get a batch to <a href="https://interviewquestions.tuteehub.com/tag/replace-karana-ka-sharatakata-622250" style="font-weight:bold;" target="_blank" title="Click to know more about REPLACE">REPLACE</a> its own first line using FOR like this<br/><br/> Code: <a>[Select]</a>set DateAndTime=26/06/2010-21:14:00.31<br/>echo off<br/>set thisbatchname=%~nx0<br/>echo old date and time %DateAndTime%<br/>pause<br/>echo set DateAndTime=%date%-%time%>newfile.txt<br/>for /f "skip=1 delims=" %%L in (%thisbatchname%) do (<br/> echo %%L>>newfile.txt<br/> )<br/>move /y "%thisbatchname%" "tempname.bat" & ren "newfile.txt" "%thisbatchname%" & del "tempname.bat"<br/><br/> Quote from: sharf on June 26, 2010, 02:00:24 PM</p><blockquote>Then what do I do to write/get the file?<br/></blockquote> <br/>I do not know what your local date format is, but basically you can do it like this<br/><br/> Code: <a>[Select]</a>echo off<br/><br/>REM write<br/>set today=%date%<br/>echo %today%>old-date.txt<br/><br/>REM read<br/>set /p olddate=<old-date.txt<br/>echo the old date was %olddate%<br/><br/><br/><br/><br/>Yeah...I'm not that fantastic at batch files...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> more than the basic stuff with them.<br/><br/>What I want is a batch file to do this:<br/>It will be in local disk C: named backup.bat<br/><br/>Then...<br/> Code: <a>[Select]</a>xcopy C:\ D:\ /D:06-25-2010/K/H/R/Y/E/V/S/Exclude:C:\Windows\<br/>And that will be run every friday by task schedular. The problem is, I don't want it to waste time copying files that have already been copied and have not been changed since the last backup. This is why I want the batch file (or something else) to keep track of the date (which is in MM-DD-YYYY format) but I don't know how to go about doing this...I kind of understand what you said, can you explain it a little clearer in terms of my batch file?<br/><br/>Thanks a lot, sharfthis should work (note i have not tested this )<br/><br/> Code: <a>[Select]</a>echo off<br/>if not exist lastrun.txt goto copy<br/>for /f "tokens=1-3" %%a in (lastrun.txt) do (<br/>set OMM=%%a<br/>set ODD=%%b<br/>set OYY=%%c<br/>)<br/>set DD=%date:~7,2%<br/>set MM=%date:~4,2%<br/>set YY=%date:~10,4%<br/>if %YY% <a href="https://interviewquestions.tuteehub.com/tag/lss-537887" style="font-weight:bold;" target="_blank" title="Click to know more about LSS">LSS</a> %OYY% goto exit<br/>if %MM% LSS %OMM% if %YY% GTR %OYY% goto copy<br/>if %MM% GTR %OMM% goto copy<br/>if %MM% EQU %OMM% if %DD% GTR %ODD% goto copy<br/>goto exit<br/>:copy<br/>echo.%MM% %DD% %YY% > lastrun.txt<br/>xcopy C:\ D:\ /D:%MM%-%DD%-%YY% /K /H /R /Y /E /V /S /Exclude:C:\Windows\<br/>:exit<br/>exitlol it just tries to start and shuts down (after creating lastrun.text) which is blank.On its first run lastrun.txt won't exist so it will go to the :copy label, but it won't know the values of %MM% %DD% %YY% which are defined after the goto, so the /D: parameter wiull be blank so the xcopy command will crash<br/><br/><br/> Quote<blockquote>note i have not tested this</blockquote> <br/>Indeed.<br/><br/>Does it every time though.Please show what you get when you type this at the command prompt<br/><br/> Code: <a>[Select]</a>echo %date%fixed it<br/> Code: <a>[Select]</a>echo off<br/>if not exist lastrun.txt goto copy<br/>for /f "tokens=1-3" %%a in (lastrun.txt) do (<br/>set OMM=%%a<br/>set ODD=%%b<br/>set OYY=%%c<br/>)<br/>set DD=%date:~7,2%<br/>set MM=%date:~4,2%<br/>set YY=%date:~10,4%<br/>if %YY% LSS %OYY% goto exit<br/>if %MM% LSS %OMM% if %YY% GTR %OYY% goto copy<br/>if %MM% GTR %OMM% goto copy<br/>if %MM% EQU %OMM% if %DD% GTR %ODD% goto copy<br/>goto exit<br/>:copy<br/>set DD=%date:~7,2%<br/>set MM=%date:~4,2%<br/>set YY=%date:~10,4%<br/>echo.%MM% %DD% %YY% > lastrun.txt<br/>xcopy C:\ D:\ /D:%MM%-%DD%-%YY%/K/H/R/Y/E/V/S/Exclude:C:\windows\<br/>pause<br/>:exit<br/>exit<br/>Even "fixed" it still does the same thing.<br/><br/>When I echo date I get "Sun 06/27/2010"I am not <a href="https://interviewquestions.tuteehub.com/tag/sure-656539" style="font-weight:bold;" target="_blank" title="Click to know more about SURE">SURE</a> why you need all this stuff. I don't think it does anything <a href="https://interviewquestions.tuteehub.com/tag/useful-1441152" style="font-weight:bold;" target="_blank" title="Click to know more about USEFUL">USEFUL</a>. In any case the %OMM% %ODD% %OYY% variables aren't actually used for anything. <br/><br/> Code: <a>[Select]</a>if %YY% LSS %OYY% goto exit<br/>if %MM% LSS %OMM% if %YY% GTR %OYY% goto copy<br/>if %MM% GTR %OMM% goto copy<br/>if %MM% EQU %OMM% if %DD% GTR %ODD% goto copy<br/>As the script stands, the first time it is run, lastrun.txt does not exist, so the batch writes todays' month, day and year values into lastrun.txt. Then it uses those same values (!) for xcopy's "copy files newer than" date. When it is run later, the lastrun.txt exists, and the earlier date is read, but is not used for anything.<br/><br/>Why don't you just create a starter lastrun.txt in Notepad, with a suitable date earlier than now, e.g. <br/><br/>06-25-2010<br/><br/>and save it in the folder where the batch script is<br/><br/>then just use this<br/><br/> Code: <a>[Select]</a>echo off<br/>for /f "tokens=1-3 delims=" %%a in (lastrun.txt) do set lastdate=%%a<br/>xcopy C:\ D:\ /D:%lastdate%/K/H/R/Y/E/V/S/Exclude:C:\windows\<br/>set DD=%date:~7,2%<br/>set MM=%date:~4,2%<br/>set YY=%date:~10,4%<br/>echo %MM%-%DD%-%YY%>lastrun.txt<br/></body></html> | |
144. |
Solve : vbscript or powershell?? |
Answer» <html><body><p>HI all,<br/><br/>I have recently been <a href="https://interviewquestions.tuteehub.com/tag/introduced-1050404" style="font-weight:bold;" target="_blank" title="Click to know more about INTRODUCED">INTRODUCED</a> to scripting and was wondering, which would be more advantageous to learn?<br/><br/>I am <a href="https://interviewquestions.tuteehub.com/tag/aware-889709" style="font-weight:bold;" target="_blank" title="Click to know more about AWARE">AWARE</a> that you can run vbscripts in powershell.<br/><br/>Thanks<br/><br/><a href="https://interviewquestions.tuteehub.com/tag/vbscript-723283" style="font-weight:bold;" target="_blank" title="Click to know more about VBSCRIPT">VBSCRIPT</a> is available from win9x. powershell is newer. what ever it is, learn both. Quote from: veloce77 on June <a href="https://interviewquestions.tuteehub.com/tag/23-243769" style="font-weight:bold;" target="_blank" title="Click to know more about 23">23</a>, 2010, 09:25:56 AM</p><blockquote>HI all,<br/><br/>I have recently been introduced to scripting and was wondering, which would be more advantageous to learn?<br/><br/>I am aware that you can run vbscripts in powershell.<br/><br/>Thanks<br/><br/><br/></blockquote> <br/>For me, Powershell is a lot easier to understand than VBScript. Plus, powershell is <a href="https://interviewquestions.tuteehub.com/tag/probably-1167177" style="font-weight:bold;" target="_blank" title="Click to know more about PROBABLY">PROBABLY</a> looking to replace a lot of the functions that batch/vbs stand for so newer technology is always good to learn.thanks for all responses guys</body></html> | |
145. |
Solve : Create a PDF File in FileMaker? |
Answer» <html><body><p>I'm looking for DOS code to create a PDF in FileMaker<br/><br/>Any help will be very much appreciated!<br/><br/>Amram Chayim eirinbergWhat <a href="https://interviewquestions.tuteehub.com/tag/version-1444891" style="font-weight:bold;" target="_blank" title="Click to know more about VERSION">VERSION</a> of FileMaker are you running? Quote from: Amram Chayim Eirinberg 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> 25, 2010, 05:14:20 AM</p><blockquote>I'm looking for DOS code to create a PDF in FileMaker<br/><br/>Any help will be very much appreciated!<br/><br/>Amram Chayim eirinberg<br/></blockquote> <br/>C:\test&<a href="https://interviewquestions.tuteehub.com/tag/gt-249387" style="font-weight:bold;" target="_blank" title="Click to know more about GT">GT</a>;type ab.bat<br/> Code: <a>[Select]</a>echo off<br/>"C:\Program Files\Adobe\Reader 9.0\Reader\AcroRd32.exe"<br/>C:\test>ab.bat<br/>C:\test> <br/> <br/> marvin/bill/greg,<br/>OP says "create", not read. <a href="https://interviewquestions.tuteehub.com/tag/acrobat-367049" style="font-weight:bold;" target="_blank" title="Click to know more about ACROBAT">ACROBAT</a> reader, does not create PDF. it just enable you to read <a href="https://interviewquestions.tuteehub.com/tag/pdfs-2211121" style="font-weight:bold;" target="_blank" title="Click to know more about PDFS">PDFS</a>.marvin I appreciated your help, but as ghostdog74 said I need to "create" a PDF based on a FileMaker record. Quote from: macdad- on June 25, 2010, 05:55:06 AM<blockquote>What version of FileMaker are you running?<br/></blockquote> <br/>macdad- I am using FileMaker11, Apparently there's a bug and you cannot create PDFs in FileMaker11 to be saved on a Network server.I found out that it isn't possible to create a PDF in FileMaker from command-line.Thanks macdad-<br/></body></html> | |
146. |
Solve : batch file best for repeated text entry?? |
Answer» <html><body><p>I would like to use a hot key to <a href="https://interviewquestions.tuteehub.com/tag/enter-446119" style="font-weight:bold;" target="_blank" title="Click to know more about ENTER">ENTER</a> the <a href="https://interviewquestions.tuteehub.com/tag/following-463335" style="font-weight:bold;" target="_blank" title="Click to know more about FOLLOWING">FOLLOWING</a> code into a forum post message box. Would a batch file be the way to do it? If so, what is the code? <br/><br/> Code: <a>[Select]</a>[table bgcolor=lightgreen width=600 height=300 style="border:5px double darkblue"][tr][td ][color=black]<br/><br/>my text here<br/><br/>[/color][/td][/tr][/table]<br/>My objective is to <a href="https://interviewquestions.tuteehub.com/tag/easily-964537" style="font-weight:bold;" target="_blank" title="Click to know more about EASILY">EASILY</a> use different backgrounds for my posts. This code does work in other forums. I didn't know if it would be inappropriate to use it here, so I didn't.<br/><br/>Batch wouldn't be the way to do it. I suggest getting a program called <a href="http://www.autohotkey.com">AutoHotkey</a>.<br/><br/>For example, all you have to do is modify this code and save it as a .AHK file (after you've installed AutoHotkey).<br/><br/>;This code will insert text when you press WIN+Q<br/>#q::<br/>send LINE 1 {ENTER} ; {ENTER} creates a new line<br/>send LINE 2 {ENTER}<br/>send [TESTING] {Enter} ; Just watch what you put in between brackets (especially curly ones like { )<br/>return<br/><br/>Double-Click the newly-created AHK file and when you're ready, press WIN+Q to <a href="https://interviewquestions.tuteehub.com/tag/activate-848037" style="font-weight:bold;" target="_blank" title="Click to know more about ACTIVATE">ACTIVATE</a> the commands.</p></body></html> | |
147. |
Solve : Organizing files by filename into separate folders? |
Answer» <html><body><p>Any help on this issue would be greatly appreciated. I have been running 100s of tests on a <a href="https://interviewquestions.tuteehub.com/tag/product-25523" style="font-weight:bold;" target="_blank" title="Click to know more about PRODUCT">PRODUCT</a> and the results end up in one folder.<br/><br/>The results are stored with the <a href="https://interviewquestions.tuteehub.com/tag/file-11330" style="font-weight:bold;" target="_blank" title="Click to know more about FILE">FILE</a> name Test_Report["Part <a href="https://interviewquestions.tuteehub.com/tag/number-238005" style="font-weight:bold;" target="_blank" title="Click to know more about NUMBER">NUMBER</a>"]["Time of test"]["Date of test"].html<br/><br/>I want to make a batch file that will organize the reports by part number into folders labeled with the part number and date. The part numbers range from 6 numbers to a combination of letters, symbols and numbers up to 15 characters long. <br/><br/>If you can help that would be awesome.is there any characters Part Number,Time of test, and Date of test<br/><br/><br/>ex <br/>Part Number-Time of test-Date of testJust those brackets<br/><br/>An example would be:<br/><br/>Test_Report[53010N0-10SD-00][6 15 11 AM][7 1 2010].htmlWill there ever be report files which have the same part number but different dates?<br/>Yes that is possible, so the batch file will have to look at both the date and part number to <a href="https://interviewquestions.tuteehub.com/tag/sort-238033" style="font-weight:bold;" target="_blank" title="Click to know more about SORT">SORT</a> it properly. I hadn't thought of that, thanks for bringing it to my attentionSo if these files existed<br/><br/>Test_Report[53010N0-10SD-00][6 15 11 AM][7 1 2010].html<br/><br/>Test_Report[53010N0-10SD-00][6 15 11 AM][6 30 2010].html<br/><br/>You would want them in 2 separate folders, called<br/><br/>53010N0-10SD-00 7 1 2010<br/><br/>and<br/><br/>53010N0-10SD-00 6 30 2010<br/><br/>is that right?<br/><br/>Any padding ( e.g. m d yyyy to mm dd yyyy) or desires about white space (e.g. convert to dashes?)<br/><br/>Yes that is exactly what I want. The same formatting of the date is fine. Maybe the date can be inside brackets to not get confused with the part number Code: <a>[Select]</a>echo off<br/>setlocal enabledelayedexpansion<br/>for /f "delims=" %%A in ('dir /b Test_Report[*.html') do (<br/> set filename=%%A<br/> for /f "tokens=1-4 delims=[]" %%B in ("!filename!") do (<br/> set FolderName=%%C (%%E^)<br/> if not exist "!FolderName!" md "!FolderName!"<br/> move "!filename!" "!foldername!"<br/> )<br/> )<br/>echo All files processed <br/>pause<br/><br/> Thank you so much! It <a href="https://interviewquestions.tuteehub.com/tag/workedralvaja-3284364" style="font-weight:bold;" target="_blank" title="Click to know more about WORKED">WORKED</a> like a charm. You just saved me from manually sorting through 500+ files</p></body></html> | |
148. |
Solve : Any Real Tutorial for DOS/BATCH? |
Answer» <html><body><p>Hello,<br/> first post in this forum: although i h' learn't a little bit of <a href="https://interviewquestions.tuteehub.com/tag/dos-432778" style="font-weight:bold;" target="_blank" title="Click to know more about DOS">DOS</a> and making bat files (still practicing/using in Virtual <a href="https://interviewquestions.tuteehub.com/tag/box-401352" style="font-weight:bold;" target="_blank" title="Click to know more about BOX">BOX</a>): and its not too hard finding Tutorial's for BAT and DOS cmds. <br/> <br/> But i just wanted some pointers from experienced DOS Users a sure and quick method to learn making BAT and DOS cmds ( i know only a fraction of DOS cmd's ) i really want to learn to use the switches/parameters that are necessary for making BAT files. Its would be a great help. <br/> <br/>This command will transfer the batch file to the users startup folder where %username% is a username variable that the batch file will work out and all you have to do is change "file-name.bat to the name of your batch file<br/><br/>copy "file-name.bat" "%systemdrive%\users\%username%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"or<br/><br/> Code: <a>[Select]</a><br/>copy %0.bat "%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup"<br/><br/><br/>Which will actually work if the users profile folder is on another drive such as a second partition or a drive as well as in a networked environment where the profile folder is often mapped to a network drive.<br/><br/>Either way, it seems completely irrelevant to what the original post was requesting. <br/><br/><br/>Floppyman: Personally, my first forays into batch were with MS-DOS 3.21 and a <a href="https://interviewquestions.tuteehub.com/tag/relatively-621723" style="font-weight:bold;" target="_blank" title="Click to know more about RELATIVELY">RELATIVELY</a> ancient book "running MS-DOS" which thankfully was "updated and revised to include the new MS-DOS 3.21!". I've later learned there are versions of the book for DOS 5 and 6 as well by the same author- revisions, I imagine.<br/><br/>After that, it was simply building upon what I already knew- shortly after I was able to get a copy of DOS 6, and I learned about the various new command switches; for example, dir, in DOS 3.21, only had the /w switch, so it was quite a lesson to learn how to sort a directory listing based on filename- iirc something like "dir | sort /+16" which sorted starting at the 16-th <a href="https://interviewquestions.tuteehub.com/tag/column-239247" style="font-weight:bold;" target="_blank" title="Click to know more about COLUMN">COLUMN</a>; but after they added the various /o (sorting) switches to DOS it became essentially a built-in feature. These new features were well documented in a small help program that DOS installed in C:\DOS- "help.exe" (or maybe it was help.com) whatever it was, it was a early text-based hypertext document that listed all the various commands and their syntax as well as config.sys commands (rather redundant today). Nowadays, as you noted, there are a lot of sites that are dedicated to documenting various batch tricks and tips. It still better to look through the actual /? help for each command though. OK BC_Programmer: i guess their is no shortcut to it.<br/> <a href="https://interviewquestions.tuteehub.com/tag/practice-248282" style="font-weight:bold;" target="_blank" title="Click to know more about PRACTICE">PRACTICE</a> and more practice is the only thing to get more acquainted with DOS and Batch. It will take quite some time:</p></body></html> | |
149. |
Solve : Dos Print? |
Answer» <html><body><p>Hi All,<br/><br/>This is Ravi, we are buy a <a href="https://interviewquestions.tuteehub.com/tag/new-1114486" style="font-weight:bold;" target="_blank" title="Click to know more about NEW">NEW</a> computer Hp <a href="https://interviewquestions.tuteehub.com/tag/compaq-423425" style="font-weight:bold;" target="_blank" title="Click to know more about COMPAQ">COMPAQ</a> make we are using dos print but that new system doesn't have LPT port, so i have purchased LPT to USB, and also LPT slot card and installed that but still i am facing the same problem, what can i do?<br/><br/>give me suggestion please Unfortunately, DOS does not <a href="https://interviewquestions.tuteehub.com/tag/support-771795" style="font-weight:bold;" target="_blank" title="Click to know more about SUPPORT">SUPPORT</a> USB.<br/><br/>But can you provide the following information:<br/><br/>The model of the computer.<br/>The Operating System you are running.<br/><br/>Thank you,<br/>Nick(macdad-)Why are you trying to print in DOS? Do you have custom software?<br/><br/>How much do you need to print?<br/><br/>There are ways to print from DOS using USB connections. Google DOS to USB connections. But I've got to think there are other ways to do the same thing.Thanks for replay,<br/><br/>Model: Compaq Presario CQ3253IX P C.<br/>Configuration: Intel\l Core 2 duo Processor 2.93/ 2 <a href="https://interviewquestions.tuteehub.com/tag/gb-467864" style="font-weight:bold;" target="_blank" title="Click to know more about GB">GB</a> DDR3 Ram/<br/> 320 GB HDD/ DVD Writer/Compaq Key Board & Mouse/<br/> 18.5 “Compaq Monitor/ DOS. <br/>O S : Widows XP S/P2<br/>Software : EX Next Gena ration.<br/><br/>Ex next Gena ration software is Accounts software we want only Dos Prints. Quote from: rthompson80819 on June 28, 2010, 09:53:28 PM</p><blockquote>Why are you trying to print in DOS? Do you have custom software?<br/><br/>How much do you need to print?<br/><br/>There are ways to print from DOS using USB connections. Google DOS to USB connections. But I've got to think there are other ways to do the same thing.<br/></blockquote> <br/>True their are USB drivers for DOS that can <a href="https://interviewquestions.tuteehub.com/tag/allow-362909" style="font-weight:bold;" target="_blank" title="Click to know more about ALLOW">ALLOW</a> for Printing over USB.<br/><br/>And I have found a DOS utility that can redirect the DOS printing from LPT to USB:<br/><a href="http://www.dos2usb.com/">http://www.dos2usb.com/<br/></a><br/><br/>Abbarla,<br/><br/>Is the printer you are printing to use a USB port or LPT port?Is the printer you are printing to use a USB port or LPT port?<br/><br/><br/>Hi I am using USB Port..</body></html> | |
150. |
Solve : command prompt in WinfowsCE? |
Answer» <html><body><p>how do you get a <strong>command prompt </strong>(or "DOS" window) <strong>in Windows CE 4.2, 5, and 6</strong>?<br/>These are embedded systems, customized on devices during development, so a command prompt might not be available on all devices running the above versions. <br/>I hope that someone has been able to get a command prompt, and could give details of the <a href="https://interviewquestions.tuteehub.com/tag/procedure-606526" style="font-weight:bold;" target="_blank" title="Click to know more about PROCEDURE">PROCEDURE</a> and the device(s) on which that worked?<br/>Also, do you <a href="https://interviewquestions.tuteehub.com/tag/know-534065" style="font-weight:bold;" target="_blank" title="Click to know more about KNOW">KNOW</a> of a command reference for Windows CE?<br/>sorry for typo in title, not sure how to correct it?Google for Windows CE 5.0 Command Prompt<br/><br/><a href="https://social.msdn.microsoft.com/Forums/en/microsoftdeviceemu/thread/5fdac870-7a90-4760-85de-9209480b51ef">This</a> seems promising.<br/><br/>Good luck.I had googled the topic before starting the thread; what I'm focusing on here, is <strong>how to get the command prompt as a user, from within an installed WinCE device</strong> , not a a programmer doing a build (if ever possible?)<br/>I had <a href="https://interviewquestions.tuteehub.com/tag/read-619994" style="font-weight:bold;" target="_blank" title="Click to know more about READ">READ</a> on some threads that users were able to intercept the <a href="https://interviewquestions.tuteehub.com/tag/boot-251147" style="font-weight:bold;" target="_blank" title="Click to know more about BOOT">BOOT</a> process and get some of that functionality, unfortunately it was in passing, not enough details and I did not have the chance to ask further about it then.<br/>Hoping someone has done something like that; I know it may be dependent on the device so I'm interested to know which device it is possible on, and how to do it. It won't be a PC on which WinCE runs in <a href="https://interviewquestions.tuteehub.com/tag/emulation-11463" style="font-weight:bold;" target="_blank" title="Click to know more about EMULATION">EMULATION</a>; it will be a <strong>device on which WinCE was burned-in as the original OS</strong>: netbook, wifi tablet, GPS travel guide, etc.</p></body></html> | |