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.
| 2951. |
Solve : my commands are disabled.....!~~? |
|
Answer» wenever i type 'atmadm' command in my dos PLATFORM i get the foillowing message: If the message was blank, it wouldn't be a message . Read his post, then, Mr-rolling-eyes-wise-*censored*. actually, I think he's referring to the original post.So that makes me the wise-*censored*?no, you didn't use "" actually, it isn't true. If I show a messagebox with no title and no message, it still appears.Are you referring to the Code: [Select]msg * kind of message ?, if so, how would it appear. Or are you still talking about a message in a batch file that was never there.I have no idea what your going on about (with msg *), but I was talking about the MessageBoxA,MessageBoxW,MessageBoxIndirect, and the "TaskDialog" API routines. You know, the ones used by "real" programming LANGUAGES passing empty "messages" is different from passing Null messages. a null string is a string pointer set to null. any usage of this "null string" in any string accepting context will result in an segmentation violation/fault. a Empty string, on the other hand, is a valid pointer to an empty array of characters. It can be used successfully with string manipulation functions. So you see, Empty is not Null. what does that have to do with ANYTHING? I don't know, I'm just trying to prove that as long as somebody else is willing to be more pedantic then the last, neither argument wins. to put it simply, nonexistence is different from inexistence.If we're going to get pedantic, I was always taught to refer to "the" null string, ("") rather than "a". Like "the" empty set {}. Two sets are equal if they have the same elements; therefore there can be only one set with no elements. Hence there is but one empty set, and we speak of "the empty set" rather than "an empty set." Dunno if that helps the OP with his or her problem, but hey! Just to refresh some peoples memories, the OP wrote this. Note the four blank lines after "following message:", which I semi humorously took to be the "message". Now look what I've started! Quote wenever i type 'atmadm' command in my dos platform i get the foillowing message: Ignoring the fact that the post has set off my "plzz help" phobia, there is not much to go on here without further INPUT from the OP, which I somehow doubt will be forthcoming. Quote from: BC_Programmer to put it simply, nonexistence is different from inexistence. Quote in·ex·is·tent Quote inexistence Care to expand on that? good POINT, as you say there is only one empty string, thus the is a more appropriate word to use. Quote from: Dias de verano on January 01, 2009, 10:18:03 AM ok, just tack on "in the context of my pedantically challenged ramblings" to the end of my last sentence. It was simply an attempt to confuse.Quote from: Dias de verano on January 01, 2009, 10:18:03 AM If we're going to get pedantic, I was always taught to refer to "the" null string, ("") rather than "a". Like "the" empty set {}. Two sets are equal if they have the same elements; therefore there can be only one set with no elements. Hence there is but one empty set, and we speak of "the empty set" rather than "an empty set." Dunno if that helps the OP with his or her problem, but hey! IN- as a prefix is based on the latin word IN meaning not. Nonexistant is just an easier way of saying inexistant.Quote from: Helpmeh on January 02, 2009, 07:48:53 AM IN- as a prefix is based on the latin word IN meaning not. Nonexistant is just an easier way of saying inexistant. You missed the point. Read the posts again. |
|
| 2952. |
Solve : A few questions!? |
|
Answer» I have a few questions... You SERIOUSLY need to do some reading and studying. Seconded. A lot of info can be found in the documentation (can't remember, think it might have been a SEPARATE download) Quote from: BatchRocks on January 09, 2009, 03:28:25 PM I have a few questions... What command would /i or the other switches be associated. What you can do is go to CMD and type Code: [Select]help %command%It should list all of the switches.I completely forgot about Cmd then help %command% Lol, thanks. But, I've searched EVERYWHERE and can't find it. Thanks. EDIT : But wait, then what's grouping made for?grouping? I don't think I have it...He said ( and ) are used for grouping, why'd you use grouping? Also, this is my batch file. @Echo off echo Hi there>> F:\\\Batch Files pause exit and it says 'The system cannot find the specified path location' Any help?Quote Code: [Select]F:\\ \Batch Files The first 2 slashes are unnecessary. Quote from: BatchRocks He said ( and ) are used for grouping, why'd you use grouping? Once again, we tell you.... Quote from: BC_Programmer on January 09, 2009, 04:42:30 PM Quote from: Dias de verano on January 09, 2009, 04:33:15 PMYou SERIOUSLY need to do some reading and studying. |
|
| 2953. |
Solve : My Backup Script (Easy problem) [SOLVED]? |
|
Answer» It's not much right now, but it should be close to finnishing. I just ran into a problem where when I tried to backup a file, I only GET 1 line of text. This must be a really easy solution, I know that I know it, it's one of those tip of my tongue things. Here's the code. Backup which file? Include extension and path. but it doesnt happen all the TIME. i tried this next: Quote Backup which file? Include extension and path. dont know if thats supposed to happen or just a bug. but thats the bugs i found so far. Hope this HELPED ,Nick(macdad-) if the path has spaces the variable needs quotes... Code: [Select]set /p file= if not exist "%file%" echo File not found! & Pause & Cls & Goto loop set backup=<"%file%" echo %backup% FBQuote from: macdad- on December 30, 2008, 05:11:56 PM well found one error: That was something I just left out because I was doing stuff in the same directory anyway. But if you do add quotes, it will only echo the first line. Once someone tells me how to get it to read not just the first line, but the entire file, then it should be able to backup any type of file. Quote from: fireballs on December 30, 2008, 05:32:19 PM if the path has spaces the variable needs quotes...I assumed everyone knew that already...I think i know what you mean now, for DOS to 'read' a file use the type command: Code: [Select]set /p file= if not exist "%file%" echo File not found! & Pause & Cls & Goto loop type "%file%" FBQuote from: fireballs on December 31, 2008, 03:24:00 AM I think i know what you mean now, for DOS to 'read' a file use the type command:Quote No. That will DISPLAY the contents of the file. My intentions were to The premise to #1 is wrong. Any reason you cannot use the copy command to copy the file? Note: By requesting the user to enter path and extension, be aware that %file%.txt will resolve to a file name with multiple dots. Quote from: Sidewinder on January 01, 2009, 07:50:11 AM QuoteI mean SET %backup% to be the contents of the file. And for 2, I did that for a reason.QuoteNo. That will DISPLAY the contents of the file. My intentions were to I mean SET %backup% to be the contents of the file. And for 2, I did that for a reason. Redirection can copy a single line from a file into a variable, not the entire contents of the file. Concatenation will strip off the carriage returns/line feeds, resulting in an output file that is mis-aligned. Why can't you use copy? Note: Most Windows scripting languages have an instruction which can get the contents of a file into a variable. Have you considered VBScript as a solution?Quote from: Sidewinder on January 01, 2009, 09:43:51 AM QuoteI guess I could copy, then rename to a different extension, but I want to put more than one file into a single file.QuoteI mean SET %backup% to be the contents of the file. And for 2, I did that for a reason. I guess I could copy, then rename to a different extension, but I want to put more than one file into a single file. Based on your previous logic, you can use the type command: Code: [Select]type %file%.txt>>%file%.xyz Use two output redirection symbols to prevent overwriting the output file. Good luck. Note: files concatenated this way can be problematical to extract from the output file. Thanks. I didn't know that type could do that. |
|
| 2954. |
Solve : Deleting the first line or a string in batch.? |
|
Answer» Okay I need to find; Code: [Select]X983493853CC£$£FGG$In a text file, and delete it. strPath = "file.txt" Does this code even get interpreted correctly? Don't you need colons between the instructions if they occupy the same line? Readability still counts: Code: [Select]Const ForReading = 1 Const ForWriting = 2 Set fso = CreateObject("Scripting.FileSystemObject") Set iFile = fso.OpenTextFile("file.txt", ForReading) Set oFile = fso.OpenTextFile("fileout.txt", ForWriting, True) Do While iFile.AtEndOfStream <> True str = iFile.ReadLine If InStr(1, str, "X983493853CC£$£FGG$") = 0 Then 'check if string not EXIST ofile.WriteLine str End If Loop ifile.Close ofile.Close I took some liberties with the file names, but I'm sure you can make any changes necessary. Good luck. Note: the compare is case sensitive; Research the instr function on how to do a case-insensitive compare.Thanks for your time. I saved that code as de.vbs and APPLIED the appropriate changes. I then made sure all files existed and then double CLICKED de.vbs. This resulted in the following error: Do I have to run the .vbs script through command prompt, and if so how do i do that?I cannot reproduce the error. My editor shows line 11 as ofile.WriteLine str Try replacing with ofile.WriteLine(str). Otherwise, some characters may have been misplaced during the copy/paste operation. Quote Do I have to run the .vbs script through command prompt, and if so how do i do that? No. The default of most machines is to use the wscript program as the interpreter. If you have a need or find it more convenient to run from the command line, the default can be changed to cscript by running WScript //H:CScript All scripts can be started from the console or the run box. The default engine is used unless specified on the command line. Note: there are some subtle differences between the two interpreters, especially with std i/o device operations (wscript has none) and how echo is handled (window vs. console). Happy Scripting Okay, I'm not sure why it is doing this. This is useless now to me anyway, but thanks very much for your help. |
|
| 2955. |
Solve : Set as Type? |
|
Answer» I was wondering if it's possible to SET something in a batch, as the TYPE of a file. I know that trying to do this, only gets the first line of the file: @echo off The above code will produce a compound (stem.tail) type array where you could iterate numerically through the tails to reproduce the file. However the file contents are not in a single variable. Quote for /f "delims=" %%i in ('type C:\path to file\file.txt') do (set contents=%%i) The above code will generate a variable with a value of the last line in file.txt. You can modify the snippet to use CONCATENATION: Code: [Select]@echo off for /f "delims=" %%i in ('type C:\path to file\file.txt') do ( call set contents=%%contents%%%%i ) echo %contents% which will put the contents of the file into a single variable. Unfortunately, all the carriage returns and line feeds will have been stripped out. Reconstructing the original file will be quite the challenge. Why do you need to do this and have you considered using VBScript or even Powershell which have instructions for just this very purpose? for /f "token=1*" %%a in (file.txt) do ((call set /a int=%%int%%+1&call set int.%%int%%=%%a%%b)) How can i add this all to one line similar to the above?Quote from: Sidewinder on January 05, 2009, 05:05:53 AM Why do you need to do this and have you considered using VBScript or even Powershell which have instructions for just this very purpose?I'm trying to compress the file. There is a way to compress, then decompress the file using the set function, but I need the full contents. I'm not sure there's a way to recreate it in VB, and my school probably doesn't have powershell...(Yes, I am a student) The school also doesn't allow downloading unauthorized software, so you can rule that out...Quote The school also doesn't allow downloading unauthorized software, so you can rule that out... Understandable. Powershell also requires the .Net Framework. Quote I'm trying to compress the file. There is a way to compress, then decompress the file using the set function We may have different definitions of compress, but I'm fairly certain the set command would not be helpful in this situation. VBScript however, can be helpful here. Windows recognizes compressed files by a header record. Once Windows finds the header, any files(s) copied into this namespace are compressed using system routines. Code: [Select]Set WshShell = WScript.CreateObject("WScript.Shell") Set fso = CreateObject("Scripting.FileSystemObject") strTargetFile = WshShell.ExpandEnvironmentStrings("%temp%") & "\test1.zip" 'compressed output file Set zip = fso.CreateTextFile(strTargetFile) zip.Write Chr(80) & Chr(75) & Chr(5) & Chr(6) & STRING(18, 0) 'this is the zip header record zip.Close WScript.Sleep 500 Set objShell = CreateObject("Shell.Application") Set objFile = objShell.NameSpace(strTargetFile) Set src = objShell.NameSpace("c:\scripts") 'input directory; files will be compressed objFile.CopyHere src WScript.Sleep 10000 Save script with a vbs extension and run from the command line as cscript scriptname.vbs If this snippet is helpful, great! If not perhaps you could explain how you would use set to compress a file. Quote from: Sidewinder on January 05, 2009, 06:48:13 PM If this snippet is helpful, great! If not perhaps you could explain how you would use set to compress a file.Gladly. The only reasonable way to compress a text-based file (.txt or .doc are what I'm planning) would be to change whole words, "the" for example, into one-letter phrase...say "t". I'm also using this code for a censor in another batch project. Here's the code. Code: [Select]set contents=%contents:the=t%Pretty simple...I do realise that it won't be perfect, but that's what debugging is for. Now if only I could SET the TYPE of a file...Quote from: Helpmeh on January 06, 2009, 04:59:18 PM would be to change whole words, "the" for example, into one-letter phrase...say "t". I'm also using this code for a censor in another batch project. think about it. you change "the" into t. now you expand it. but... suddenly words that were originally tiny and tooth and tatters are theiny, theootheh and theathetheers. true I guess...I could do a letter+number combination... Like, the into t1 and tiny into t2 and so on and so forth...So there's no CONFUSION, but can ANYONE solve this problem?Quote So there's no confusion, but can anyone solve this problem? Which one? The compression or the single variable CONTAINING the contents of a file? For the single variable switch to VBScript which is already installed on your XP machine. Many compression algorithms use statistical redundancy to reduce file size. Text and documents have much white space which can be reduced by declaring the the numerical iterations followed by the character in question. For example: 40 consecutive spaces in a document might be reduced to [40] . As was mentioned, compressing the file is not main hurdle. Reconstructing the file from it's compressed state is the real challenge. I was just sort of picturing it...find a way to compress it in dos, but save it as an unused extension...Then compile the decompresser to an exe and make the new file always open with the exe decompresser... Am I just dreaming? or is this possible in some way?Some of the things you mentioned are possible. But not all of them are possible. So no, it's not possible.Ok. Thanks anyway! |
|
| 2956. |
Solve : New Line In File? |
|
Answer» Quote from: Sidewinder on January 18, 2009, 06:57:14 PM Did you set FNAME variable to the label of a file on your system? I'll try the code again...But no, it is not compressing then decompressing files. But, like I said, the complete reason why I need this must remain between my friend and I, although to help you I will say this: I need to be able to remove a certain line at will (or automatically if its the first line and there are 31 lines) without directly modifying the text file. Dias, I was asking for help, not for wasting comments. EDIT: Code works...almost. It will echo each and every line, and if there is more than 30, doesn't show the first lines...but how can I GET each visible line as a variable???Quote EDIT: Code works...almost. It will echo each and every line, and if there is more than 30, doesn't show the first lines...but how can I get each visible line as a variable??? It could be me, but isn't this what you asked for? Quote 1. I'm trying to get the contents, and set each line as a variable. If you want all the lines in variables remove some of the logic from the posted code: Code: [Select]@echo off setlocal set fname=drive:\path\file.ext for /f "tokens=* delims=" %%x in (%fname%) do ( call set /a idx=%%idx%%+1 call set array.%%idx%%=%%x ) for /L %%x in (1,1,%idx%) do call echo %%array.%%x%% Be aware the environment space (where your variables are stored) is limited to 8K bytes on a XP machine. Quote I need to be able to remove a certain line at will (or automatically if its the first line and there are 31 lines) without directly modifying the text file. Determine which line to delete and write out a new file. You don't need a variable for each line, you need a counter. By the way who is Will? Perhaps you should get together with the other guy on this board with the 142 labels. You could share the cost of a KISS 101 course Quote Hamlet? 0x2B | ~ 0x2BYes. Hamlet was not a programmer. In the original context it was an XOR that had to have a YES or NO. But the C construct would become -1 if converted directly to a number. What would Hamlet think if we told him the answer is always minus one?Quote You don't need a variable for each line, you need a counter. I told him this days ago.Quote from: Dias de verano on January 20, 2009, 12:46:54 AM QuoteAnd I said that I DO need a variable for each line. (But atleast my problem is partially done)You don't need a variable for each line, you need a counter. |
|
| 2957. |
Solve : Program not working!? |
|
Answer» I will answer all the questions ... again .... The new section I made has 142 labels. I have many labels yet to come! Obviously not an alumni of KISS University. What is KISS university. Or is that just slang for something I would never know .OMG. you show your beginnership with almost every post. Especially when you haven't heard of basic programming principles/practices. It's an acronym.Quote from: BC_programmer you show your beginnership with almost every post. "almost"? Quote from: Dias de verano on January 19, 2009, 12:19:24 AM Quote from: BC_programmeryou show your beginnership with almost every post. alright, I was being a bit conservative...Ok, tell me a replacement for labels . Quote Especially when you haven't heard of basic programming principles/practices. How?Quote from: BatchFileCommand on January 19, 2009, 08:48:55 AM How? *censored* is a root square? Closest REAL math term I can think of is Square Root. Quote from: BatchFileCommand on January 19, 2009, 08:48:55 AM
I'll show you. Quote from: BatchFileCommand on January 18, 2009, 07:48:06 PM What is KISS university. Or is that just slang for something I would never know .that the given in the proof. Thank goodness I'm not an alumni of KISS university. I bet you are. What a slacker! Wasting your time posting messages on the internet. You're LIKE 25 years old. Quote from: BatchFileCommand on January 19, 2009, 07:47:07 PM Thank goodness I'm not an alumni of KISS university.KISS is a god damned acronym! tried google yet? it comes up pretty quick. It stands for "Keep It Simple, Stupid" which is a basic tenet it keeping code maintainable, a effort you obviously haven't put FORTH; and will have difficulty putting forth given your lack of effort in doing a simple google search to define the acronym, or even taking an extra second to look at my profile and see that I am actually 21 years old. Warranted- it IS a batch file, and a lot of basic tenets of programming can be willfully ignored (such as never using gotos... "Goto considered harmful")... SINCE goto is kind of all you have with batch, it goes without saying that that rule needs to be ignored. another basic programming technique is to give labels and variables a meaningful name don't have your code here, so I don't know about the variables, but the labels surely aren't the most descriptive symbols one could concieve. and in the spirit of asking questions- what is the following missing? It's missing a single line... without it the window the procedure is attached to will not be responsive to any input or other system messages. Code: [Select]LRESULT CALLBACK WndProcedure(HWND hwnd, UINT message, WPARAM wparam LPARAM lparam) { switch(message) { case WM_CREATE: break; case WM_COMMAND: break; } } That's not batch file. Because in batch files you don't have methods like that ( but you do have grouping). I'm not sure but I'm going to say Quote Code: [Select] break; That's you key ( I think). Just a guess.Quote from: BatchFileCommand on January 20, 2009, 06:14:14 AM That's not batch file. Because in batch files you don't have methods like that ( but you do have grouping). I'm not sure but I'm going to say hmm, not sure what's different there. The syntax of the original was ok- it was just missing a necessary function call. In a way, it was actually a trick question. Anyway- nope, wasn't batch, that was C- So in a way one could say I was cheating... Not everybody programs in C, and even fewer of them write window procedures... but it was actually missing a single, very important line: Code: [Select] LRESULT CALLBACK WndProcedure(HWND hwnd, UINT message, WPARAM wparam LPARAM lparam) { switch(message) { case WM_CREATE: break; case WM_COMMAND: break; } return DefWindowProc(hStatusWnd, uMsg, wParam, lParam); } Since the code there doesn't actually do anything- it has to pass the message on to the default window procedure. One might ASK, "whats that do?"... well, the default window procedure provides default handling for window sizing and movement, as well as handling the "close" button when it's clicked. Without it- the window won't even paint- none of the buttons will do anything, mousing over the border won't work, etc. It's really quite a useful procedure though, I've had to subclass a Visual Basic form several times so that I could write my own window procedure for stuff VB didn't provide, usually messages introduced from Windows 2000 onwards. You see . I'm not completely incompetent. I was thinking it was some kind of C language. Quote from: BC_Programmer on January 19, 2009, 08:01:22 PM Quote from: BatchFileCommand on January 19, 2009, 07:47:07 PMThank goodness I'm not an alumni of KISS university."Keep It Simple, Stupid" That's an extremely old acronym...my TEACHER uses the KISS principle. |
|
| 2958. |
Solve : win 98 second E emm 386.exe probs? |
|
Answer» I have tried a full scan and it has managed to complete except for this one FILE. I have managed to get 386 active but i have found the error is reading as memory as above and drvspace ooo. I am now tearing hair out as I am silly and didn't make a backup and no floppy drive available. I have tried most of the config things and command .com and it keeps coming up now to scan in WINDOW I don`t know how to switch from the dos to windows.clear as mud try EXPLAINING again where are you at.I am sorry I am not an expert I keep getting the emm 386 memory message although I have managed to get the memory now active when I scan it is still coming up with kernel 386 or SYSTEM ini. I somehow managed to read in the log C:dblspace000 I`m getting in over my head here. Windows 98 second e won`t load in safe mode can only do safe prompt. I beginning to think this pc meant for my little grandson has had it!!!!!! WRONG forum... |
|
| 2959. |
Solve : Count the letters, then generates a number.? |
|
Answer» Does anyone know a code that can count the letters that were enter from a Code: [Select] set /p and then generates each letter into a number, but the number can be converted into the word/phrase again? Well, nevermind I guess. I can't find the file I originally made, LOL. BatchRocks .... If you come asking for knowledge on something, please dont just give up on it like that, as for dont you think you might be back later when you still dont know how to do this and may need to. I personaly would have followed through and given an example even if you dont have the exact file you originally wanted to use to figure out how to make it work for your application, then save a copy of the help you received for a later point when you decide you need it again. This forum is not just for shared solutions that we can code up for you to save you from having to do all the work, but also hopefully you see this as a learning area. Giving up like this frustrates many members. In the future maybe express that it may be of lesser importance because the batch application requirement is gone at this time, but you would still like to figure out how to do this by example so you may learn how it works, and others may learn from your example batch application needs as well.Very wise words, Dave. Batch is so the wrong language for this kind of thing! If you want to stay with the console, with QBasic or any of its clones, it's a "piece of piss" as we say in England. I know the code wizards will say the more modern languages like C or its children are better, but hey! Code: [Select]LINE INPUT "Type a sentence:"; sentence$ Slen=LEN(sentence$) Enc$="" FOR J=1 to Slen Char$=MID$(sentence$,j,1) NUM=ASC(Char$) HS$=HEX$(NUM) Enc$=Enc$+HS$ NEXT J PRINT Enc$ In fact, you could put the loop and everything that is inside it on one line. Like this Code: [Select]FOR J=1 to Slen:Enc$=Enc$+HEX$(ASC(MID$(sentence$,j,1))):NEXT J Isn't that great? Code: [Select]Type a sentence:? Hello world 48656C6C6F20776F726C64 I used FreeBasic, which is, as its name implies, free, and it compiles to .exe files! What more could a budding nerd ask for? http://www.freebasic.net/ I hope I haven't started something... Or do I? VB saves the day! Code: [Select]Dim strInput As String Dim intLetters As Integer = -1 Sub Main() strInput = Console.ReadLine() For i = 0 To strInput.Length intLetters += 1 Next Console.WriteLine("------------------") Console.WriteLine("Number of Letters:") Console.WriteLine(intLetters) Console.ReadKey() End SubVery good, macdad, but it doesn't do this part Quote and then generates each letter into a number, but the number can be converted into the word/phrase againSorry Dave. Thanks for the help. I actually only do Batch Files, and, I passed the project. Thanks for your help, Dias and Mac. DylanQuote from: Dias de VERANO on January 20, 2009, 12:27:09 PM Very good, macdad, but it doesn't do this part ok i see what he wants, its kinda like Word to ASCII code and back to WordQuote from: macdad- on January 20, 2009, 02:32:53 PM ok i see what he wants, its kinda like Word to ASCII code and back to Word Well, he just SAID "numbers", and I just used ASCII because it seemed simpler, but once you have the text converted to numbers then some kind of simple cypher scheme could be arranged (I think that's what he was after) I converted to hex because then every letter of the alphabet converts to a 2 digit hex code which would make conversion back again easier. In fact if you then convert the hex DIGITS say 0>A, 1>B, 2>C etc you'd have a message which would look pretty incomprehensible. If you used a one-time code scheme you'd be fairly secure from AMATEURS as well. Thanks Dias and Mac for FOLLOWING through with this one. Also thanks for link to FreeBasic. Going to have to try that out. That conversion of text to hex was neat, and I added it to my personal geek archive. Quote from: Dias de verano on January 20, 2009, 11:47:03 AM Batch is so the wrong language for this kind of thing! If you want to stay with the console, with QBasic or any of its clones, it's a "piece of piss" as we say in England. I know the code wizards will say the more modern languages like C or its children are better, but hey! Why don't you use Visual Basic 2008 Express. 100% free, and can compile to .exe s as well. I was browsing through this section and I found a script that counts the amount of letters and characters, but only that.Quote from: Helpmeh on January 20, 2009, 04:16:18 PM Why don't you use Visual Basic 2008 Express. 100% free, and can compile to .exe s as well. probably because it requires the .NET framework. Visual Basic .NET is a good language- but it's not Visual Basic(which itself isn't BASIC). if I ever move to .NET I will likely go to C#. I prefer to have direct access to API methods that I need, and wrap them in my own classes. Not some half-assed Microsoft version of a class that covers the API routines in a thin wrapper, like MFC. That Victor, still whittling away at FreeBASIC. It's excellent stuff, too. Once he adds classes, I'll be writing a lot more code in and for it. Quote from: Dias de verano on January 20, 2009, 11:47:03 AM I know the code wizards will say the more modern languages like C or its children are better, but hey! That actually strikes a much reverberated chord- C and C++ and so forth are terrific languages, but- they are a huge pain in the but to debug and test and so forth. QBasic and QuickBASIC make it a lot easier to pumpt out quick chunks of code- especially for string manipulation. String manipulation in C/C++ should require a Surgeon's license. Quote from: Dias de verano on January 20, 2009, 11:47:03 AM In fact, you could put the loop and everything that is inside it on one line. Like thisNow your just showing off |
|
| 2960. |
Solve : Mailing step in a DOS bacth script..? |
|
Answer» Hello everybody, |
|
| 2961. |
Solve : Help With WinRar Command-Line? |
|
Answer» This is the Winrar command Line I am using.. Would something along the lines like that work..?? Should work fine. Why don't you try it? |
|
| 2962. |
Solve : email batch file? |
|
Answer» Hi all, I need a BATCH file that would pick my designated html file from a directory and send as an email to an email address thanks in advanceNot sure you can do this in batch without a 3rd party program. Windows Script however offers a solution: Code: [Select]Set CDO = CreateObject("CDO.Message") CDO.From = "youremailaddress" CDO.To = "receipientaddress" CDO.Subject = "text" CDO.Textbody = "moretext" CDO.AddAttachment "attachedfilename" CDO.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 CDO.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "youremailservername" CDO.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 CDO.Configuration.Fields.Update CDO.Send From, To, Subject, TextBody parameters should be self EVIDENT, change as needed. AddAttachment should be the path of the file you want to attach to the email. Change the SMTP server name to your ISP outgoing mail server name. Do NOT change any other parameters. After saving the script with a vbs extension, you can run it as cscript scriptname.vbs The script can also be launched from a batch file 8-) From your PM's I got the information that you're using XP.To do it with a batchscript you need a 3rd party tool for mailing. Blat is a good one. Just google for the downloadlink. hope it helps ulithank you sidewinder ..your code worked for me..i saved it as vbscript file and ran it ..mails were created and deleivered..but i also have another TASK..i need to use this file to be called in the dos batch file ..is that possible??? Just add the command cscript path\scriptname.vbs into your batch file just like any other command. If necessary add path information so Windows can find your script. 8-)Quote from: Sidewinder on December 06, 2006, 09:32:29 AM Code: [Select]Set CDO = CreateObject("CDO.Message") So, if my email was [emailprotected] then I would put that as CDO.From, and "youremailservername" would be thisisnotreal.com??? Edit, tried what I assumed...lagged then brought an error...Quote from: Helpmeh on January 21, 2009, 02:18:15 PM Quote from: Sidewinder on December 06, 2006, 09:32:29 AMCode: [Select]Set CDO = CreateObject("CDO.Message") Check with your ISP or visit their web site, but I doubt thisisnotreal.com is the name of their SMTP mail server. A reminder: never ASSUMEUmm...Why would my ISP know what the SMTP of rocketmail.com is??? If anyone knows, please tell.Quote from: Helpmeh on January 21, 2009, 04:03:40 PM Umm...Why would my ISP know what the SMTP of rocketmail.com is??? They wouldn't. Well they might, but CDO is designed to send mail through a SMTP server. I doubt any web based mail site (Hotmail, Yahoo, Microsoft Live) will allow direct access to their SMTP servers. I chose CDO as a solution to the OP to show that there are tools on most systems that many people overlook. Why did you choose to resurrect a two year old post where the OP is no longer a member? I didn't even notice how old this thread was. I just found a link in a recent thread on the same subject(Which btw you put). |
|
| 2963. |
Solve : How to create a batch file to run a program over multiple files.? |
|
Answer» Hello, |
|
| 2964. |
Solve : Noob Needs Some Answers.....? |
|
Answer» First: I was wondering if there was a MS-Dos file out there the has all updated commands (Choice, beep, ....) and the location of that file(s). First: I was wondering if there was a MS-Dos file out there the has all updated commands (Choice, beep, ....) and the location of that file(s). the "Files" you speak of would be on the original installation diskettes for each version of MS-DOS; which are still subject to Microsoft Copyright. I don't want to do anything illegal, I just wanted to mess around with programming little programs. I have a wild imagination and come up with ideas all the time that can make things easier for me. I also downloaded Microsoft Visual C++ but but I found thats not exactly the place I wanted to start learning how to program lol. So I'll start from the bottom up. If I can't understand some earlier VERSIONS of MS-DOS then I doubt I'll be ABLE to learn C++. Where is the location of MS-DOS (and version) that I'll need to get a head start? Somebody out there knows something I don't. Please people... share the knowledge... Is there a way I can uninstall my DOS Version: 5.1.2600 to 6.2? It keeps telling me "Please goto the Control Panel to install and configure system components" Any guesses? Also, I downloaded the "MS-DOS 6.2 Step-up Files" but where do I go from here?you don't have MS-DOS. you have windows XP. |
|
| 2965. |
Solve : Batch file performance - Can it be improved?? |
|
Answer» Curious to know if upgrading hardware on a PC would increase the time a batch file takes to complete. For example, would having the pc on a gigabit network, max RAM, decent cpu etc. IMPROVE DOS command perfomance over the same pc without any upgrades? |
|
| 2966. |
Solve : another q? |
|
Answer» is there a peice of code that will move the mouse to a cirtain POSITION on the screen and simulate me clicking the mouseThe SetCursorPos Windows API routine can be USED to set the mouse position, and the Mouse_Event API can be used to simulate a click. that confusing ok, I'll rephrase- what PROGRAMING language?ms-dos the one used in batch filesYou can't do it using DOS, you have to use VB or something similar. FBok so can some one please post a code snipit of this code and tell me what to save the file as There IS a PROGRAM, very simple to use. http://members.ij.net/AnthonyMathews/MacroMakerInst.msi Non-virus, trust me. Download, restart computer, bing. You may need to use the HELP tab. BR |
|
| 2967. |
Solve : How to create a batch file to move multiple files to another folder? |
|
Answer» I have a folder that contains multiple .txt files. |
|
| 2968. |
Solve : Need help with finding a string in a file? |
|
Answer» Hi, Msg 102, Level 15, State 1:Obviously the Numbers change based on the error but the line is standard otherwise. What I mean is everytime there is an error: Quote Msg "some number", Level "some number", State "Some number": I dont care about the numbers. I am not sure If I can parse such a line using regular expressions or something. If someone can help that would be great!! There's a thread just like this. But I'll answer anyways. This code will test to see if there's an error. If it finds an error it will send out a message. Code: [Select]if not %errorlevel% equ 0 echo There was an error! There, if there's an error it will give out an error message. PRETTY simple.I am sorry. I guess I wasn't clear enough. I am not looking for any error's in the batch files. But rather from sybase. If sybase server throws back an error, I want to parse the output file and check if there was an error. Like I mentioned in the post, sybase wont stop execution if it finds an error in the sql scripts. It moves on to execute the next sql script. For example, If there are 5 Database objects to be executed, Even if there was an error in the second object, Ideally I want the execution to stop there and not move forward. However with sybase(using isql) the execution doesn't stop. Hence I want to capture the error from the output file. If still there is a CONFUSION, I could try putting more example.I think now I see what you are trying to say. Let me try the error level option. Also saw the other topic with a similar question. The only reason I started this new one was CAUSE I felt its different than the other topic. Cause I was thinking on regular expression terms. ~HiteshRather than this, Code: [Select]if not %errorlevel% equ 0 echo There was an error! I prefer this: Code: [Select]if %errorlevel% GTR 0 echo There was an error! But this will not find your errors, because Quote sybase wont stop execution if it finds an error in the sql scripts. But we need more examples. How are we going to know if there has been an error? Let me post the output file here. I have also attached the output file. This is for a wrong syntax(just an example). The contents of the output file are: Quote Msg 102, Level 15, State 1: The error message will change depending on the type of error. In general the format of the error will be: Quote Msg [Number], Level [Number], State [Number]: So If you look at the code again, what it does is: for each line in sqlfile.txt it will execute the following statement: Code: [Select]isql -S %SERVER% -D %DB% -U %USER% -P %PWD% -i %filename% -o output.txt Before moving on to execute the next line in sqlfile.txt, I wish to check the contents of output.txt and If there is an error, exit out of the for loop printing an error message saying the error occured while executing so and so filename. Looking at the responses, I am guessing I dont need the 2nd for loop. Let me try removing that and do a find. I know I have been repeating the same story again and again. Apologies for that, And If you have any specific questions please let me know. [attachment deleted by admin]Really we need to know of a word or other thing that signals each error. For example if we scanned the output file and saw "Incorrect syntax" then we could capture the error you used as an example. You could do it thus set syntaxerror=0 type "output.txt" | find /i "incorrect syntax">nul && set syntaxerror=1 if %syntaxerror% EQU 1 (do something) How many likely errors are there? Is it the case that the presence of the words Msg, Level, and State always mean an error? Quote from: Dias de VERANO on January 23, 2009, 10:36:35 AM Really we need to know of a word or other thing that signals each error.I totally see your point here. Let me try and get as much information I can about what remains constant during each error. Quote For example if we scanned the output file and saw "Incorrect syntax" then we could capture the error you used as an example. You could do it thusI would rather not want to capture Incorrect Syntax cause I would not expect every error to be a syntax error. But whenever there is an error, there will be a Msg, Level, State error line. Quote Is it the case that the presence of the words Msg, Level, and State always mean an error? One answer I know for sure is that YES the presense of the words Msg, Level and State always mean an error and it will be present everytime there is an error. The numbers change and hence I was thinking in the terms of parsing the line to look for only the characters and avoiding the numbers. Quote How many likely errors are there?Regarding the question about how many likely errors are there, I am not too sure. I have mailed my company's Sybase DBA and the moment I hear from him back I shall update the information here. |
|
| 2969. |
Solve : To extract Filename to a variable in a batch file? |
|
Answer» Can anyone help me to get a filename, EXISTING in a particular folder to a variable in a BATCH file?How are you selecting one file from the folder without knowing it's NAME? More INFORMATION on what you're trying to do would help... |
|
| 2970. |
Solve : Finding and Replacing in a Batch File? |
|
Answer» HI, Its great to join you wonderful people, I feel it! I have a problem with my batch file. I have a text file in which I WANT to find and replace certain STRINGS using a DOS batch file. Its sort of given me jitters. Anybody with an IDEA? Look here http://garbo.uwasa.fi/pc/editor.html for texrep12.zip, the description follows: TEXREP is a program to make text replacement changes in a file without using an editor. It will work on any type file of any size replacing any character(s). Its DOS syntax is very easy to use. Every month or so I need a program to make changes in a text file that my editor can't easily handle. Or I want to make the same change in several files. Such programs exist, but they make a single change or ask you to build a table file which means you have to look at the documentation each time. TexRep has a simple syntax and a one page help screen (enter 'texrep' with no parameters), so the documentation shouldn't be needed often. It will also display an ASCII/numeric conversion table (enter y after the help screen). Hey, Johnwill, THANKS, it did the trck. No more jitters. Tried it on voluminous files, and pronto, it was cool bananas.Garbo is a good place for DOS utilities, DOS is NOT dead. |
|
| 2971. |
Solve : .bat to make backups without overwrite larger file? |
|
Answer» I tired to fit as much as possible into the topic. I know how to SIMPLY COPY stuff from one dir to ANOTHER. How would i copy stuff from one dir to the other with out over writting the larger file? I need to backup txt files every HOUR, but sometimes the origional txt files get messed up (why i need backups), then it copys over the messed up files and BLAM backups are pointless. So Please help my write a batch file that will copy files as long as they are larger in file size.This may take a utility that's a bit more complex than a batch file. |
|
| 2972. |
Solve : DOS Compatability Issues with Batch? |
|
Answer» I've been WRITING a batch file on my windows 2000 machine and it worked fine (obviously because of NEWER version of cmd.exe). However, when I threw it on a bootdisk and booted on another system and runthe batch file once I get to the prompt it gives me a variety of errors. As a result I'm left with two questions, 1) Is there anyway to make a bootable cd/floppy with the win2k version of dos (cmd.exe) on it? and/or 2) How can the following code be modified to work with elder versions of DOS: |
|
| 2973. |
Solve : Adding computer to a domain through DOS? |
|
Answer» Is there a WAY to add a computer to a domain through DOS? PERHAPS USING one of the NET commands? Thanks in advance. |
|
| 2974. |
Solve : CD rom missing in DOS? |
|
Answer» i did a format on two 133 mhz comp's i am working on. somehow i lost the cd rom drivers, not being real good at dos i would normally just reload 5.0 and then 6.22 but my DISK are corrupt now for being stored BADLY and rarely ever GETTING used. working from a win 98 start up disk, i have a third 133 running win 98 , is it possible to copy the the lines from the autoexe.bat and the config sys and install the CD rom driver and the MSCDEX file ( i downloaded it to a FLOPPY) geese did any of that make sense ? loltry another BOOT disk>www.bootdisk.com it should come with the cdrom driver...or this may help>http://www.newlogic.co.uk/tips.htm#cdromdos |
|
| 2975. |
Solve : Fdisk simulation? |
|
Answer» Booting up faster than shutting down takes some doing. Mine takes around 72 seconds to boot-up but will SHUT down in 10. |
|
| 2976. |
Solve : a:/>? |
|
Answer» The systems does recognize the drive. Is your CD a regular windows installation disk, a manufacturer's recovery disk, or a windows upgrade disk?the c.d is regular windows installation c.d.I had a version of win98 once where the setup files were in a subfolder within the CD ROM. I can't remember the name of the folder, possibly e:\win98\setup. If you type dir in the E directory there maybe another option.The W98 CD has setup.exe in the root directory. In the win98 folder is another option named oemsetup.exe. One of them should work.So we've establishedyou get to e:\ So we've establishedyou get to e:\ He's already tried thatmany thanks to all that tried to help but the PROB was my cd, tried it on another computer and would not work. have got hold of a new 98SE and all is now well. many thanks to all.Can you get a directory display from the CD when you TRY: dir e: If not, you may have a dirty CDROM drive, try a cleaning disk. Check the other drives as well. The D: is a RAM drive (2 meg) set up by Win98SE BOOT floppy for utilities and will show several DOS utilities. C: is your hard drive partition, I don't know whether you have put any files on it yet or not. A: is your floppy and B: is a PLACEHOLDER for a second floppy or cartridge drive. If you get normal directory displays from these but errors from the CDROM, you may have a defective or dirty CDROM drive or CD. Cleaning it will fix that. Try putting a different CD in the drive and see if the directory shows up at dir e: in DOS. |
|
| 2977. |
Solve : printer compatability for dos program? |
|
Answer» I HAD AN OLD PRINTER THAT MY DOS PROGRAM WOULD PRINT TO. I HAD TO CHANGE PRINTERS NOW IT CAN'T PRINT FROM THAT PROGRAM. ANY HELP WOULD BE GREAT. You also have a second problem. Find a keyboard withouot a stuck Capslock key... |
|
| 2978. |
Solve : need driver creative 1371,1373? |
|
Answer» hi |
|
| 2979. |
Solve : running an executable from a bat file? |
|
Answer» i'm trying to LAUNCH an executable from a bat file. i want the exe file to run in the system's tray and have the .bat file close. |
|
| 2980. |
Solve : TimeStamp on the Log file? |
|
Answer» Hi, |
|
| 2981. |
Solve : how to include multiple commands in FOR loop? |
|
Answer» HI, Everyone! I have a question. In MS-DOS in a batch file I have a FOR loop for %%d in (1 2 3 4 5) do after DO I want to have multiple COMMANDS How do I do that? Thank you! DorothyHello, You can call ANOTHER batch file after do command. For example: for %%d in (1 2 3 4 5) do call another.bat %%d The another.bat batch file can have some commands and it will be executed with %%d parameters any times. |
|
| 2982. |
Solve : Help with an batch file that doesn't close? |
|
Answer» @echo off |
|
| 2983. |
Solve : Batch File for Counting # of files in directory?? |
|
Answer» Hi Folks! |
|
| 2984. |
Solve : Installing W95 on bare-drive? |
|
Answer» I have a 20Gb HDD that I formatted to bare metal. Using an ASUS 440LX MB. |
|
| 2985. |
Solve : Regarding batch file (to map a free drive)? |
|
Answer» hi, |
|
| 2986. |
Solve : CLMODE? |
|
Answer» I tryed to reinstall win95 and it SAYS that windows can't RUN in DOS mode. In the top LEFT corner of the screen it says CLMODE. Can anyone TELL me how to EXIT CLMODE |
|
| 2987. |
Solve : PC won't load boot disc? |
|
Answer» I shut down by turning it off at the button, instead of a proper shut down and I get a "Your CPU has changed or over-clocking". I had seen this before, and seen how the person had fixed it (or so I THOUGHT), I went into BIOS and altered the frequency. |
|
| 2988. |
Solve : Running an exe on remote pc? |
|
Answer» I am having 2 PC's connected to the same DOMAIN. One pc (PC1) is having an exe file and what I WANT to do is from another pc (PC2) I want to start/run that exe file which is in PC1. Moreover it should be running on the PC1 and should not be visible to me and I will be sitting on PC2. Any help will be greatful. |
|
| 2989. |
Solve : mouse help? |
|
Answer» I am having a PROBLEM getting my mouse to work in dos. (IE: Pool)lgray9......you didnt provide any info like your o/s and what APP your TRYING to use the mouse with .....but if you read ..... |
|
| 2990. |
Solve : %date% variable Win2K? |
|
Answer» Hi GUYS, |
|
| 2991. |
Solve : c:\windows\system\32\autoexe.nt? |
|
Answer» for xp USER..SOMETIMES when i TRY to install stuff on my pc the subject message APPEARS along with this...the system file is not suitable for running ms-dos and microsoft windows APPLICATIONS...and nothing will installhttp://support.microsoft.com/default.aspx?scid=kb;EN-US;142026 |
|
| 2992. |
Solve : need help on the dos code...? |
|
Answer» hey guys, |
|
| 2993. |
Solve : MS-7.10 installation? |
|
Answer» CPU athlon 750mhz/256mbs. |
|
| 2994. |
Solve : how i make a boot disk. which connet to the? |
|
Answer» i WAN CRATE a boot disk, when the boot i can connect to SHARE recurse and dowload a file. |
|
| 2995. |
Solve : NFTS? |
|
Answer» How do I make my C: DRIVE to FAT????You will have to format. You can CONVERT from FAT or FAT 32 to NTFS but you can't convert BACK |
|
| 2996. |
Solve : Who's an expert with dos?? |
|
Answer» Hi there, |
|
| 2997. |
Solve : HELP: how to work with spaces in DOS?? |
|
Answer» I accidently created FILE names with spaces in the name, i.e., ACE 005.DAT, ACE 006.DAT, etc. |
|
| 2998. |
Solve : Copy file(s) to multiple computers? |
|
Answer» I need to copy files to various computers and would like to do it as automatically as possible. Instead of copying the files to each COMPUTER INDIVIDUALLY, I´d like to use a batch file that takes care of this with just one click. |
|
| 2999. |
Solve : Transfer of control to command prompt? |
|
Answer» Does anybody know if there is anyway to transfer control to a new command prompt from the existing one? |
|
| 3000. |
Solve : Nested If commands? |
|
Answer» I have a .BAT program that for some reason, does not execute the COMMANDS like I expected. The code: |
|