This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 51. |
Solve : Network inventroy? |
|
Answer» i am to doing Network inventory i want list of all .mp3, .avi , .3gp video audio FILES in my all network PC drive & folder if it is possible with dos or there is any client server OPTION??? PLS HELP me. |
|
| 52. |
Solve : Help with batch...? |
|
Answer» hello, very nice community |
|
| 53. |
Solve : Help to create a batch file? |
|
Answer» Hello |
|
| 54. |
Solve : MS DOS Batch - String Manipulation? |
|
Answer» Does anyone here have experience with modifying text files via batch? I would like to create a .BAT that can be executed via Shell Wait in MS Access 2003. The text file needs to be modified/overwritten to remove lines of text that presently represent headers/footers causing problems with MS Access import specifications. The file originates as a UNIX print spooler file that I have retrieved via ftp and saved to the Windows box as an ASCII .txt file. SUPER - I just tried it out and it worked like a CHARM! Do you know how I can use the same to incorporate special characters such as CR, LF, etc also can I include wildcards? I am not sure what you mean by this; if you filtered out lines with a CR or an LF, you'd filter out everything. If you want to replace one character (or a set of characters) with another within word or line of text that is possible e.g. set text=Mary had a little lamb; its fleece was white as snow. set text=%text:Mary=Joe% result: Joe had a little lamb; its fleece was white as snow. set text=%text:lamb=cat% result: Joe had a little cat; its fleece was white as snow. set text=%text:white=black% set text=%text:snow=coal% result: Joe had a little cat; its fleece was black as coal. as for "wildcards", that makes me think you would do well to study "regular expressions", which you can use with find's grown up brother, findstr. For heavy duty string manipulation, Visual Basic Script is probably easier to use and more efficient. you can use batch to do string manipulation but its capabilities in TERMS of string/text manipulation is primitive and full of inefficiency. for better text manipulation capabilities, use tools, such as Perl (or Python) or gawk (see my sig). you can also make use GNU tools like head /tail to remove headers/footers , Code: [Select]C:\test>more file header text1 text2 footer C:\test>tail -n +2 file | head -n -1 text1 text2 show an example of your text file, and describe the output you want.[duplicate] Quote from: Salmon Trout on February 23, 2010, 03:48:45 PM I am not sure what you mean by this; if you filtered out lines with a CR or an LF, you'd filter out everything. Good observation, I wasn't thinking CLEARLY when I mentioned the CR/LF as it relates to this FUNCTION. My thoughts are that if the I know that line of text on which the real data begins, I could somehow remove or replace the first n lines each time which would me the first n CR/LF lines would be removed and then the script would be more universally suited to apply to a variety of text files where each header/footer may contain different text. As for a Visual Basic approach I would be interested in your thoughts. I am ultimately doing this to accomodate an fix width delmitation into MS Access tables, that said I couldn't find an equivalent to InputString function VB function in VBA. Quote from: danyelle on February 24, 2010, 07:37:28 AM As for a Visual Basic approach I would be interested in your thoughts. I am ultimately doing this to accomodate an fix width delmitation into MS Access tables, that said I couldn't find an equivalent to InputString function VB function in VBA.Use the InputBox function in VBA, for example Code: [Select]DocumentName = InputBox("Document Name ?")um.. VB.NET has an InputString Function: Code: [Select]InputString(_ ByVal FileNumber As Integer, _ ByVal CharCount As Integer _ ) As String looks like it reads data from a file- InputBox does not. VBA is nearly identical to VB6 in what features it supports; so: Paste In a new module: Code: [Select]Public Function TrimFile(ByVal sFileName As String, ByVal sOutputFile As String, Optional ByVal SkipHeaderLines As Integer = 0, Optional ByVal SkipFooterLines As Integer = 0) Dim fnum As Integer Dim ftemp As Integer, temppath As String Dim textin As String Dim FoundHeadercrlf As Long, FoundFooterCrlf As Long fnum = FreeFile Open sFileName For Input As fnum ftemp = FreeFile Open sOutputFile For Output As ftemp textin = Input$(LOF(fnum), fnum) Close fnum Dim currcount As Long If SkipHeaderLines Then FoundHeadercrlf = 1 Do Until currcount = SkipHeaderLines currcount = currcount + 1 FoundHeadercrlf = InStr(FoundHeadercrlf + 1, textin, vbCrLf) Loop End If If SkipFooterLines Then FoundFooterCrlf = Len(textin) currcount = 0 Do Until currcount = SkipFooterLines currcount = currcount + 1 FoundFooterCrlf = InStrRev(textin, vbCrLf, FoundFooterCrlf - 1) Loop End If textin = Mid$(textin, FoundHeadercrlf, FoundFooterCrlf - FoundHeadercrlf) 'remove leading and trailing crlfs... Do Until Left$(textin, 2) <> vbCrLf textin = Mid$(textin, 3) Loop Do Until Right$(textin, 2) <> vbCrLf textin = Mid$(textin, 1, Len(textin) - 2) Loop Print #ftemp, textin Close #ftemp End Function In my tests this seems to do what you require, if I understand what you require, of course. basically, just call it like this: TrimFile(ByVal sFileName As String, ByVal sOutputFile As String, Optional ByVal SkipHeaderLines As Integer = 0, Optional ByVal SkipFooterLines As Integer = 0) Code: [Select]TrimFile("D:\Filename.txt","D:\output.txt", <number of header lines to skip>, <number of footer lines to skip>) remember to replace each parameter with the filenames and the number of header and footer lines you REALLY want to skip. This code should work in Access 97 and higher, so you should be fine. |
|
| 55. |
Solve : how do I change my background in DOS?? |
|
Answer» The background colour in DOS is white and the text is yellow and very difficult to read! Can anybody help?Open up the window and right click and select defaults. Look through the tabs and you will find the colour options. Quote from: edm on February 24, 2010, 04:41:32 AM The background colour in DOS is white and the text is yellow and very difficult to read! Can anybody help? lol edm. I think somebody pulled a joke on you. Here are a few examples: (Background color, Foreground (font) color) Black, Green color 0a Blue, White color 17 White, Blue color 71 Black, White color 07 Enjoy. the problem with the Color command is it isn't permanent. Changing the SELECTED Colors in the "Colors" tab From the windows System Menu's "Properties" Item is.You can make it permanent. Here's how: Start -> Run -> regedit Go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor On the right pane, double-click on the AutoRun value and fill this in: color 0a This way, no matter when the computer starts, your commandline will remain in this color (I chose black, green as an EXAMPLE (0a)). My personal values for AutoRun are: cls && cd \ && color 0a (You don't have to do that, though, it just does the FOLLOWING: clear the SCREEN, change DIRECTORY to root and color the background back and the foreground green. The && binds commands together.) =) Quote from: Treval on February 24, 2010, 03:17:04 PM You can make it permanent. Or just use the properties dialog... LoL =P The advantage of mine is you can do multiple things at the same time. =O Quote from: Treval on February 24, 2010, 03:46:08 PM LoL =PChanging the registry is not reccomended for non-experts. |
|
| 56. |
Solve : Setting a filename with spaces and extention into a variable (N00b)? |
|
Answer» Hello, I am trying to MOVE files from one directoy to another, and I seem to be failing on filenames with spaces. for /f "usebackq" %%a in (.\list.txt) do call :main %%a but the %1 variable still has only the first 'word' (up to the filename's space) Quote from: schreibman on February 22, 2010, 03:53:19 PM I tried :That would be because %# is delimited by spaces. The file name needs to be wrapped in quotes. For example: C:\Documents and Settings\My Documents\ %1=C:\Documents %2=and %3=Settings\My %4=Documents\To eliminate it from using a space as a delimiter (which is the default), try this: for /f "usebackq tokens=1 delims={" %%a in (.\list.txt) do call :main %%a After the equal sign, you can use any character that's not being used in your file name list (so don't use a left brace ({) if your list has left braces). The idea is to tell the batch NOT to use a space, as it'll use a space unless you specify otherwise (is there a way to specify a carriage-return as a delimiter?) Quote Hello, I am trying to move files from one directoy to another, and I seem to be failing on filenames with spaces. Not sure why you have a rename in your CODE, but you don't need it. This little snippet should take care of your space as delimiter and the quotes. Code: [Select]echo off for /f "tokens=* delims=" %%a in ('dir /b x:\move') do ( move "x:\move\%%~nxa" "s:\move\%%~nxa" ) Good luck. Quote from: killerb255 on February 22, 2010, 04:02:32 PM To eliminate it from using a space as a delimiter (which is the default), try this:Quote from: schreibman on February 22, 2010, 03:53:19 PM I tried :Problem is highlighted. User input is delimited by spaces, %1-??? and I don't think that can be changed. Quote from: Sidewinder on February 22, 2010, 07:40:05 PM Not sure why you have a rename in your code, Sidewinder, Cause I'm a N00B! In anycase, you "suggestion" (basically your perfect re-write!) both did the trick perfectly and educated me! Thanks so much for your help! |
|
| 57. |
Solve : how to develop a protected mode TSR under DPMI 0.9?? |
|
Answer» hello everyone , DOS protected mode interfaceSorry I can not help you. Why can you not use the 1.0 version? DPMI 1.0 Programming API Specfication http://www.delorie.com/djgpp/doc/dpmi/ I wish I could use DPMI 1.0,but there is some limit.I hate the limit.But thank you also the same.who can help me!!!!!If anybody wants to know more about this: http://en.wikipedia.org/wiki/DOS_Protected_Mode_Interface DPMI still works. But most modern programing with use DiretcX or something like that.Finally I found a way,but I can't quite UNDERSTAND it.First you should install the interrupt using function 0204h of int 31h,then keep the programe to stay resident using function 31h of int 21h.But I didn't know how to decide the size.The return code has been MADE to be zero. My question is that my TSR runs under protected mode .But the int 21h runs under real mode,can it read or wirte the memory of protected mode?Wish I knew the ANSWER. What little I have read seems to say you don't worry about it, that is what DPMI does. Here is a site that has a good but brief collection of tools for hard core low-level programming. The article does not directly cover you question, but maybe it sheds some LIGHT on what you can do with a DPMI program. http://www.thefreecountry.com/programming/dosextenders.shtml Scroll down the PAGE at take a look at CSDPMI DPMI Host. |
|
| 58. |
Solve : Get system encoding? |
|
Answer» HI, I want to KNOW the default ENCODING of my system using command prompt. Is there any way so can I get that information. What "default encoding"? Did you mean the current CODE page? If so, type chcp at the prompt. |
|
| 59. |
Solve : batch to validate password? |
|
Answer» Hello everyone |
|
| 60. |
Solve : Is there a "back" command?? |
|
Answer» I was WONDERING if you could be on one SCREEN, then type in a type of universal command (that of which I'm putting in my templates) but is there such thing as a back command, or a universal "if %input%==universalcommand goto :UNIVERSALCOMMAND". Quote from: tommyroyall on February 24, 2010, 07:48:15 PM "Is there such thing as a back command, or a universal "if %input%==universalcommand goto :UNIVERSALCOMMAND"." All loops by design "goback" to a previous place in the code when conditions are satisfied. The loop may be a For loop or a goto loop or etc . . . http://www.yourdictionary.com/computer/loop ( The following is from the above SITE. ) loop definition - computer "In programming, a repetition within a program. Whenever a process must be repeated, a loop is set up to handle it. A program has a main loop and a series of MINOR loops, which are nested within the main loop. Learning how to set up loops is what programming technique is all about." |
|
| 61. |
Solve : Tokens?? |
|
Answer» After the "for /blah blah TOKENS blah blah blah" command, what would tokens be? Are those like characters in a word or something, or pieces of stored DATA?All of your queries are not only nebulous in content but contain alot of blah blah blah... After the "for /blah blah tokens blah blah blah" command, what would tokens be? Are those like characters in a word or something, or pieces of stored data? Have you tried the /? switch on FOR YET? Quote from: tommyroyall on February 24, 2010, 07:40:08 PM After the "for /blah blah tokens blah blah blah" command, what would tokens be? Are those like characters in a word or something, or pieces of stored data? Tokens are the words of the input line. The separator ( DELIMS) may be a space or a "/" or other separators. For example: C:\>type twodate.bat Code: [Select]for /f "tokens=1-4 delims=/ " %%d in ("%date%") do echo %%f%%e%%d Output: C:\>for /F "tokens=1-4 delims=/ " %d in ("Wed 02/24/2010") do echo %f%e%d 2402Wed C:\> |
|
| 62. |
Solve : %%BLAH or %BLAH%!??!?!?? |
|
Answer» I know that %variables_have_percent_marks% but what %%is_this? is it also a variable?Take a nice long look at for /? the next time you open the command prompt...you may just learn something. Code: [Select]Microsoft Windows XP [Version 5.1.2600 my thoughts EXACTLY... not sure what is being said with that...test it in a .bat file Quote from: Prince_ on February 24, 2010, 10:58:14 PM set a=1&call echo %%a%%Quote from: Prince_ on February 25, 2010, 12:52:56 AM test it in a .bat file C:\>type a25.bat Code: [Select]echo off REM "Test it in a .bat file" set a=1&call echo %%a%% Output: C:\> a25.bat 1 C:\> Not worth bananas. Please do not waster the bananas. |
|
| 63. |
Solve : %dd% specs? |
|
Answer» Could I put something like "if %dd%==monday goto :MONDAY" or would it be different?I just checked for you: Isn't %dd% to get the day? I've used that before. C:\batch>type tezt.bat Code: [Select]echo off FOR /F "TOKENS=1* DELIMS= " %%A IN ('date /t') DO ( SET CDATE=%%B echo CDATE=%CDATE% ) pause FOR /F "TOKENS=1,2 eol=/ DELIMS=/" %%A IN ('echo %CDATE%') DO ( SET mm=%%A echo mm=%mm% ) pause FOR /F "TOKENS=1,2 DELIMS=/ eol=/" %%A IN ('echo %CDATE%') DO ( SET dd=%%B echo dd=%dd% ) FOR /F "TOKENS=2,3 DELIMS=/" %%A IN ('echo %CDATE%') DO ( SET yyyy=%%B SET date=%mm%%dd%%yyyy% echo date=%date% ) Output: C:\batch>tezt.bat CDATE=02/25/2010 Press any key to continue . . . mm=02 Press any key to continue . . . dd=25 date=02252010 C:\batch> Quote from: tommyroyall on February 24, 2010, 07:37:24 PM Could I put something like "if %dd%==monday goto :MONDAY" or would it be different? C:\batch>type tommy.bat Code: [Select]echo off set dd=%date:~0,3% echo dd=%dd% if %dd%==Mon goto monday echo Today is not monday goto eof :monday echo Hello Monday pause :eof Output: C:\batch>tommy.bat dd=Mon Hello Monday Press any key to continue . . . C:\batch> Output: C:\batch>tommy.bat dd=Thu Today is not monday C:\batch> http://www.dostips.com/DtTipsStringManipulation.php |
|
| 64. |
Solve : How do I create batch file to run on 1st Sunday of each month?? |
|
Answer» Hi! Scheduled Tasks manager provides an option to "Run on the 'first' 'Sunday' of the MonthI was thinking of an all-batch solution, but then it wouldn't run automatically, it just wouldn't do anything if it wasn't the first Sunday. The OP did mention that he was using Windows Task Manager to run his batch . . . Quote from: gregflowers on February 25, 2010, 01:38:09 PM The OP did mention that he was using Windows Task Manager to run his batch . . .I have problems reading lol. Quote from: reefshark on February 25, 2010, 10:52:18 AM I need to write a batch file that will do 'something' but only on the 1st Sunday of each month and at a specified time, say 3 AM. Use the /next option below. C:\>at /? The AT command schedules commands and programs to run on a computer at a specified time and date. The Schedule service must be running to use the AT command. AT [\\computername] [ [id] [/DELETE] | /DELETE [/YES]] AT [\\computername] time [/INTERACTIVE] [ /EVERY:date[,...] | /NEXT:date[,...]] "command" \\computername Specifies a remote computer. Commands are scheduled on the local computer if this parameter is omitted. id Is an identification number assigned to a scheduled command. /delete Cancels a scheduled command. If id is omitted, all the scheduled commands on the computer are canceled. /yes Used with cancel all jobs command when no further confirmation is desired. time Specifies the time when command is to run. /interactive ALLOWS the job to interact with the desktop of the user who is logged on at the time the job runs. /every:date[,...] Runs the command on each specified day(s) of the week or month. If date is omitted, the current day of the month is assumed. /next:date[,...] Runs the specified command on the next occurrence of the day (for example, next THURSDAY). If date is omitted, the current day of the month is assumed. "command" Is the Windows NT command, or batch program to be run. C:\> Quote from: gregflowers on February 25, 2010, 01:32:39 PM Scheduled Tasks manager provides an option to "Run on the 'first' 'Sunday' of the Month Duh, I feel real stupid now. When I was originally setting up the task, I didn't select the correct options to see that I would be able to select the 'first' Sunday of the month. But since you mentioned it, I went back and saw the option. Thanks for your help! Thank you to EVERYONE for replying! |
|
| 65. |
Solve : UMM help needed? |
|
Answer» i am a beginner to the POINT i dont know any coding at all.
echo <=====================> echo echo echo cls ping localhost -n 2 > nul echo echo echo echo <=====================> echo < {L}{O][A]D I N G > echo <=====================> echo echo echo cls ping localhost -n 2 > nul echo echo echo echo <======================> echo < {L}{O}{A][D]I N G > echo <======================> echo echo echo cls ping localhost -n 2 > nul echo echo echo echo <======================> echo < {L}{O}{A}{D] N G > echo <======================> echo echo echo cls ping localhost -n 2 > nul echo echo echo echo <======================> echo < {L}{O}{A}{D} N G > echo <======================> echo echo echo cls ping localhost -n 2 > nul echo echo echo echo <======================> echo < {L}{O}{A}{D}{I][N] G > echo <======================> echo echo echo clsif you changed the example can you post the codenot the whole thing but part( the whole thing wont fit) echo off echo echo echo echo <=====================> echo < {L} O A D I N G > echo <=====================> echo echo echo cls ping [email protected] off echo echo echo echo <=====================> echo < {L} O A D I N G > echo <=====================> echo echo echo cls ping localhost -n 2 > nul echo echo echo echo <=====================> echo < {L}
echo <=====================> echo echo echo cls ping localhost -n 2 > nul echo echo echo echo <=====================> echo < {L}{O][A]D I N G > echo <=====================> echo echo echo cls ping localhost -n 2 > nul echo echo echo echo <======================> echo < {L}{O}{A][D]I N G > echo <======================> echo echo echo cls ping localhost -n 2 > nul echo echo echo echo <======================> echo < {L}{O}{A}{D] N G > echo <======================> echo echo echo cls ping localhost -n 2 > nul echo echo echo echo <======================> echo < {L}{O}{A}{D} N G > echo <======================> echo echo echo cls ping localhost -n 2 > nul echo echo echo echo <======================> echo < {L}{O}{A}{D}{I][N] G > echo <======================> echo echo echo cls ping [email protected] off echo echo echo echo <=====================> echo < {L} O A D I N G > echo <=====================> echo echo echo cls ping localhost -n 2 > nul echo echo echo echo <=====================> echo < {L}
echo <=====================> echo echo echo cls ping localhost -n 2 > nul echo echo echo echo <=====================> echo < {L}{O][A]D I N G > echo <=====================> echo echo echo cls ping localhost -n 2 > nul echo echo echo echo <======================> echo < {L}{O}{A][D]I N G > echo <======================> echo echo echo cls ping localhost -n 2 > nul echo echo echo echo <======================> echo < {L}{O}{A}{D] N G > echo <======================> echo echo echo cls ping localhost -n 2 > nul echo echo echo echo <======================> echo < {L}{O}{A}{D} N G > echo <======================> echo echo echo cls ping localhost -n 2 > nul echo echo echo echo <======================> echo < {L}{O}{A}{D}{I][N] G > echo <======================> echo echo echo cls ping localhost -n 2 > nul echo echo echo echo <=====================> echo < {L}
echo <=====================> echo echo echo clstry this Code: [Select]echo off echo. echo. echo. echo ===================== echo {L} O A D I N G echo ===================== echo. echo. echo. cls ping localhost -n 2 > nul echo. echo. echo. echo ===================== echo {L} O A D I N G echo ===================== echo. echo. echo. cls ping localhost -n 2 > nul echo. echo. echo. echo ===================== echo {L}{O][A]D I N G echo ===================== echo. echo. echo. cls ping localhost -n 2 > nul echo. echo. echo. echo ====================== echo {L}{O}{A][D]I N G echo ====================== echo. echo. echo. cls ping localhost -n 2 > nul echo. echo. echo. echo ====================== echo {L}{O}{A}{D] N G echo ====================== echo. echo. echo. cls ping localhost -n 2 > nul echo. echo. echo. echo ====================== echo {L}{O}{A}{D} N G echo ====================== echo. echo. echo. cls ping localhost -n 2 > nul echo. echo. echo. echo ====================== echo {L}{O}{A}{D}{I][N] G echo ====================== echo. echo. echo. pause cls dont use <,> in echo untill you now a bit more p.s. dont edit a post to a response a further down post it takes longer to get helpok i wont and i see u have a . after echo do i need to add that also adot "." right after echo like this echo. make it skip a line difrence no dot with dot echo is off the dog is big the dog is big echo is off Adding a dot will prevent it from echoing "echo is off" (or on in some cases), if nothing is sent. In cases like this: set var= echo %var% The output would be "echo is off" But if a dot is added: set var= echo. %var% The output is a new line.var??? and thx Quote from: BaoBao on March 07, 2010, 06:06:10 PM var???Var is just a variable I named. For more information about variables, look at set /? on the command prompt. |
|
| 66. |
Solve : MS-DOS error handling in .bat file? |
|
Answer» I have a small .bat FILE to load a file to a SERVER. I do not know how to handle errors. I would to VALIDATE a successful LOGIN, and a successful put of the file has occurred. Can someone help in this area of need. |
|
| 67. |
Solve : How do I check if the parameter %1 exist in a batch file (IF statement)?? |
|
Answer» I tried the following batch file: Of course. Need to "define" the %1 as a string.well, not really... you could just as easily do Code: [Select]IF !%1==! EXIT It's just when it expands so there is nothing on one side, it's not a valid syntax. Quote from: viking2 on February 28, 2010, 01:27:58 PM I tried the following batch file: Quotes around "%1" worked C:\batch>type shift.bat Code: [Select]ECHO OFF :start Echo - %1 shift IF "%1"=="" exit /B pause goto start Output: C:\batch>shift.bat 1 2 3 4 - 1 Press any key to continue . . . - 2 Press any key to continue . . . - 3 Press any key to continue . . . - 4 C:\batch> p.s.: use exit /b to exit the batch and not exit the command PROMPT PAGE. |
|
| 68. |
Solve : Turbo C 3.0 reboots PC (DOS 6.22)? |
|
Answer» I have an old 486 with DOS 6.22. I DECIDED to install Turbo C 3.0. When I run Turbo C, it just cold reboots the comp with no MESSAGES or anything. The only way to make it work is by removing HIMEM.SYS. But I NEED HIMEM for my other programs and stuff. So can anyone explain why the comp reboots and how to fix it?I got it working. I added EMM386.EXE NOEMS to my config.sys. It's not perfect THOUGH. Because of this, now some of my other programs say that they need DPMI. I got CWSDPMI and so it's ok, but it annoys me that now I need extra files. |
|
| 69. |
Solve : 16 Bit MS DOS Subsystem? |
|
Answer» When I START my computer, I receive this error: |
|
| 70. |
Solve : Copy DOS Program? |
|
Answer» I have a DOS program that I run on an OLD 386 with Windows95. It is called T2Map and it converts TDS RAW data into Maptech FLD files. I have no idea where the installation disk is. I really need to get this program off of the 386 onto ANOTHER computer (WindowsXP) as it is on its last legs. However, I have no clue how to do this. I am assuming I would need to copy the files that control this program onto a floppy and put them on the other computer. However, I don't know which files to get. Thanks.Do you have a folder on the old FAILING computer which contains the T2Map program? I should certainly copy everything in that, plus any subfolders. If you replicate evrything you should be OK. |
|
| 71. |
Solve : not getting anywhere with this? |
|
Answer» I haven't much in the way of discussion about getting a firewire device to WORK in dos. That's what I am up against presently. I have tried various CODES I got from the net to RUN my external firewire hard drive; without success. With DAT.EXE I got the error message that the scsi host adapter could not be FOUND. I am using an adaptec controller. My firewire drive is IDE while my internal hdd is scsi. |
|
| 72. |
Solve : Writing Bat Command to pull Ip addresses from a Text file to run a scripted exe? |
|
Answer» Good Day everyone, |
|
| 73. |
Solve : Uninstalling hotfixes/updates? |
|
Answer» Win XP Pro SP.3 + all updates etc. The utility supports the following Setup switches:Back to report that installation and deletion of hotfixes went without a hitch. Thanks again. |
|
| 74. |
Solve : Searching for files within subdirectories? |
|
Answer» Sorry, this probably has been answered before but,
How did you create the inlist.txt file? Will you post a few of the file names that are in the inlist file? I tried to run your code but I'm not sure what is in the inlist file? ThanksI'm going to attempt to just give the entire package in a .zip. I have been WORKING out of the New Folder thats within there just to make sure that I can get it to do the primary task first (reading the list and verifying that the names in the list match the names of the files). [Saving space, attachment deleted by admin] Quote from: Grimbear13 on February 03, 2010, 12:35:02 PM I'm going to attempt to just give the entire package in a .zip. I have been working out of the New Folder thats within there just to make sure that I can get it to do the primary task first (reading the list and verifying that the names in the list match the names of the files). The zip file worked. And the batch file ran. Of course, only one file was found on my machine. ( I don't understand the need for the color change? But it worked. ) Input: Review>type inlist Roof.txt Ceiling.txt Ground.txt Floor.txt Noob.txt Beginner.txt Decent Player.txt Output: Review>type Results ts.txt Roof.txt CHECK Ceiling.txt MISSING Ground.txt MISSING Floor.txt MISSING Noob.txt MISSING Beginner.txt MISSING Roof.txt CHECK Ceiling.txt MISSING Ground.txt MISSING Floor.txt MISSING Noob.txt MISSING Beginner.txt MISSING Roof.txt CHECK Ceiling.txt MISSING Ground.txt MISSING Floor.txt MISSING Noob.txt MISSING Beginner.txt MISSING Roof.txt CHECK Ceiling.txt MISSING Ground.txt MISSING Floor.txt MISSING Noob.txt MISSING Beginner.txt MISSING C:\Documents and Settings\Bill Richardson\Desktop\QA Review\QA Review> Rem "color 0A" was REMed out. Rem "echo off" was allowed to execute to cut down on volume of output Code: [Select]echo off rem color 0A for /F "tokens=*" %%I in (inlist) do ( Call :ResetBool set filename=%%I for /R %%K in (.) do ( for %%J in (*) do ( set file=%%J Call :ValidCheck echo HAMSTERS! ) ) Call :Print ) GoTo :EOF :ValidCheck if %filename%==%file% (set bool=true) GOTO :EOF if %bool%==true (echo %filename% CHECK >> Results.txt )else (echo %filename% MISSING >> Results.txt ) GOTO:EOF :ResetBool set bool=false GoTo :EOF Grim: Your code works. The only change was to change the main for loop to local variables with "setlocal enabledelayedexpansion" ( I also placed all your files from the inlist in a subfolder called "trial" ). Code: [Select]echo off setlocal enabledelayedexpansion for /F "delims=" %%i in (inlist.txt) do ( rem Call :ResetBool set filename=%%i echo filename=!filename! for /R %%K in (.) do ( for %%J in (*) do ( set file=%%J Call :ValidCheck echo HAMSTERS! ) ) Call :Print ) GoTo :EOF :ValidCheck if %filename%==%file% (set bool=true) GOTO :EOF if %bool%==true (echo %filename% CHECK >> Results.txt )else (echo %filename% MISSING >> Results.txt ) GOTO:EOF :ResetBool set bool=false GoTo :EOF C:\Review\type results.txt Roof.txt CHECK Ceiling.txt CHECK Ground.txt CHECK Floor.txt CHECK Noob.txt CHECK Beginner.txt CHECK DecentPlayer.txt CHECK Okay, when I get some free time at work today hopefully I'll get to play around with it a bit haha. YEAH I knew the code worked on files in the directory, my issue was getting into subdirectories. I'll get back to you when I try your solution thanks for all the responses. The color change was because that's my favorite color scheme, and the echo off was commented out for debugging (as was the random "echo HAMSTERS!" in the one loop there was issues with execution of certain areas so I would put random outputs to make sure they were being executed...that one just got left it ) Thanks Again hopefully I'll be able to get back with results.Sorry for the super delayed response, but I just got a chance to try the change you suggested and my code still isn't finding any of the files in the subdirectories. I tried both my code with your change and your code by itself (which gave a strange error about not being able to find the file at first). But neither of them correctly reported that the files were there. Also if you were wondering why there were extra files within the lower subdirectories it's because after I get this first step done I'm going to have it check all file names to what's in the list to ensure there are no extra files either. Also it error's out on the Decent Players portion because of the space in the name, can you think of a way to remedy this?Figure I'll post my latest code just to verify. I broke out the nested loop because I'm trying to get it to terminate once it finds a match to save time. Else for every object it will loop through the entire package and that will take considerable amounts of time with bigger packages. Code: [Select]echo off color 0A ::The preceding line turns off screen printing and sets the text color to Bright Green. ::Created by Scott Dean ::Begins to search through the inlist file to get the names of the files. setlocal enabledelayedexpansion for /F "tokens=*" %%I in (inlist) do ( ::Calls the ResetBool function Call :ResetBool ::Sets filename equal to the value found from the inlist set filename=%%I ::Calls the two nested loops. It is broken out this way because batch files do not ::update variables until a process is terminated(not researched found by trial and error. ::Therefore when if the loops are left to run the variables are never updated and incorrect ::output will be given. Call :LoopNest ::Calls the Print function based on the bool variable's value will return MISSING or CHECK Call :Print ) GoTo :EOF ::This function checks if the filename given from the inlist matches the CURRENT file. :ValidCheck if %filename%==%file% (set bool=true) GOTO :EOF ::This function prints whether the file is missing or not. if %bool%==true (echo %filename% CHECK >> Results.txt )else (echo %filename% MISSING >> Results.txt ) GOTO:EOF ::Resets the value of the bool variable to be defaulted to false. :ResetBool set bool=false GoTo :EOF ::Pair of nested for's called from the first for loop. These go into the subdirectories ::and call the functions ValidCheck and BoolCheck. (May not go into subdirectories as of 02-08-2010) :LoopNest for /R %%K in (.) do ( for %%J in (*) do ( set file=%%J Call :ValidCheck Call :BoolCheck if %bool%==true (GOTO :EOF) ) if %bool%==true (GOTO :EOF) ) GOTO :EOF ::An attempt to break the loop cycle if the correct value is found, doesn't seem to work. :BoolCheck if %bool%==true (GOTO :EOF)when you have loops it's not really a good idea to use two colons to indicate a comment.By loops are you referring to the regions or within the loops? I don't know standards for batches and I just find it easier to type :: rather than rem. Also coming from a C (primarily C#) background I'm more comofortable with the :: beacuse its similar to the // comment. I think the constant spam of rem in the code makes it harder to read.:: within the body of the loop can cause problems, since : is really a label delimiter. the only "legitimate" comment is REM, and really that's just an internal command that does nothing. |
|
| 75. |
Solve : For loop endline deliminator? |
|
Answer» This is the current VERSION of the batch I was writing. However when it's parsing through either the file NAMES or the inlist if the file name has a space in it it is breaking it down into multiple objects, using the " " as a delim. In a for loop is there a way to make it delim at the end of a line as opposed to any white space? In a for loop is there a way to make it delim at the end of a line as opposed to any white space? In the for loop remove "tokens=* and delims=" By default the complete input line is read. for example: C:\batch>type lim.bat Code: [Select]echo off setlocal enabledelayedexpansion for /f %%i in (inList.txt) do ( set lit=MISSING echo lit = !lit! echo %%i ) Output: C:\batch> lim.bat lit = MISSING Roof.txt lit = MISSING Ceiling.txt lit = MISSING Ground.txt lit = MISSING Floor.txt lit = MISSING Noob.txt lit = MISSING Beginner.txt lit = MISSING DecentPlayer.txt Input: C:\batch>type inlist.txt Roof.txt Ceiling.txt Ground.txt Floor.txt Noob.txt Beginner.txt DecentPlayer.txt C:\batch>BillGreg, by default, delims is set to space. The program as given does not work for me in the XP command line. Quote from: Geek-9pm on March 01, 2010, 03:56:22 PM The program as given does not work for me in the XP command line.Maybe because for loops you one % sign on the command prompt. Not quite sure. Quote from: Grimbear13 on March 01, 2010, 09:53:05 AM In a for loop is there a way to make it delim at the end of a line as opposed to any white space? Post #1 is wrong. Fix with "delims=" C:\batch>type lim.bat Code: [Select]echo off setlocal enabledelayedexpansion for /f "delims=" %%i in (inList.txt) do ( echo %%i ) Output: C:\batch>lim.bat Roof.txt Ceiling.txt Ground.txt Floor.txt Noob.txt Beginner.txt DecentPlayer.txt January Snowy 02 February Rainy 15 March Sunny 25 Input: C:\batch>type inlist.txt Roof.txt Ceiling.txt Ground.txt Floor.txt Noob.txt Beginner.txt DecentPlayer.txt January Snowy 02 February Rainy 15 March Sunny 25 C:\batch> Quote from: greg on March 01, 2010, 04:23:29 PM You're welcome I'm sorry I got caught up in work yesterday and a collegue pointed out a possible issue. It wasn't the spaces in the code that were causing the issue. Whomever was naming the files that I was running this against was using an IRREGULAR dash. Even when copying the name directly it wasn't finding it. Thank You to everyone who replied. I thought that this script worked with spaces and I even checked it against an older job I did and it worked. |
|
| 76. |
Solve : cut in dos? |
|
Answer» Is there a way to cut and paste a file other than Is there a way to cut and paste a file other than the move COMMAND. Maybe it was a typo, I think he means this: cut C:\ex paste C:\file.ex Quote from: Geek-9pm on March 04, 2010, 12:23:49 AM Maybe it was a typo, I think he means this: No. He doesn't. Paste is not a DOS command. Quote No. He doesn't.But he wants it to be. Can you make a paste PROGRAM for him in your spare time? Quote from: Geek-9pm on March 04, 2010, 12:39:35 AM But he wants it to be. he wants a shorter equivalent of Code: [Select]copy C:\file.ex C:\ex del C:\ex the shorter version is using move. Thank you for the move command it works GREAT. |
|
| 77. |
Solve : xcopy syntax? |
|
Answer» I have a database folder that contains SUBFOLDERS that each contain WORD reports by office name. I want to create new FOLDERS with the PARTICULAR office name and all of its associated WORD reports using xcopy. How can I accomplish this? The hierarchy would be something LIKE folder1 > subfolder > FILES > newfolder > all same office files. WinXP using cmd command. |
|
| 78. |
Solve : creating m3u playlist with batch? |
|
Answer» Hello, I'm new here and would like to request help on my playlist. I have search but gotten IRRELEVANT topic and thus the creation of this topic. |
|
| 79. |
Solve : Create line based on filename or text? |
|
Answer» I have one .txt file and one .bat file: |
|
| 80. |
Solve : Using batch to insert picture in email body? |
|
Answer» Is there a way to WRITE a batch FILE that WOULD be automatically executed, as a part of my signature, so that it will insert a picture in the body of my EMAIL prior to sending? I've not found another way to ACCOMPLISH it, other than to manually insert it each time. |
|
| 81. |
Solve : menu driven batch in dos? |
|
Answer» Hi,
C:\batch>type crazymenu.bat Code: [Select]ECHO off cls :start ECHO. ECHO 1. Hello 1 ECHO 2. Hello 2 ECHO 'Q' to exit ECHO. set /p choice=Enter choice: rem if not '%choice%'=='' set choice=%choice:~0,1% if "%choice%"=="1" goto HELLO1 if "%choice%"=="2" goto HELLO2 if "%choice%"=="Q" goto :end ECHO "%choice%" is not valid please try again ECHO. goto start :HELLO1 ECHO HI ( in Hello1 ) goto start :HELLO2 ECHO HOLA ( in Hello2) goto start :end C:\batch> crazymenu.bat Output: 1. Hello 1 2. Hello 2 'Q' to exit Enter choice: 1 HI ( in Hello1 ) 1. Hello 1 2. Hello 2 'Q' to exit Enter choice: 2 HOLA ( in Hello2) 1. Hello 1 2. Hello 2 'Q' to exit Enter choice: q "q" is not valid please try again 1. Hello 1 2. Hello 2 'Q' to exit Enter choice: Q C:\batch> Quote from: Sidewinder on March 04, 2010, 02:06:09 PM If you are booting to DOS 6.22, the /p switch is not valid on the set statement. exactly the problem i'm having. I tried looking both of those up and haven't found any solutions...<> Another issue i'm having is whenever I've successfully booted off my USB drive into DOS, i always get asked for the current date and time. Below is an image of what I'm talking about: How do i get rid of this? Quote from: greg on March 04, 2010, 02:14:04 PM Greg, repeating your code won't work! You will know this if you ACTUALLY LOOK AT THE POSTS MADE BY PEOPLE OTHER THAN YOURSELF! Quote from: Sidewinder on March 04, 2010, 02:06:09 PM If you are booting to DOS 6.22, the /p switch is not valid on the set statement.Quote from: gonevcrazy on March 04, 2010, 04:11:26 PM Another issue i'm having is whenever I've successfully booted off my USB drive into DOS, i always get asked for the current date and time. When DOS boots up, I'm sure you know it looks for Config.sys and autoexec.bat. If DOS cannot find an autoexec.bat, it gets suspicious, and starts to doubt itself, so it asks you if it knows the correct time. short answer: create an autoexec.bat file. Anyway, regarding the original question, pure DOS doesn't have a method of accepting user input built in; however, you can fake it. if you make a batch like this: Code: [Select]echo Batch Menu Selector echo Enter your choice: echo. echo 1. Start Windows echo 2. Return to DOS and then, for each choice, you create a batch file- 1.bat, 2.bat, etc. so when they enter their choice, it starts that batch file. To segregate this stuff from the rest of the system, you could even put it in it's own folder, say, C:\menu : so C:\menu would contain menu.bat, 1.bat, 2.bat, etc for each choice. Then, if you want the menu to start automatically, you do so via autoexec.bat, by adding this to the end of the file: Code: [Select]cd \menu menu Must be brain freeze. DOS 6.22 came with a utility called choice. It only accepts a single character, but that's all you really need for this situation. Type choice /? at the command prompt for details. Date and time: check the autoexec.bat file (on the USB drive) you're using and see if those two commands are included. If so that's where the prompts are coming from. How old is this machine? The battery may be dead. Modern OSes can get the date/time from a time server...DOS is not a modern OS. Good luck. http://www.shiningstar.net/geek/html/multiconfig.html Quote from: Helpmeh on March 04, 2010, 04:35:45 PM You will know this if you actually look at the posts made by people other than yourself. Thanks for the tip "Helpme" I have now looked at the complete thread for a solution by "Helpme" and cannot find it. Did "Helpme" post the solution in another thread? Did the solution by Sidewinder work? (answer.com and input.com)? Quote from: Sidewinder on March 04, 2010, 05:04:11 PM Must be brain freeze. forgot about that myself as well. so it can be done in a single batch file... I don't know if I REMEMBER choice syntax perfectly, but here goes: Code: [Select]:showmenu cls echo Batch Menu echo Please enter a choice echo. echo A. Choice Number 1 echo B. Choice Number 2 echo C. Choice Number 3 echo. choice /c:ABC if ERRORLEVEL 3 GOTO CHOICEC if ERRORLEVEL 2 GOTO CHOICEB if ERRORLEVEL 1 GOTO CHOICEA goto showmenu :CHOICEA echo this would be choice A pause :CHOICEB echo this would be choice B pause :CHOICEC echo this would be choice C pause Thanks for the replies...I ended up REFORMATTING my USB dirive and put windows 98SE bootdisk on it and the date issue went away. As for the my original question...still no dice. "Choice /?" comes back with "Bad File or Command". I'm thinking during my creation of boot disk (I used HP Disk Storage Format Tool along with Windows98SE.img from bootdisk.com) that it only installs command.exe and some other files, enough to get it up and running, but none of the bells and whistles. BC_Programmer: thanks...pretty hairy workaround...I'll give it a shot Quote from: gonevcrazy on March 04, 2010, 05:10:06 PM Thanks for the replies...I ended up reformatting my USB dirive and put windows 98SE bootdisk on it and the date issue went away. Oh, wait a MINUTE here... the Windows98 Boot disk is not a actual DOS installation, so it doesn't contain All of the necessary DOS files. for example, in my virtual Machine running DOS 6.22, my DOS folder is slightly LARGER then 5MB, which wouldn't fit on a floppy disk. the boot disk just contains the "important" stuff. Quote from: BC_Programmer on March 04, 2010, 05:16:35 PM Oh, wait a minute here... Yah it's beginning to dawn on me that my goal can't be reached via booting off the USB drive due to the fact that it's only used to boot and doesn't contain any of the extra tools like a full DOS 6.22 would have. fyi before WIN98SE boot, I used DOS6.22 boot from bootdisk.com to construct my USB drive. I guess my follow-up question would be could I copy/paste those files (i.e. CHOICE.EXE or FDISK.EXE, for sake of example) onto my USB drive and run 'em like I would a command? |
|
| 82. |
Solve : DOS Job Streams randomly "freezes" during execution? |
|
Answer» What would cause DOS batch job streams (that have been running successfully for ages) to randomly "freeze" between job steps or called subroutines or to totally skip over one or more commands?? What would cause DOS batch job streams (that have been running successfully for ages) to randomly "freeze" between job steps or called subroutines or to totally skip over one or more commands?? Malware eating up your RAM? Processes running that did not SHUT down on time? Clean the machine more often. Temp files might be too large? Good Luck Quote from: R_Michael on March 04, 2010, 10:04:07 AM What would cause DOS batch job streams (that have been running successfully for ages) to randomly "freeze" between job steps or called subroutines or to totally skip over one or more commands??Are you seeing any errors in the original run? |
|
| 83. |
Solve : Is possible to direct access MS-DOS from Win7?? |
|
Answer» Hi! |
|
| 84. |
Solve : store xml markup as a var...? |
|
Answer» Hey, echo offCode: [Select]echo off more /e +6 "%~f0">"%TEMP%\Wireless Network Connection-NETGEAR.xml" netsh wlan add profile filename=”%TEMP%\Wireless Network Connection-NETGEAR.xml” del /f "%TEMP%\Wireless Network Connection-NETGEAR.xml" goto :eof <?xml version="1.0"?> <WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1"> <name>NETGEAR</name> <SSIDConfig> <SSID> <hex>4E455447454152</hex> <name>NETGEAR</name> </SSID> <nonBroadcast>false</nonBroadcast> </SSIDConfig> <connectionType>ESS</connectionType> <connectionMode>auto</connectionMode> <autoSwitch>true</autoSwitch> <MSM> <security> <authEncryption> <authentication>shared</authentication> <encryption>WEP</encryption> <useOneX>false</useOneX> </authEncryption> <sharedKey> <keyType>networkKey</keyType> <protected>true</protected> <keyMaterial>01000000D08C9DDF0115D1118C7A00C04FC297E B01000000A9CCD0C3AF3D9B408C3844D92C63BD 278000000002088000000003660000A80000001 0000000EB34D699AFE53210DA74B177A8F16C77 0000000004800000A0000000100000001281B80 A3F56BE1B8FF0104FB320C7908000000F4120C6 EE4A560461400000876D1BA154CFF7117A5587D 43EC154AC3DAA81B7B</keyMaterial> </sharedKey> </security> </MSM> </WLANProfile> |
|
| 85. |
Solve : DOS script to read a text file? |
|
Answer» Hi For eg. I have the 1st line in the text as abcd :1234 C:\>type seven.bat Code: [Select]echo off setlocal enabledelayedexpansion for /f "delims=" %%i in (seven.txt) do ( echo %%i set seven=%%i set seven=!seven:~6,4! echo seven = !seven! echo seven > !seven!.txt dir !seven!.txt ) Output: C:\> seven.bat abcd :1234 seven = 1234 Volume in drive C has no label. Volume Serial Number is F4A3-D6B3 Directory of C:\ 03/02/2010 07:24 PM 8 1234.txt 1 File(s) 8 bytes 0 Dir(s) 299,228,622,848 bytes free C:\> Input: C:\>type seven.txt abcd :1234 C:\> reference: http://www.dostips.com/DtTipsStringManipulation.php#Snippets.RightString Quote from: dos_help on March 02, 2010, 05:02:12 PM I am using for/f statement and i am not able to extract the 7th character.use for loop with variable %%a, set delims=":" , tokens=1,2 , then get %%b inside the for loop Quote from: dos_help on March 02, 2010, 05:02:12 PM I need a batch file to read the 1st line in a text and save that as another text file. C:\>type ghost32.bat Code: [Select]echo off setlocal enabledelayedexpansion for /f "tokens=1,2 delims=:" %%a in (seven.txt) do ( echo %%a %%b set seven=%%b echo seven = !seven! echo seven > "!seven!.txt" dir "!seven!.txt" ) rem use for loop with variable %%a, set delims=":" , tokens=1,2 , rem then get %%b inside the for loop Output: C:\> ghost32.bat abcd 1234 seven = 1234 Volume in drive C has no label. Volume Serial Number is F4A3-D6B3 Directory of C:\ 03/02/2010 08:35 PM 8 1234 .txt 1 File(s) 8 bytes C:\> Quote from: dos_help on March 02, 2010, 05:02:12 PM I need a batch file to read the 1st line in a text and save that as another text file. C:\>type sed32.bat Code: [Select]echo off sed s/"abcd :1234"/1234/g seven.txt 1> seven7.txt set /p seven=<seven7.txt echo seven=%seven% type seven7.txt echo Hello > %seven%.txt dir "%seven%.txt" Output: C:\>sed32.bat seven=1234 1234 Volume in drive C has no label. Volume Serial Number is F4A3-D6B3 Directory of C:\ 03/02/2010 08:35 PM 8 1234 .txt 1 File(s) 8 bytes 0 Dir(s) 299,224,727,552 bytes free C:\>this looks so familar, greg = bill ? Quote from: ghostdog74 on March 02, 2010, 09:07:46 PM this looks so familar, greg = bill ? he goes by MANY names, apparently. Quote from: BC_Programmer on March 02, 2010, 09:24:38 PM he goes by many names, apparently.i wonder why he has so many names. did he get banned everytime? Quote from: dos_help on March 02, 2010, 05:02:12 PM I need a batch file to read the 1st line in a text and save that as another text file. I'm sorry your thread has veered of topic. I hope you have enough information to solve your problem. Off topic posts should use PRIVATE mail. Good luck Quote from: ghostdog74 on March 02, 2010, 09:31:19 PM i wonder why he has so many names. did he get banned everytime?I think so. He's used so many accounts so far, there's no real difference here. Quote from: Helpmeh on March 03, 2010, 03:47:47 PM He's used so many accounts so far, there's no real difference here. Off topic comments should be sent by private mail. p.s.: BillRichardson's account is still ACTIVE. Summary - BillRichardson Picture/Text Name: BillRichardson Posts: 194 (2.694 per day) Position: Intermediate Thanked: 15 Date Registered: December 21, 2009, 08:19:08 AM -------------------------------------------------------------------------------- There APPEARS to be no reason for a ban. |
|
| 86. |
Solve : Using Batch file to QUERY registry data? |
|
Answer» Hi there, The %%k token will have the version number, the value of which can be persisted by setting a variable to the value of the %%k temporary token. Your going way past my level here! :-) Can you explain a bit further though, as I really would like to understand how to go that next step and setup the variable - would I use 'IF / ELSE'? Code: [Select]echo off reg query hklm\software\trendmicro\pc-cillinntcorp\currentversion\misc /v programver if errorlevel 1 goto three for /f "tokens=3" %%i in ('reg query hklm\software\trendmicro\pc-cillinntcorp\currentversion\misc /v programver') do ( if %%i equ 5.58 goto one if %%i equ 8.0 goto two if %%i equ 10.0 goto five goto three ) :one start /wait ".\5.53\cmnunins.exe" goto four :two start /wait ".\8.0\cmnunins.exe" goto four :three start /wait ".\10.0\msiexec /a osce10.msi /forcerestart" exit :four start c:\windows\rundll.exe user.exe,exitwindowsexec exit :five :: need to add in a del command for the file in the startup menu exit Based on your original code, I came up with this. I added an extra reg query so the batch file would not error out before it got to the for instruction. You might want to change the target of the goto. If you run the reg query from the prompt, you'll notice that the version is in the third chunk of data on the last line. I simply skipped the other lines (including the blanks) and extracted the version to do the compares. Run for /? at the prompt for a detailed explanation. The DIRECTORY in :one (5.53) does not match the if statement (5.58). Is there a reason for this? After uninstalling an older version, why are you skipping over :three and not installing the latest and greatest version? Just curious. Quote from: Sidewinder on March 02, 2010, 11:36:21 AM Where are you getting all those reg query switches from? According to reg query /?, the only switches available are /v, /ve and /s. The switches he is using were added starting with Windows Vista: Quote REG QUERY KeyName [/v [ValueName] | /ve] [/s] However, they are listing their OS as XP, which probably explains the error message regarding Too many parameters they got in their original code. |
|
| 87. |
Solve : Can't run dos from Hdd?? |
|
Answer» Ok so a few weeks ago i pulled out my dads OLD compaq presario 433. I turned it on and it said he doesn't have to remake it if it is already under 2 GB just make it active.Not true.how is it not true?The FDISK program in WIndows 98 differs from earlier versions. Did he say he used the actual FDISK for MSDOS and that no other program was used to create partitions? The 2GB pr less partition must be the first on the drive and the drive must be partitioned by a program that conforms to the MS-DOS limitations about LARGE drives. The BIOS should also conform to the MS DOS limitation. Quote (b) 2 GB (gigabytes) includes a limit of 1024 cylinders per drivehttp://support.microsoft.com/kb/69912 In short, you end of with a drive that can not be of much piratical use for other Operating systems. Better to just use an old 1.5 GB drive for DOS. Now if I am wrong about his please correct me. I am depending on memory, which is not getting very old, Version 72.. that makes since I'm familiar from 98 upThanks a lot guys every-thing works! Anyway just saying my hdd is only 540mg but just to know is it possible to make a hdd bigger when creating a new partition? Because the only thing i'm going to use this computer for is old dos games for the work better in original dos rather then win 98I've created partitions with Windows 2000 and XP and it worked fine to install DOS 6.22.... Windows 98's FDISK only creates partitions that cannot be used with DOS when you create one larger then 2GB. And the only reason is because that is beyond the limit of FAT, not because of some inherent flaw in the way it was partitioned. You don't even need to say N to the "Enable Large disk support for drives >2GB?" prompt. as long as you make your drives <2GB you can use them with DOS, it doesn't matter what OS you create the partitions with or what your format them with- you can use FDISK, you can use Windows XP's Disk management with the drive attached in an enclosure; you could use gparted, if you wanted to. as long as the drive < 2GB DOS can format it. (not counting SCSI drives) Actually, there is a single exception- some older NT OS's can format FAT drives up to 4GB using 64K clusters. these have problems being used in Any other OS, including DOS, Windows 95, 98, and ME. this "feature" was removed starting with Windows 2000. BC is ignoring the 1024 issue. Just because it has not bit you yet does not mean it will never bite. We are talking about using older versions of DOS that do not have the 1024 thing fixed. Or the BIOS does not get the needed support for DOS. Maybe BC was born after that period of PC history.The context here is about old PCs and old Operating systems. There was a transition period where the OS and the BIOS did not fully understand each other when large hard drives with more that 1024 cylinders became popular. In some cases the only effective remedy was to pin the dive so that it had a much smaller capacity. And at one time this problem was also in Linux, so it is not all a Microsoft thing. These comments do not apply to newer PCs and newer OS. Quote BC is ignoring the 1024 issue. Just because it has not bit you yet does not mean it will never bite. We are talking about using older versions of DOS that do not have the 1024 thing fixed. Or the BIOS does not get the needed support for DOS. No I'm not. I actually saw the OP's OS selection: Quote installed dos 6.22 Additionally, the "1024 issue" was purely an issue relating to the BIOS, or more precisely, INT 13H. And, even more relevant, is it simply prevented you from using the full size of the drive. It didn't stop you from using disk SPACE within the first 8.5GB, regardless of who allocated it. If you create a 2GB partition and a 78GB partition on one disk, you can safely install DOS on the 2GB partition and windows 2000 or XP or whatever on the 78GB partition, and freely boot between them. You will be able to access the 2GB partition from the windows installation but you will not be able to access the Windows partition from the DOS install. Also, we don't have to worry about the 1024 cylinder limit at all to begin with, since the BIOS of the compaq presario 433 is limited to 220MB and will only use the first 220MB of any disk you install anyway. |
|
| 88. |
Solve : How to disable protection of longfilename in MD-DOS 7.10?? |
|
Answer» Hi! |
|
| 89. |
Solve : Data Manipulation? |
|
Answer» I need this in DOS only:
%%~nx1 maybe? Quote from: S.Trout %%~nx1 maybe? Yes, maybe and perhaps, but the OP asked Quote from: OP how do I retrieve everything up to the last backslash, and the filename into separate variables?... I want VAR1 have the pathso that's what was provided. If the filename.extension was wanted as Var2 I'm sure the OP would have writ that in his/her specifications seeing as how he/she lists his/her experience level as Expert and as an expert would know how that a spec has to be correct. But then I'm just a Beginner and so am probably wrong - again. Mein English readinks tells me zat der extenshun ist nicht part of der filename. Thanks for dropping in DDV. a filename without the extension is called the basename. I imagine they meant they wanted the filename (basename + extension) Code: [Select]Set objFS = CreateObject("Scripting.FileSystemObject") Set objArgs = WScript.Arguments strFile = objArgs(0) Set objFile = objFS.OpenTextFile(strFile) Do Until objFile.AtEndOfLine strLine=objFile.ReadLine s = Split(strLine,"\") filename=s(UBound(s)) s(UBound(s)) = "" WScript.Echo filename & " "& Join(s,"\") Loop Quote from: et_phonehome_2 on February 24, 2010, 10:43:42 AM "So I want VAR1 have the path ( see dusty, reply 1 this thread. ) C:\>type dusty.bat Code: [Select]echo off rem cls setlocal enabledelayedexpansion for /f "delims=*" %%1 in (trial.txt) do ( set var1=%%~dp1 set var2=%%~n1 ) echo.&echo.&echo.&echo. echo Example of output is: Var1=%var1% Var2=%var2% C:\>type trial.txt C:\WINDOWS\system32\rstrui.exe C:\> Output: C:\>dusty.bat Example of output is: Var1=C:\WINDOWS\system32\ Var2=rstrui C:\> Quote from: et_phonehome_2 on February 24, 2010, 10:43:42 AM "So I want VAR1 have the path C:\batch>type dusty.bat Code: [Select]echo off setlocal enabledelayedexpansion for /f %%1 in (trial.txt) do ( set var1=%%~dp1 set var2=%%~nx1 echo.&echo.&echo.&echo. echo Var1=!var1! Var2=!var2!) Input: C:\batch>type trial.txt C:\WINDOWS\system32\rstrui.exe C:\WINDOWS\system32\notepad.exe C:\batch> Output: C:\batch>dusty.bat Var1=C:\WINDOWS\system32\ Var2=rstrui.exe Var1=C:\WINDOWS\system32\ Var2=notepad.exe C:\batch> Quote from: Dusty on February 25, 2010, 01:28:14 AM Yes, maybe and perhaps, but the OP asked so that's what was provided. Technically, the extension is not part of the filename, but most people seem to think of them as one thing. Also, the OP mentioned he wanted to split the full path + name string into 2 PARTS, not three, so I assumed he wanted the extension kept. Quote Thanks for dropping in DDV. Is that intended to be sarcasm? Quote from: Dusty on February 25, 2010, 01:28:14 AM
"Mein Englisch erzählt mir, dass der extention nicht Teil vom Dateinamen ist" http://www.freetranslation.com/ Quote from: BC_Programmer on February 25, 2010, 01:54:29 AM a filename without the extension is called the basename. I imagine they meant they wanted the filename (basename + extension) BC_P thank you. In For/? MS states that: Quote not a basename so it seems that file name and extension are to be treated as separate entities. The var is expanded without an extension. Quote from: Salmon Trout on February 25, 2010, 11:57:07 AM Is that intended to be sarcasm? Most certainly not. On re-reading the OP's post I realize that the request was for a solution "in DOS only" although the DOS version was not mentioned and I gave a possible solution based on the XP/NT command shell so probably got that wrong. Apologies to the OP. In my opinion, basename.ext is a filename, despite what the FOR help says. Quote The exact definition, giving the criteria for deciding what part of the file name is its extension, belongs to the rules of the specific filesystem used; usually the extension is the substring which follows the last occurrence, if any, of the dot character. http://en.wikipedia.org/wiki/Filename_extension Quote Many operating systems, including MS-DOS, MICROSOFT Windows, and VMS systems, allow a filename extension that consists of one or more characters following the last period in the filename, thus dividing the filename into two parts: the basename (the PRIMARY filename) and the extension (usually indicating the file type associated with a certain file format). On these systems the extension is considered part of the filename, and on systems which allow (for example) an eight character basename followed by a three character extension, a filename with an extension of "" or " " (nothing, or three spaces) will still be 11 characters long (since the "." is supplied, but not considered as part of the name, by the OS). On Unix-like systems, files will often have an extension (for example prog.c, denoting the C-language source code of a program called "prog"); but since the extension is not considered a separate part of the filename, a file on a Unix system which allows 14-character filenames, and with a filename which uses "." as an "extension separator" or "delimiter", could possibly have a filename such as a.longxtension http://en.wikipedia.org/wiki/Filename How do we split hairs? Quote from: Dusty on February 25, 2010, 01:27:11 PM On re-reading the OP's post I realize that the request was for a solution "in DOS only" although the DOS version was not mentioned and I gave a possible solution based on the XP/NT command shell so probably got that wrong. Apologies to the OP. This looks distinctly un DOS-like Quote \\UBIX\INT\EXT\ioweyou_bal_02242010.csv So I expect the OP has MADE the tiresomely frequent error of calling Windows NT family command script language "DOS". Quote from: greg on February 25, 2010, 01:47:08 PM How do we split hairs? With Occam's razor. |
|
| 90. |
Solve : cd key bat file not working? |
|
Answer» I'm making a bat file that needs a CD key to start installation of a program that I made but it doesn't accept the key I made with the code and with any key it gives this error "missing operator". The code for the bat file is does it need modification if the first group has 6 digits ex 123456 It should be obvious that the answer is "yes". I thought I had provided enough clues in the REMS. Study them. i have a new problem any other key other than the 03256 key doesn't work ex 22428-89-156-8 22428/89=252 252-156=96 96/8=12Are you sure? Code: [Select]Numerical values: key1=22428 key2=89 key3=156 key4=8 Arithmetic operation (1) 22428/89=252 Arithmetic operation (2) 252-156=96 Arithmetic operation (3) 96/8=12 Correct!it works now must have been something with my computer and is there any programing errors in this code for the key generator echo off :A cls Set /a key2=(%Random% %%89)+10 Set /a key3=(%Random% %%899)+100 Set /a key4=(%Random% %%9)+1 set /a e="12"*"%key4%" set /a d="%e%"+"%key3%" set /a key1="%d%"*"%key2%" echo your key is %key1%-%key2%-%key3%-%key4% pause goto a well, it produces keys... why are you using those quote marks? oops read the page for the set command wrong |
|
| 91. |
Solve : %1-12 problems? |
|
Answer» I'm having one file start another file with check parameters to prevent the second file from being opened with out running the first but EVEN when i run the the first the second still comes up withe the same error message |
|
| 92. |
Solve : A simple Windows Task? |
|
Answer» Hello Ive MADE a little batch file with the following content ECHO OFF "C:\Programmi\Windows Media Player\wmplayer.exe" "c:\windows\clock.avi" It s on an Italian Windows system. When I run it seperately, it RUNS fine. However, when the .bat is added as a task, it will not execute at the specified time I SET it to; nothing happens. Ive set the correct admin password.. Any ideas? Try ADDING START before the path. Start PATH [arguments]Thanks man. Start fixed it. |
|
| 93. |
Solve : FTP File Transfer? |
|
Answer» Hi to all i want make one batch file that connect to the ftp like 192.168.100.99 with username & password & then i transfer one text file FORM client %temp% to ftp folder. Code: [Select]C:\>ftp -h Transfers files to and from a computer running an FTP server service (sometimes called a daemon). Ftp can be used interactively. FTP [-v] [-d] [-i] [-n] [-G] [-s:filename] [-a] [-w:windowsize] [-A] [host] -v Suppresses display of remote server responses. -n Suppresses auto-login upon initial connection. -i Turns off interactive prompting during multiple file transfers. -d Enables debugging. -g Disables filename globbing (see GLOB command). -s:filename Specifies a text file CONTAINING FTP commands; the commands will automatically run after FTP starts. -a Use any local interface when binding data connection. -A login as anonymous. -w:buffersize Overrides the DEFAULT transfer buffer SIZE of 4096. host Specifies the host name or IP address of the remote host to connect to. Notes: - mget and mput commands take y/n/q for yes/no/quit. - Use Control-C to abort commands. |
|
| 94. |
Solve : A very simple DOS question... yet extremely complex!? |
|
Answer» Hi all, You could create a vb script to do what you need and then call it from the command line - I dont believe this is feasible using 'pure' batch commands I concur, maybe some form of a custom Command-Line utility compatible with batch file automation would work, but anything LIKE that would be playing with registry and driver stuff and I just don't trust most people to play with my drivers, yet alone crummy command-line executables. |
|
| 95. |
Solve : Real DOS TSR programming question? |
|
Answer» From Turbo C in DOS, how can I execute an EXTERNAL program without using any INTERRUPTS? I am making a SCREEN saver TSR which has to execute an external EXE as the screen saver. |
|
| 96. |
Solve : Batch not completed, what can be wrong?? |
|
Answer» Hello! |
|
| 97. |
Solve : Install program to drive other than C? |
|
Answer» Hi Hello, and welcome to the CH forum.It doesn't matter why, and any program can be installed to any drive the user chooses. (edited spelling)Ok thanks for the replies and the welcome. The program is actually MS Office Pro 2007. Its set to autorun, and automatically installs to C:( system) Drive. I'm experimenting with setting up a pc with OS on 1st partition, apps on 2nd partition etc. Any help appreciated Quote from: Biglittlebear on March 09, 2010, 01:32:48 PM ...Its set to autorun, and automatically installs to C:( system) Drive.If you only have one operating system, I would suggest the following partitioning scheme: C: OS & Programs D: Data E: Downloads F: WINDOWS Paging File (Swap File), IE Temporary Files, Windows Temp Files. Other than "C", CHOOSE any drive letter you like for the remaining. BTW, why is this thread posted in DOS Forum?Thanks for the reply. Why in this section ........I was looking for the Dos command as above. But I'll try your suggested HDD layout. BLB Quote from: Biglittlebear on March 09, 2010, 02:15:32 PM Why in this section ........I was looking for the Dos command as above.Just FYI, I understood that which is why I didn't offer any suggestion in my post above. Not sure if that can be done. Quote It doesn't matter why, and any program can be installed to any drive the user chooses. Allan, that is a very broad statement. Would you like to qualify that ? Violators who read this might take what you said to the extreme. Why does matter.Qualify what? Any app can be installed on any drive the user chooses - what's needs to be qualified? And why this user wants to do it is none of my business. |
|
| 98. |
Solve : SET /P command usage inside for loop? |
|
Answer» Hi,
C:\batch>type Thriu.bat Code: [Select]ECHO off setlocal enabledelayedexpansion for /f "delims=" %%i in (thriu.txt) do ( echo %%i Echo Enter: set /p variable= echo variable = !variable! ) Output: C:\batch>Thriu.bat Hello Enter: one variable = one World Enter: two variable = two This Enter: three variable = three is Enter: four variable = four a Enter: five variable = five batch Enter: six variable = six file Enter: seven variable = seven Input: C:\batch>type thriu.txt Hello World This is a batch file C:\batch> Quote from: Thiru on March 09, 2010, 03:43:25 PM That is using SET /P command inside a for loop. Based on user input, I want to perform some operation. But the script has to prompt for user input everytime the loops runs. C:\batch>type never.bat Code: [Select]echo off setlocal enabledelayedexpansion for /L %%i in (1,1,%1) do ( set /p variable=Enter: echo variable = !variable! ) echo Bye Output: C:\batch>never.bat 8 Enter:1 variable = 1 Enter:2 variable = 2 Enter:3 variable = 3 Enter:4 variable = 4 Enter:5 variable = 5 Enter:6 variable = 6 Enter:7 variable = 7 Enter:8 variable = 8 Bye C:\batch> reference: http://www.roysac.com/blog/2009/10/some-handy-ms-dos-batch-tricks-infinite.html Quote from: Thiru on March 09, 2010, 03:43:25 PM That is using SET /P command inside a for loop. Based on user input, I want to perform some operation. But the script has to prompt for user input everytime the loops runs. C:\batch>type nevertest.bat Code: [Select]echo off setlocal enabledelayedexpansion for /L %%i in (1,1,1000) do ( set /p variable=Enter: echo variable = !variable! echo To Quit, Enter: q if !variable!==q goto end ) :end echo Bye Output: C:\batch> nevertest.bat Enter:one variable = one To Quit, Enter: q Enter:two variable = two To Quit, Enter: q Enter:7 variable = 7 To Quit, Enter: q Enter:q variable = q To Quit, Enter: q Bye C:\batch> |
|
| 99. |
Solve : Delete Files After X Days? |
|
Answer» I understand this has been covered a lot but i SEEM to be running into a brick wall each time i try this. What I would like to do is: Code: [Select]Forfiles -p e:\path\path -s -m *.* -d -14 -c "cmd /c del /q path My I ask...... How to delete the files that is one year old...... Well what i mean is, I want to delete the files that is one year old. Where to change the script? Is it the "-14" ?Try that. There may also be a -y switch, so you could try -y 1 |
|
| 100. |
Solve : greater than less than? |
|
Answer» how can i do greater than, LESS than statementsLook at if /? at the COMMAND prompt. |
|