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.
| 5001. |
Solve : PLEASE HELP ME my Drive D is under attack!? |
|
Answer» PLEASE HELP ME my Drive D is under attack! PLEASE HELP ME my Drive D is under attack!Please calm down. Did you get any error MESSAGES when you performed the command? Did you do anything after that? What MESSAGE do you get when you try and open the D: drive? |
|
| 5002. |
Solve : naming file name dynamicaly in dos? |
|
Answer» i need to assign a text file name into a variable in dos command. the text file name is created based on date. like 020809.txt Tomorrow the file name will be 030809.txt How can i assign this type of text file name into a variable in dos command?please correct me if i am wrong, but do you want to get the date from 1/23/45 to 12345? @echo offThis isn't one DOS command, it is a group of them. They can be used in a batch file (.bat file). Paste the script into NOTEPAD (Notepad.exe) and save it as script.bat (but it could anything you want .bat), double-click the NEWLY created file and let it do it's thing. |
|
| 5003. |
Solve : Search for String in file and remove it? |
|
Answer» Hi i dont use REM to comment, i use ::. Using a broken label as comment starter in a loop or other parenthetical structure will break it. however... Code: [Select]@echo off % This is a comment % echo hello world for %%A in (a b c d e) do ( % This is a comment % echo %%A ) Quote from: Dias de verano on April 03, 2009, 04:50:07 AM Using a broken label as comment starter in a loop or other parenthetical structure will break it.here is a good explanation on double colon :: or using REM as comment: http://www.robvanderwoude.com/comments.php it seems to be common practice in batch to use ::., and i personally prefer :: double colon, because it makes my code more readable. ok, not really, in fact, i rarely put comment on my batch code. now, here is another case, which one would be executed faster: 1. for /f "tokens=*" - default delims is {TAB}{SPACE} 2. for /f "delims=" - default token is 1 since microsoft don't publish his source code, it looks like no.2 will be faster by a split nano-second because it don't do parsing operation. but my preference is no.1, because it seems code is more readable using no.1 unless microsoft pseudocode is: Code: [Select]s=readline if tokens=* or delims is empty then //do nothing else //do parsing on string s end if well, in batch, there is no need to follow the rule of correct syntax. here is an example to count number of words, with limitation Code: [Select]set s=sample test string set/a n=1+.%s: =&set/a n+=1+.%% echo words=%n%Quote from: Reno on April 04, 2009, 07:38:59 AM here is a good explanation on double colon :: or using REM as comment: Yes, I am very familiar both with Rob's pages and with the arguments for and against using :: as a comment marker. Quote it seems to be common practice in batch to use :: A bad practice in my opinion, (but only my opinion!) Quote ., and i personally prefer :: double colon, see above. Quote because it makes my code more readable. That is, again, a matter of opinion. batch code has different readability requirements compared to (e.g.) poetry. Quote ok, not really, in fact, i rarely put comment on my batch code. Like many sloppy programmers? Quote now, here is another case, which one would be executed faster: Doesn't matter. Nobody codes in batch for speed. Quote code is more readable using no.1 Code is more readable (to the coder) if it contains that coder's preferences, then (a circular argument)? Quote well, in batch, there is no need to follow the rule of correct syntax. So you say Quote here is an example to count number of words, with limitation That is a hack! When writing your own batch code, comment style and obeying rules of syntax are of course optional. However this is a forum where we give guidance to new and/or confused users, and in that situation, in my opinion, clarity and ease of understanding are more important than clever coding tricks. for comments, I prefer /*...*/ blocks. but every time I try and use it, my batch breaks! so I change it back to Code: [Select]REM now, use xcopy to copy the favourite goat pictures to a backup disk. xcopy "..\Pics\Stay out\Hey, I said stay out\OK, seriously, how many times do I have to tell you\ok fine, (wrapped) COME on in\well there goes my reverse psycology idea\more goat pics\Bessie" I:\BACKUPS\BESSIE /S I just counted my BCFile project, and it contains 9,416 (72%) Code lines, and 3,518 (27%) comment lines. and as for esoterics and readability, I'm probably at my worst in this section with string manip. I've become so practices with the VB string manipulation functions, I simply nest a bunch of them on one line,- a sample dug out from deep within my BASeParser evaluator LIBRARY: Code: [Select] SplMake(CurrArgument) = Mid$(FromString, ArgStart, (CurrPos - ArgStart) + 1) If right$(SplMake(CurrArgument), 1) = ARGUMENTSEP Then SplMake(CurrArgument) = Mid$(SplMake(CurrArgument), 1, Len(SplMake(CurrArgument)) - 1) End If Quote from: BC_Programmer on April 04, 2009, 10:52:46 AM I've become so practices with the VB string manipulation functions, I simply nest a bunch of them on one line I do this a lot in VB6, VBScript, QB etc. QB is a pain. I keep trying to use TRIM$... but there isn't one. so I end up doing LTRIM$(RTRIM$()) which is slightly longer. I just can't stand that technically VB is working with an immutable string and always creates a completely new string...I don't actually use QB any more. That Ltrim(Rtrim(string)) thing was the first thing that popped into my head when I read your remark about nesting string functions all on one line. you use Freebasic. I would too, but I managed to hack pretty good console support into Visual Basic, which would likely have been my only reason to use FreeBASIC.Code: [Select]@echo off set '=REM %'% this is a comment echo hello world Quote from: Dias de verano on April 04, 2009, 01:37:00 PM Code: [Select]@echo offhahaha, nice one, almost got me. C:\>set ' '=REM Quote from: Dias de verano on April 04, 2009, 09:17:07 AM That is, again, a matter of opinion. batch code has different readability requirements compared to (e.g.) poetry.yes i am one of them , i dont have the time to write any comment about the code, just too busy thinking more trick to cramp multiple lines of codes into one line. and i always like one liner code which do the same job as the for example 10 lines of if else if else for loop. only in batch though, not so easy to do with other programming language, such as vb, vbs, etc. Quote from: BC_Programmer on April 04, 2009, 11:37:58 AM I would too, but I managed to hack pretty good console support into Visual Basic, which would likely have been my only reason to use FreeBASIC.BC, how do you implement console support into VB aps? do you use reference to scrrun.dll Scripting.FileSystemObject, or using GetStdHandle API then later use link.exe or something else?Quote from: Reno on April 05, 2009, 01:13:38 AM hahaha, nice one, almost got me. Huh? Code: [Select]S:\Test\Batch>type remtest.bat @echo off set '=REM %'% this is a comment echo hello world S:\Test\Batch>remtest.bat hello worldQuote from: Dias de verano on April 05, 2009, 02:38:24 AM Huh?at first, i though you use vb commenting style, wait, how that's going to work? then i realize you just create a variable ' with value REM. lol. Quote from: Reno on April 05, 2009, 03:03:23 AM i realize you just create a variable ' with value REM. lol. Good old cmd.exe runtime variable expansion Code: [Select] @echo off set gosub=call set return=goto :eof echo in main %gosub% :sub1 goto :end :sub1 echo in subroutine %return% :end Quote from: Reno on April 05, 2009, 01:13:38 AM only in batch though, not so easy to do with other programming language, such as vb, vbs, etc.Don't be silly. Take this, for instance: Code: [Select]Public Function InStrCount01( _ String1 As String, _ String2 As String, _ Optional ByVal Start As Long = 1, _ Optional Compare As VbCompareMethod = vbBinaryCompare) As Long Dim lenFind As Long lenFind = Len(String2) If lenFind Then ' silently correct illegal Start value If Start < 1 Then Start = 1 End If Do Start = InStr(Start, String1, String2, Compare) If Start Then InStrCount01 = InStrCount01 + 1 Start = Start + lenFind Else Exit Function End If Loop End If End Function I say BAH to that procedure, This one is much better: Code: [Select]Public Function InstrCount(ByVal InString As String, ByVal StrFind As String, Optional ByVal Start As Long = 1, Optional ByVal compare As VbCompareMethod = vbBinaryCompare) As Long If StrFind = "" Then InstrCount = 0 Else InstrCount = (Len(InString) - Len(Replace$(InString, StrFind, "", Start, , compare))) / Len(StrFind) End If End Function Which ties in with the whole bunch of string functions/operations one line thing. Quote BC, how do you implement console support into VB aps? It's a secret ... sort of. But I'll share. Essentially the second method, using WriteFile,ReadFile on the Handles returned by GetStdHandle. It's wrapped in a neat module that I can drop into each Console program. I then run this VBScript, which runs my LINK.EXE (as you've said) to switch the executables subsystem: Code: [Select] Option Explicit Dim strLINK, strEXE, WSHShell ' Be sure to set up strLINK to match your VB6 INSTALLATION. strLINK = """D:\Programs\Microsoft Visual Studio\VB98\LINK.EXE""" strEXE = """" & WScript.Arguments(0) & """" Set WSHShell = CreateObject("WScript.Shell") WSHShell.Run strLINK & " /EDIT /SUBSYSTEM:CONSOLE " & strEXE Set WSHShell = Nothing WScript.Echo "Complete!" I normally only use the scrrun FSO for VBScript's designed for others- I've been trying to give my BCFile library some exercise. Main benefit being that it can show the explorer menu for any file/folder- as well as including a FileSearch and FileSearchEx classes. |
|
| 5004. |
Solve : Who's up to the challange???? |
|
Answer» hey all, or just get some software that is professinally made to change registry keys REGEDIT.Quote from: macdad- on June 26, 2008, 04:21:43 PM not saying that your stupid There are many that have..... This is what I've got so far. I've completed all steps listed on Symantec's website but after I've removed Endpoint I can't INSTALL my version as it fails half way through the installation process. (Something about the wizard being interrupted) Can someone have a quick look at the attached .zip file for me and make sure I've got it right??? There is no big drama about screwing the registry as I'd just reinstall XP if it does fail, but I'd RATHER fix an issue than cover over it's cracks. (plus backing up users profile's and installing XP on 5 machines isn't a job I want to fo on a Friday!!) You'll notice that it's in quite a few parts, I was following the instructions completely, doing everything in order. (I hope!) Cheers in advance [recovering disk space -- attachment deleted by admin]ok, I've found a snag..... I'm having troblue editting the vaule of a REG_EXPAND_SZ key. I'm doing this via a reg file; Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\RasMan\PPP\EAP\13] "ConfigUiPath"=C:\WINDOWS\system32\ratls.dll (also tried) - "ConfigUiPath"=hexadecimal(2):C:\WINDOWS\system32\ratls.dll but no matter what i do I can't change the value. I can delete the key, but that no good as I can't re=create it. I think the secound : might be casuing issues. Any ideas???ok, fixed that bit. I had to use hex as the value in the reg file; "ConfigUiPath"=hex(2):43,00,3a,00,5c,00,57,00,49,00,4e,00,44,00,4f,00,57,\ 00,53,00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,72,00,\ 61,00,73,00,74,00,6c,00,73,00,2e,00,64,00,6c,00,6c,00,00,00 Only trouble now is I still get the same error when trying to install the next version. Grrrrrrrr Quote from: blastman on June 26, 2008, 03:05:32 AM hey all,hmm... you mean you haven't solve this? its been that long and its only 5 machines. you could have manually done it and solve it by now. Quote from: ghostdog74 on June 27, 2008, 08:23:48 AM hmm... you mean you haven't solve this? lol, I forgot I started that thread. Yes it is the same set of machines. The problem is that the users work so many long HOURS and I can't really get near the *censored* things, and when they first arrvied (time of first post) the priority was to get them on the desks and working otherwise I'd have used the 2 hour long script. - which I've now lost... I had used a script supplied by the previous company and it worked, but the machine had "issues" after that so I ended up doing a fresh install of XP anyway. I reckon I have everything removed and all the steps covered on Symantec's website, but I'm having problems installing our version of antivirus now. It seems that the removal process deleted a few services and the install process KEEPS failing when it try's to start the "Symantec AntiVirus" service. It has a dependent (ccSetMgr) that was removed during the instructions from Symantec and every attempt to recover it has failed. I managed to the revalent key back, and the service appears in service.msc but it won't start, giving "The process didn't start or respond to the control request in a timely fashion." error. I'm left with a machine that won't install cos a poxy service won't start right!!! GRRRRRRR - time for a coffeedoesn't your company use cloning technology ? If it does, i am sure you can get a new OS up and running within few hours. |
|
| 5005. |
Solve : search for white spaces in text files..? |
|
Answer» how to search for WHITE spaces in a text file and TRUNCATE 'em and then find matching string from a GIVEN list of FILES, using windows Batch files....how to do homework? |
|
| 5006. |
Solve : Help On Health/Damage Calculation? |
|
Answer» Basically i have this: Quote from: Jacob on June 26, 2008, 11:29:13 AMCharge is just an attack styleBasically i have this: and yes those ones are meant to be mathematical sums.Quote from: Jacob on June 26, 2008, 11:29:13 AM I am not too sure how to do +,-,* and / in MS-DOS/Batch. You have to use set with the /a switch to do calculations. A is for Arithmetic. set /a sum=%NUMBER1%+%number2% That works, thanks, but what to i do if i want to 'goto dead' if %ECHP% is less than or equal to 0. Thank you.Quote from: Jacob on June 26, 2008, 12:29:11 PM That works, thanks, but what to i do if i want to 'goto dead' if %ECHP% is less than or equal to 0. if %ECHP% LEQ 0 goto dead It's all in the IF help, which you can access by typing IF /? at the prompt. Thank you, i have no finished my basic battle/fighting ENGINE. |
|
| 5007. |
Solve : Using the DIR function after launching a .BAT file from a Javascript? |
|
Answer» Hi, I tried running the batch file by itself and it works correctly, it's only when I launch it from Javascript that it gets mixed up. Is there a way to fix that, or is there a way to link to the .bat file's own directory with some code? I take it the folder that contains the java script your running is different from the batch file's working directory. I'd add "CD C:\path\to\batch\file\working\directory" to the top of the batch file. That way when it does the rest of code it's ALREADY in the correct location. Quote from: FausseFugue on June 25, 2008, 02:13:24 PM I'd also like to know if it's possible to send a variable from Javascript to a Batch file? Yeah, when starting the batch file add the variable to the end. "run batch_file.bat variable" (forgive my complete lack of javascript knowage!!) I believe you can add up to 3 variables this way. The batch file will see these variables as %1, %2 and %3 (in entered order) You can then use "set variable_name=%1" and so on. Hope it helps. Every batch file knows the folder where it is located (stored). This is held in a special variable %0 (read that as percent zero). You can use the normal variable modifiers so that %~dp0 is the complete drive letter and path.Quote from: Dias de verano on June 25, 2008, 03:41:48 PM Every batch file knows the folder where it is located (stored). This is held in a special variable %0 Didn't know that.... Nice one. Quote from: blastman on June 25, 2008, 04:04:15 PM Quote from: Dias de verano on June 25, 2008, 03:41:48 PMEvery batch file knows the folder where it is located (stored). This is held in a special variable %0 I made a slight error. %0 is the batch file's own FILENAME %~dpnx0 is its drive, path, filename and extension %~dp0 is its drive and path Wow, thanks a lot to you both for this quick reply, this will really help!!!Actually, I just tested and both solutions don't work. For: Quote "run batch_file.bat variable"In Javascript we use the execute command, so it normally looks like this: File("C:/Folder/File.bat").execute() so I tried: File("C:/Folder/File.bat variable").execute() but it doesn't work. It doesn't do anything, it doesn't EVEN execute the batch file. For: Quote %~dp0 is its drive and pathI tried: ECHO %~dp0 that works fine. But when I try: CD %~dp0 it doesn't work. If anyone would know a solution to those two problems I would really appreciate! Thanks!Quote from: FausseFugue on June 26, 2008, 06:56:53 AM File("C:/Folder/File.bat variable").execute() Sounds like it looking for the file "file.bat varaible" which does exist. I'd try; File(""C:\folder\file.bat " variable").execute() Pleae bear in mind I know NO JS at all! this is based on other shell script's ie, vbs Quote from: FausseFugue link=topic=60062.msg380322#msg380322 But when I try: "It doesn't work"... every help forum helper's favourite answer!!! (Not). Just how does it "not work"? try cd /d "%~dp0"Thank you both again! Quote File(""C:\folder\file.bat " variable").execute()That doesn't work in Javascript, but now I don't absolutely need that anymore since this works: Quote cd /d "%~dp0"so I can store my variables in a tmp file in the folder where the .bat file is located and use this code Code: [Select]SET /P VARIABLE=<"variable.tmp" to get the variable in the .bat file. Thank you! |
|
| 5008. |
Solve : Limitation in MS DOS batch file?? |
|
Answer» in order to ACCESS parameters beyond %9, it would be necessary to employ the SHIFT command, which shifts all the parameters down a notch, what would be beyond %9 becomes %8,%8 becomes %7, etc.. and %1 is removed. (-6.26620974,53.34899072) |
|
| 5009. |
Solve : I need help with outputting data from a runas command? |
|
Answer» As the subject states I need some help with outputting whats printed to the Dos screen after the runas command is executed. Now I can get it to output... |
|
| 5010. |
Solve : Possibility?? |
|
Answer» Is it possible for the user to select an option like this: |
|
| 5011. |
Solve : Assign keystroke to mousebutton in batch? |
|
Answer» HEYA. First of all of course: is it at all possible to configure mouse buttons in batch? I want to use it as a remote control for Winamp so I want to bind the global hotkeys (ctrl-alt-pgdn/up etc.) to like.. the thumb button on my Logitech G5 mouse. 'Course there are easier ways to do this but it's more of a hobby to get this method to work than that it is usefull Of course any other (batch) way to achieve the same result does just fine too.(Bump) I couldn't find anything regarding this kind of DOS use through the search box nor Google. Even if you are not a professional, please share your thought on whether it is at all possible or not...So you mean like you want a batch file to turn right click into something else? I really DOUBT this is possible...Quote from: Carbon Dudeoxide on June 25, 2008, 05:28:19 AM I really doubt this is possible... + 1K, guess that's enough info for me then thanks |
|
| 5012. |
Solve : multiple file remanes with suffix .bat? |
|
Answer» C:\test>a NOW i have tried using many thing but it just didn't work Didn't work how? While a few of the MEMBERS may be psychic, even fewer are detectives. Base on the information you provided, this may work. Notice the move does the rename all in one command. Code: [Select]@ECHO OFF FOR /F "tokens=2,3,4 delims=/ " %%A IN ('date /t') DO SET DATEVAR=%%B%%A%%C FOR /F "tokens=5,6,7 delims=:. " %%A IN ('ver ^| time') DO IF NOT "%%A" == " %1" SET DATETIMEVAR=%DATEVAR%_%%A%%B%%C echo %DATETIMEVAR% for /f "tokens=1-2 delims=." %%x in ('dir /b c:\test') do ( move c:\test\%%x.%%y c:\test1\%%x*_%DATETIMEVAR%.%%y ) Good luck. C:\test>a 24062008_145426 The filename, directory name, or volume label syntax is incorrect. what is wrong? NOTE is should move and rename only files with extension .sft the .bak files should ignored from the whole process. regards, nkrsticYou typed it in wrong. i did copy and pasteThe original post was edited 28 minutes after the first reply, rendering any continuity in this thread meaningless. For anybody trying to make SENSE of this thread, I wish you luck. Hi Ill try to explain one more time, maybe you or anyone can help thank! FOLDER C:\TEST\ MT210.sft MT200.sft MT300.sft MT2102008202030.bak MT2002008303020.bak MT3002008151515.bak I need to move only the .sft files ( not the .bak they are not to be touched) to another folder c:\test1 and add a date-time stamp at the end of the name in the following format; MT210_DDMMYYYY_HHMMSS.sft I have tried using the script posted earlier but it didn't work. Help anyone! reagards, nkrstic Sorry Sidewinder I am new to the forum, sorry for the confusion! nkrsticfor /f "tokens=1*" %%a in ('dir C:\tst\*.sft /b') do move C:\tst\%%a %%a_%date:~4,2%%date:~7,2%%date:~10,4%_%time:~0,2%%time:~3,2%%time:~6,2%.sftThanks but i got an error; The syntax of the command is incorrect.Your original script generated the the datetime variable correctly. The original reply had an typo and did not filter the sft files. This should fix you right up: Code: [Select]@ECHO OFF FOR /F "tokens=2,3,4 delims=/ " %%A IN ('date /t') DO SET DATEVAR=%%B%%A%%C FOR /F "tokens=5,6,7 delims=:. " %%A IN ('ver ^| time') DO IF NOT "%%A" == " %1" SET DATETIMEVAR=%DATEVAR%_%%A%%B%%C echo %DATETIMEVAR% for /f "tokens=1-2 delims=." %%x in ('dir /b c:\test\*.sft') do ( move c:\test\%%x.%%y c:\test1\%%x_%DATETIMEVAR%.%%y ) Thank you !!!! IT WORKS GREAT... GREAT FORUM |
|
| 5013. |
Solve : How to input line commands in another program from DOS? |
|
Answer» Hi, I've been reading your posts, but I couldn't find a problem similar to what I have. I'm trying to create a DOS FILE to input line commands in another program, FLUENT. FLUENT has a line command like DOS, and I wanted to create an executable or .bat file to open (a simple START Fluent.exe), and then input commands to the fluent command line. For example, something to write FILE in FLUENT's command line. Any ideas would be very much appreciated! Nice piece of code but Dos can not really use a vbsBy using start "" filename.vbs, it runs the script outside the DOS.An alternative METHOD would be to have the script launch Fluent. Missing from the previous VBScript is grabbing a handle on the Fluent window. Consequently, the destination of the keystrokes is unpredictable. Code: [Select]Set WshShell = CreateObject("Wscript.Shell") WshShell.Run "Fluent.exe",,False WScript.Sleep 100 WshShell.AppActivate "Fluent Window Title" WScript.Sleep 100 WshShell.SendKeys "command{enter}" WScript.Sleep 100 Just a thought. Hi, thank you all for your ideas! It turnsout it was simple, all it needed was a batch file with an indication like 'fluent -g -i start', being start' a journal file with all the inputs I wanted to give through the command line! Thank you all very much! IsabelQuote from: IMartins on June 24, 2008, 11:17:08 AM 'fluent -g -i start' that looks awfully like a command line switch to me....... Yes, you're right, but when I tried "fluent.exe /?" it didn't return a thing, so I thought it didn't have those capabilities, until I found a pdf that explained exactly how to do it. Thanks for your trouble!Quote from: IMartins on June 25, 2008, 04:32:10 AM I tried "fluent.exe /?" it didn't return a thing I'll let you off then... Just pleased it's working now. |
|
| 5014. |
Solve : COPY SPECIFIC CONTENTS OF ONE FILE TO ANOTHER FILE..??? |
|
Answer» How can i copy some specific contents from ONE .txt file to another .txt file, but in a certain way though.. |
|
| 5015. |
Solve : Need help with tokens? |
|
Answer» I am NOT a DOS programmer - but I need some help writing this simple utility. I want the batch to read |
|
| 5016. |
Solve : Adding comments in a DOS Batch file that are not sent to DOS window? |
|
Answer» Hello, |
|
| 5017. |
Solve : call DOS script in Remote server? |
|
Answer» i WANT to execute a DOS batch file in remote server. how to invoke script in remote server?? PLS advicedepends what your after; |
|
| 5018. |
Solve : Reading webpages through batch?? |
|
Answer» Hi all! was wondering if it's possible to make a batch file that connects to the internet and looks at a web page, and if it sees a certain trigger word (E.g: It sees the word "mudcake")it would execute an action Only if the batch file launches a WINDOWS script. Most of the script languages provide for interaction with the web. Batch code not so much (actually not at all) VBScript and Jscript come installed with Windows. Perl, PHP, Python, and REXX are ALSO tools you can use, however each must be downloaded. (all are free). Quote from: Sidewinder on June 24, 2008, 05:39:07 AM Quotewas wondering if it's possible to make a batch file that connects to the internet and looks at a web page, and if it sees a certain trigger word (E.g: It sees the word "mudcake")it would execute an action Thanks for the fast reply Sidewinder Do you know which of those languages would be simplest and most conveniant?My personal favorite is REXX. It has only 20 odd instructions to learn and is darned near idiot proof As mentioned it does require a download and install. For convenience, VBScript comes already installed with Windows. This site has many tools, articles, and sample scripts to help you out. This little snippet will give you an idea how your request looks in VBScript: Code: [Select]Set objIE = CreateObject("InternetExplorer.Application") objIE.Navigate "http://www.yahoo.com/" Do While objie.Busy WSCRIPT.Sleep 500 Loop Set ieRange = objIE.Document.Body.createTextRange If ieRange.FindText("Mudcake", 0, 2) = True Then MsgBox("Mudcake Found") End If objIe.Quit The Yahoo ADDRESS is an example. Any address can be used. Quote from: Sidewinder on June 24, 2008, 06:31:31 AM My personal favorite is REXX. It has only 20 odd instructions to learn and is darned near idiot proof As mentioned it does require a download and install. For convenience, VBScript comes already installed with Windows. Thank you so much again Sidewinder, i only have 1 last question. How do i execute programs in VBscript?One way is to type the scriptname at the command prompt, much like a batch file. The vbs extension was registered when you installed Windows. Another is to use a specific script host: wscript scriptname.vbs or cscript scriptname.vbs either at the command prompt or the Windows Run box. If you really want to impress your friends, you can write scripts in WSF files where you can use multiple languages in a single script and you can create multiple scripts within a single file. Happy Coding. |
|
| 5019. |
Solve : Incrementing part of multiple files? |
|
Answer» Of 1434 .jpg files, all named "Picture [number]" how can I increment all of the files after the 230th by one? Such that "Picture 231" becomes "Picture 232" and so on. Sorry to ask such an amateur question, but I have no experience with .bat files and this needs to be done fairly quickly, while the prospect of renaming each file myself is somewhat less then attractive considering their number. More IMPORTANTLY is your OS. Microsoft usually adds UTILITIES and batch code facilities with each new release. Without knowing your OS we have no idea what functions are AVAILABLE on your machine. This may work: Code: [Select]@echo off setlocal enabledelayedexpansion for /l %%v in (1434, -1, 231) do ( set /a w=%%v+1 ren "picture %%v.jpg" "picture !w!.jpg" ) Ah my bad. It's Windows XP - Media Edition I believe. I'll go try that out now. |
|
| 5020. |
Solve : dir \My Documents? |
|
Answer» I am trying to work at the DOS command PROMPT. EVERY time I type in |
|
| 5021. |
Solve : creating filename with date? |
|
Answer» I have searched through this site and found this code that looked like it should work in reference CH000987: |
|
| 5022. |
Solve : find string in txt file, return true value? |
|
Answer» hey all, |
|
| 5023. |
Solve : Conditional statements in DOS batch files? |
|
Answer» Hello, I want to run a program but only if all 9 files exists. The program will run without error as long as one of more of the files is available. Seems contradictory. This little snippet will test for all files being available. It's a simple change to have one or more available. Code: [Select]@echo off set count=0 for %%V in (2007_033.h20v08.hdf 2007_033.h20v09.hdf 2007_033.h20v10.hdf 2007_033.h21v08.hdf 2007_033.h21v09.hdf 2007_033.h21v10.hdf 2007_033.h22v08.hdf 2007_033.h22v09.hdf 2007_033.h22v10.hdf) do ( if exist %%v call set /a count=%%count%%+1 ) if count neq 9 goto :eof . . put your code here . . . Quote For 3 conditions you'll need 2 if statements, for 4 conditions you'll still want 2 statements. For 5 conditions you require 3 statements and so on... Perhaps someone could explain this statement. Quote from: Sidewinder on June 22, 2008, 02:36:05 PM
I'd be surprised. Sidewinder, Thanks for the For-loop. I hope to use it this WEEK sometime. Perhaps I should explain my purpose even more since my explanation above seemed contradictory or at least confusing. The nine hdf files are MODIS satellite images of different but adjacent portions of East Africa from the same 8-day period. The mrtmosaic program will mosaic these adjacent images into one image. mrtmosaic, however, is designed for researchers having different areas of interest. So mrtmosaic will mosaic as many or as few images as are supplied to it, whether there are 9, 2, or 50 images. You get the picture. Due to atmospheric conditions, not all images are available for each time period. Since my team can only use a mosaiked image if it covers the ENTIRE area of interest, and I have thousands of time periods to process, I only want to mosaic those time periods for which all 9 images are available and skip the time periods with incomplete imagery. Thank you again. By the way. Your answer incorporated a For-loop which is another programming design I wanted to use in other applications. So your one answer has HELPED me twice. Quote from: Dias de verano on June 22, 2008, 03:35:59 PM Quote from: Sidewinder on June 22, 2008, 02:36:05 PM Surprised??? whys that?? OK the sentence and grammar are very poor. (had been a long day) I was trying to explain that if you have 2 conditions (yes/no for example) you'd need 1 if statement. If you had 3 conditions, you'll need 2 if statements and so on. I was under the impression that this was what the OP was after. I misunderstood. |
|
| 5024. |
Solve : changing ipnumber? |
|
Answer» there's one thing i never done before and that is changing my ip from dos if theres a POSSIBILITY i want to know how to make a batch file that changes myI am not professional with this but I fear that it's impossible. Probably changing you IP can be done but changing it from automatic to manual... If I'm not wrong you might try finding a .com or .exe written especially for networking configuration, put it in your system folder and USE it through batch. Again, sorry if I am totally wrong. Don't trust me I'm not 100% sure either but I remember reading somewhere that you cannot change your IP through a Batch file. Any reason why you want to change your IP?becuse some times i use a crossed network cable between me and my friends computer and then i have to write in local ip manually, and some times i use my router. okey but is there a possibility that I can handle that with c++?Quote okey but is there a possibility that I can handle that with c++?I think you can only change your IP if you contact your ISP but I'm not really sure. Hang tight and someone will give you a straight answer. Depending on your OS you might have access to the netsh utility. CHECK out this link to find out how it may be helpful. Good luck. Quote from: Sidewinder on June 23, 2008, 07:07:11 AM Depending on your OS you might have access to the netsh utility. Check out this link to find out how it may be helpful. thank you side it was the answer i was looking for =)Heh, nice one...TNX, Learnt that Netsh is the app. I was aiming at in my first reply |
|
| 5025. |
Solve : Tip: How to make zero length files? |
|
Answer» Code: [Select]type nul>zerosize.zzz What about No it doesn't. The file has 2 bytes: 1 carriage return, and 1 line feed Code: [Select]C:\>echo.>>file.jpg C:\>dir file.jpg Volume in drive C is WinXP Volume Serial Number is FC8E-1A31 Directory of C:\ 22/06/2008 11:14 2 file.jpg 1 File(s) 2 bytes 0 Dir(s) 11,525,836,800 bytes free Oh ok. Thanks.Still what I don't get is where/how it stores the file name... it sure hás to. EVEN though the actual data is null.Quote from: Schop on June 22, 2008, 06:01:09 AM Still what I don't get is where/how it stores the file name... it sure hás to. Even though the actual data is null. In an index type file system structure. The FAT file system uses a file allocation table, and in NTFS, the Master File Table. So when I create zero length FILES, eventually my disk gets occupied just by my MFT, and I've read that the MFT doesn't shrink (delete entries) when you delete files? If so you could easily clog up disk space with like... twenty or so? bytes at a time. I might just go figure out a batch LOOP to write a "few" zero lengths (edit) Did some research (creating lots of zero length files END calculating disk space per file) and figured they use like.. 1.2 Kb per file and when deleted there are Five bytes freed up (guess the write PROTECTION takes five bytes then) This was done on a 500Gb drive with 512 cluster size NTFS btw. Anyway, can any one point me to some accurate data on this? Just interested |
|
| 5026. |
Solve : how to compile c programe from commond line?? |
|
Answer» hi FRIENDS, |
|
| 5027. |
Solve : i have searched to site over and found answers to parts of my question scattered? |
|
Answer» i am in a MESS it is simple i open my cmd and command prompt to type commands and i get internal external command not recognized. what disk do i use? for external commands and are my internal commands in a wrong folder and also when i type a command a new window with file, or a edit bar does not pop up a blue window. i have worked for 3 days day and night now i am asking this simple question. and might i add i have followed your batch file ms dos command a hundred times nothing i can't get dos to work only the dir, command only i cant change of move i know this question has to be somewhere i am sorry please tell me what i am doing that i can't get the commands to work. maybe i should add i have WIN 98 dos files in a seperate folder i can't find xp folder i took out a cab folder from win 98 i read that i a booboo where should my files be i have followed your batch file ms dos command a hundred times nothing i can't get dos to work only the dir, command only i cant change of move i know this question has to be somewhereWhat does this mean? Quote from: Ruby04 maybe i should add i have win 98 dos files in a seperate folder i can't find xp folder i took out a cab folder from win 98 i read that i a booboo where should my files beAnd this? If you mean you are booting to Windows 98 then trying to locate folders/files on an NTFS partition then the answer is that this cannot be done. Win 98 will not recognize NTFS. If you are booting to Windows XP and receive the error message command not recognized when entering commands at the Command Prompt then it might be that the folder C:\Windows\System32\ does not appear in your Path environment variable. Did all your problems suddenly appear or have they grown over a period? Can you be sure your system is not infected? Please read this... i am sorry i am a NEWBIE, i have XP2 PROGRAM. yes i am trying to get dos commands to heed to their commands. i read the dos section, i copied all the commands. i understand what they do. (dos is not foreign to me) i have tinkered here and there. and at no time have i been able to get but a few to work. for that reason, i went under ground and found their files and what i could do with a mouse i have explored(or maybe i haven't) this computer was an upgrade from 98 to XP the dos command prompt wouldn't work until i put in windows 98 dos file into the win32 file(anyway i believe that's what made the prompt work). i can now open the dos window, but every command i type disobey's me. i have a feeling i am missing something very simple maybe the order of process, the disk, maybe a program, a re-boot process. i just need some simple coaching not mentioned in the dos section. by the way when i gave up on the dos commands i stumbled into the edit window and typed a java (welcome.java) file (i am trying to learn to program) i couldn't get it to preform whatever. i saved it and downloaded it into my browser. it did not have a graphic interface. another perdictiment, i downloaded a gnu program. it took me a week going in and out of the files to find the window to type in and, before that a week, to figure out which/how file to put the path to the program in. the intructions kept telling me to put the path in autoexec.exe well XP HAS autoexec.nt. when i tried using the gnu window it kept saying i should close because it couldn't find the path i created. well XP does not have a config file(empty)XP doe not have a config.exe, or an autoexec.exe. remember in am underground opening files with my mouse because i can't get dos commands to work) so i made one or i think i did. i did find the autoexec.nt and i also entered the path there. i also entered a path in the window of the dos interface admin. window. i kept entering and making files because i couldn't get the gnu program to work without warnings. i am telling you this hoping you can get a mental picture of whatever i am missing in programming. the interface of OF WIN 98/XP i can change any setting and i am pretty suave at fixing any problem so long as i stay where a mouse is required. as soon as i GO sub-ground the computer skills stop. it is much simplier when you insert a disk, after the program downloads you go to your desktop and boom an icon. it doesn't work in computer programming. computer programmers who write books and explain the process are excellent instructors but, if they skip a "byte" you don't get to program or get the program to function. there is one way in, one way out, one way process. instructors assume because your reading their book you must know how to get to a file and where it's located but, you don't know how to change the function(not always so) thank you so much for your time so much appreciated beyond every byte! ruby |
|
| 5028. |
Solve : help me, I'm stupid. Simple .bat files question? |
|
Answer» Sorry for bothering you people, but I am realy stupid, and it seems I CANT get even a VERY simple task done. Sorry for bothering you people, but I am realy stupid, and it seems I cant get even a VERY simple task done.there's no stupid people, only LAZY peopleQuote from: Zarevock on June 20, 2008, 06:33:46 PM What I want to know is how can I put multiple command lines in a .bat file, so it may run all of them at once. You can't do that. You can put multiple commands in a batch file, so that it will run them one after the other. I expect that is what you meant? Quote go to the SPECIFIC directory Code: [Select]cd /d "d:\path\to\desired\directory" I am not sure what you mean by this: Quote copy 2 files into one If you mean join two files together to form a third file, then this would do that: Code: [Select]copy file1+file2 file3 Why don't you post the batch file that you wrote, since there may be an error in the first line that stops it ever getting to the second one. It may be usefull to insert a "Pause" command after each line so that you can take time to read the console output and determine what's failing. A simple spelling mistake can be found by reading the output. |
|
| 5029. |
Solve : Read file, filter text and output new file.? |
|
Answer» Hello! But problem is the output file name?! it dosn't work You need to use delayed expansion for the variables in the loop, fail and fail2. OTHERWISE they will be blank. |
|
| 5030. |
Solve : reading and writing to certain lines of a txt file? |
|
Answer» hey all, |
|
| 5031. |
Solve : DOS Rename batch file for files in different directories? |
|
Answer» What I need to do is create a simple batch file that I will run from a logon script. I need the batch file to go out and SEEK all the files names consisting of *ADP*DMS*.lnk and RENAME these to ASP.lnk. The files may or may not always be in the same directory. I CREATED the command: |
|
| 5032. |
Solve : Change Things in Administrative tools? |
|
Answer» Hi, |
|
| 5033. |
Solve : How do you print one of three words at random?? |
|
Answer» Ok I'm trying to set it up so when a certain variable is equal to a certain thing Dos picks from three predetermined words and echos on of them at random, any way at doing this?TRY this |
|
| 5034. |
Solve : random number in dos (xp prompt)? |
|
Answer» hey GUYS, |
|
| 5035. |
Solve : Over look a > but use the >> %filename%? |
|
Answer» Hi all, long time listener, first time caller. rem @ ECHO OFF Using characters that are meaningful to the cmd shell can create all sorts of challenges, but one problem is the unbalanced quotes. Hard to tell if you want quotes in the output or not. No quotes: Code: [Select]rem @ ECHO OFF set filename="WSETTING.WFC" set wepkey="Computer_Hope.com_Rocks" ECHO ^<?xml version="1.0"?^> >> %filename% With quotes: Code: [Select]em @ ECHO OFF set filename="WSETTING.WFC" set wepkey="Computer_Hope.com_Rocks" ECHO "<?xml version="1.0"?>" >> %filename% Sorry about that, I was trying a few things earlier and left that extra quote in there. What I am trying to get accomplished is to have the bath file recreate WSETTING.WFC with the different setting each time so I can run it and add all the wireless settings with little or no manual intervention. Code: [Select]rem @ ECHO OFF set filename="WSETTING.WFC" set wepkey="Computer_Hope.com_Rocks" ECHO <?xml version="1.0"?> >> %filename% The entire code in the WSETTING.WFC I am trying to recreate is: Code: [Select]<?xml version="1.0"?> <wirelessProfile xmlns="http://www.microsoft.com/provisioning/WirelessProfile/2004"> <config> <configId>000E06EE-C94E-432A-B492-12AE01CBF3B8</configId> <configAuthorId>0B4E59B8-8317-46B2-B8C2-C46850162E6C</configAuthorId> <configAuthor>Microsoft Wireless Network Setup Wizard</configAuthor> </config> <ssid xml:space="preserve">SSID_GOES_HERE</ssid> <connectionType>ESS</connectionType> <primaryProfile> <authentication>WPAPSK</authentication> <encryption>TKIP</encryption> <networkKey xml:space="preserve">Computer_Hope.com_Rocks</networkKey> <keyProvidedAutomatically>0</keyProvidedAutomatically> <ieee802Dot1xEnabled>0</ieee802Dot1xEnabled> </primaryProfile> </wirelessProfile> The set command will accept just about any character, so by using quotes with set wepkey="Computer_Hope.com_Rocks", the quotes become part of the string. In addition each and every < and > must be escaped with the caret (^). I could have sworn there was another post in this thread that explained all that, but I'll just chalk it up to another senior moment. This should produce what you're looking for. LOOKS a bit like chicken scratch. Code: [Select]@echo off set wepkey=Computer_Hope.com_Rocks set filename="WSETTING.WFC" >>%filename% echo ^<?xml version="1.0"?^> >>%filename% echo ^<wirelessProfile xmlns="http://www.microsoft.com/provisioning/WirelessProfile/2004"^> >>%filename% echo ^<config^> >>%filename% >>%filename% echo ^<configId^>000E06EE-C94E-432A-B492-12AE01CBF3B8^</configId^> >>%filename% echo ^<configAuthorId^>0B4E59B8-8317-46B2-B8C2-C46850162E6C^</configAuthorId^> >>%filename% echo ^<configAuthor^>Microsoft Wireless Network Setup Wizard^</configAuthor^> >>%filename% echo ^</config^> >>%filename% echo ^<ssid xml:space="preserve"^>SSID_GOES_HERE^</ssid^> >>%filename% echo ^<connectionType^>ESS^</connectionType^> >>%filename% echo ^<primaryProfile^> >>%filename% echo ^<authentication^>WPAPSK^</authentication^> >>%filename% echo ^<encryption^>TKIP^</encryption^> >>%filename% echo ^<networkKey xml:space="preserve"^>%wepkey%^</networkKey^> >>%filename% echo ^<keyProvidedAutomatically^>0^</keyProvidedAutomatically^> >>%filename% echo ^<ieee802Dot1xEnabled^>0^</ieee802Dot1xEnabled^> >>%filename% echo ^</primaryProfile^> >>%filename% echo ^</wirelessProfile^> There doesn't seem to be a setting for SSID_GOES_HERE. Hope this helps or at least gives you some ideas. Question: Is this some sort of template or is there a source for the data?The SSID will vary between the many Access points, the xml code is generated by the Windows Wireless Network Setup Wizard. Thanks for the help on this. It has helped me out a lot. When I get it finished I will let you know how effective it is. Thanks Bud!!Ok, the next step that I can't figure out. This .bat will open Windows Wireless setup wizard and require the user to actually click on the "ok" button. Is there a way to make it run silent or SEND KEY strokes to the active window? The wireless setup wizard is initiated by "setupSNK.exe."Batch code cannot send keystrokes to other processes. The good news is you can write a quick VBScript which can be run from your batch file. Would need to know the title of the window which contains the OK button, whether the OK button has focus when the window opens and if not how many times you have to hit the tab key to give the OK button focus. Did you try running setupSNK.exe from the command prompt using the usual suspects for help functions? (-h, /h, /?, -?). If there is a help function, it should describe any switches that may be helpful. Yeah I tried running it from cmd with help tags trying to find more commands, but don't seem to be any. No matter what you put behind setupSNK.exe, it executes the program and does not display anymore options. First Window: The title of the window is "Wireless Network Setup Wizard." It has two option "Ok" and "Cancel", by DEFAULT "Ok" is selected. Second Window: The title of the window is "Wireless Network Setup Wizard." It only has one option "Ok" and by default it is selected. As far as writing VB, I am still struggling with .bat files. Side note: Sidewinder, I really all your help! Quote The title of the window is "Wireless Network Setup Wizard." I chose not to include the dot. If it really exists, the script can be changed easily. Code: [Select]Set WshShell = WScript.CreateObject("WScript.Shell") WshShell.Run "setupSNK.exe" WScript.Sleep 1000 WshShell.AppActivate "Wireless Network Setup Wizard" WScript.Sleep 100 WshShell.SendKeys "~" WScript.Sleep 2500 WshShell.AppActivate "Wireless Network Setup Wizard" WScript.Sleep 100 WshShell.SendKeys "~" WScript.Sleep 2500 Save the script with a vbs extension, preferably in the same directory as your batch file. In your batch file place the following reference: cscript scriptname.vbs The script will run setupSNK and click the OK buttons as needed. If for any reason the OK buttons do not have focus, the script can be changed to bounce around the window until they do. Hope this helps. |
|
| 5036. |
Solve : Delete A File With No Visible Characters.? |
|
Answer» Hey Guys, I have a program that keeps creating files of 1KB (on Windows XP), but the files contain no characters. If there were no charactors, the file would be zero bytes. What you meant to say was that "the files contain no visible characters." Is it possible the program needs that file (maybe a LOG or something). I don't see any reason why it needs to be deleted. It's not taking up any space. However, if this file is on the desktop, then I UNDERSTAND why you want to delete it.wouldnt be easier to use the sort command, you could create a FOR loop that goes through ever folder in your drive and ever time it changes folders, it uses the sort command to sort the files out and then delete em. How about letting us in on what program is doing this ? ?Quote from: blastman on June 17, 2008, 08:31:30 AM how about; Thank you very MUCH for the responses. The above worked for me w/ a little bit of modification. I appreciate it very much. I'm just pleased something I posted helped someone!!! |
|
| 5037. |
Solve : USB Safely Remove Problem? |
|
Answer» Im using USB safley remove software right now and i want to remove it automatically using batchfile with this command usr stop -d (DRIVE letter) |
|
| 5038. |
Solve : help with if? |
| Answer» | |
| 5039. |
Solve : Making directories using a batch file? |
|
Answer» I am having trouble CREATING a batch file that reads a list of names from a "test.txt" file which contains names like bob,joe,bill each name is on a seperate line. I WANT to set up a batch file which will read test.txt and create a DIRECTORY C:\bob then ANOTHER directory c:\joe etc.... Can anyone help?You can make a FOR loop that does something like |
|
| 5040. |
Solve : Capturing first input only? |
|
Answer» hey all, Don't forget to show us your game when you're done. Gladly, but it might take a while. Ideas just keep coming to me........ so far I've got the basic story line planned out, with a start menu including new game, load and game options. (all work) I've also got my base setup, for buying health, weapons and ammo. it looks good, but I'm still a long way off. Cheers the help. |
|
| 5041. |
Solve : ping port? |
|
Answer» Hi all, |
|
| 5042. |
Solve : How read a particular line from a text file?? |
|
Answer» Hi Friend, Code: [Select]@echo off Why not increment the count like this? Code: [Select]@echo off setlocal enabledelayedexpansion set count=0 for /f %%v in (test.txt) do ( set /a count=!count!+1 if !count!==3 echo %%v ) Quote from: Dias de verano on June 16, 2008, 06:50:06 AM Why not increment the count like this? No particular reason. The result is the same, so I suggest it's a matter of style rather than efficiency. Why do you ask? I was curious why you used found that call set /a %%count%% statement. Quote from: Dias de verano on June 16, 2008, 08:45:35 AM I was curious why you used found that call set /a %%count%% statement. Probably from deranged habit. In the OP case, delayed expansion was necessary, but sometimes other approaches create interesting results: Code: [Select]@echo off set count=0 for /f %%v in (test.txt) do ( call set /a count=%%count%%+1 call echo %%count%% ) The call to echo produces a running tally of the count variable. Without the call, results are less than stellar. If I could have, I'd have called the if statement, but it doesn't QUITE work. |
|
| 5043. |
Solve : How to read particular line from the TXT file?? |
|
Answer» Hi EVERYONE, |
|
| 5044. |
Solve : Ipconfig? |
|
Answer» I went to command prompt and checked my Ip address(Ipconfig /all) and it didn't say that there was an Ip address. The weird thing is that the internet was still working. What the heck is up with that? I'm sticking my neck out here, but footy bores me to tears. As do rugby, cricket, and in fact all sports. Except Olympic women's diving maybe. Women's Beach Volleyball ? ? Tell me you've never watched that.... However Baseball is the ultimate Sport...Period...End.Quote However Baseball is the ultimate SportNow, I'm gonna stick out my head, but to me it's more boring, than chess.Quote from: Broni on June 14, 2008, 06:31:51 PM QuoteSorry for jumping in here but Baseball is got to be the only sport I would sit through (at least longer than any other sport).However Baseball is the ultimate SportNow, I'm gonna stick out my head, but to me it's more boring, than chess. Go Boston! Quote I'm sticking my neck out here, but footy bores me to tears.Agreed. Just stick your nose little bit out of US, and you'll see... |
|
| 5045. |
Solve : Batch file that can write a command without executeing it in DOS 6?? |
|
Answer» I wont to MAKE a batch FILE that can write a commando without executeting it. |
|
| 5046. |
Solve : How to copy a file from source to all destination directory,all its sub dirs? |
|
Answer» Quote from: llmeyer1000 on June 15, 2008, 08:38:05 AM Here is what I don't understand: 1. Yes. I used Enter. 2. When you use ( brackets like this ) Not just in FOR loops IF "%var%"=="apple" ( ECHO it's an apple call fruit.bat ) Try typing ( at the command prompt. Code: [Select]C:\>( More? echo CAT More? echo dog More? echo horse More? ) cat dog horse C:\> PS We are not talking about "DOS" here, but NT/Win2k/XP/Vista command language. Is it possible to create sort of a batch like that? 'Course inserting a 50 line complicated batch script won't work lik this but what does?Quote from: Dias de verano on June 15, 2008, 08:45:14 AM Try typing ( at the command prompt. OK! After a bit of experimenting, I managed to duplicate your example as follows. Code: [Select]C:\>( More? echo test1 More? echo test2 More? echo test3 More? ) test1 test2 test3 C:\> That's pretty cool, and it goes a very long way in explaining something that has long confused me about many of the posts on this site. But it still appears to me that each section is treated as a separate command line. In this case 3 separate echo statements. It appears that it works on the "for" command line, if used after the "do" , but would not work when I tried it on the "echo" command: Code: [Select]C:\>( More? echo More? test1 More? ) ECHO is on. 'test1' is not recognized as an internal or external command, operable program or batch file. C:\> Can I assume from this that there are only certain commands(like "for in do") that can be split this way? If so, where in the help does CMD explain this? I tried "( /?" to no avail. Quote from: Dias de verano on June 15, 2008, 08:45:14 AM PS We are not talking about "DOS" here, but NT/Win2k/XP/Vista command language. I did say DOS, but I knew that the for command was way more limited back then than now. I should have said CMD instead to clarify. OK! I have been going over your earlier posts (Reply #13) Quote from: Dias de verano on June 15, 2008, 01:14:39 AM NT/Win2K/XP/Vista batch language allows you to use brackets to enclose groups of commands so you can do this ... and I think I can answer my last question. You can use the brackets to enclose any number of commands in a "for in do" statement, but they must be complete command lines, not broken up as I tried in my last example. Duh! I may be slow, but I think I will get it eventually. Thanks again for explaining. EDIT: I see now that in Reply #15, you also used the brackets in an "if then" command line: Quote from: Dias de verano on June 15, 2008, 08:45:14 AM Not just in FOR loops I have always thought of an "if then" or "for in do" as a single command, that should all be on one line. Apparently, the "then" or "do" parts are considered as separate commands and thus may appear on the same, or separate lines. Is that correct, or am I still way out in left field? Thanks! Quote from: Schop on June 15, 2008, 09:30:56 AM Is it possible to create sort of a batch like that? This much even I can answer. Yes, most of the code Dias posted was intended for use in a batch file. For example this code found in Reply #13: Quote from: Dias de verano on June 15, 2008, 01:14:39 AM Code: [Select]FOR %%A in (cat dog horse) do echo %%A will work only in a batch file because of the use of the double percent signs. At the command line, you would need to use single percent signs, as in this code: Code: [Select]@echo off&FOR %A in (cat dog horse) do echo %A Quote from: llmeyer1000 on June 15, 2008, 10:08:49 AM and I think I can answer my last question. You can use the brackets to enclose any number of commands in a "for in do" statement, but they must be complete command lines, not broken up as I tried in my last example. Exactly. I was just about to post more or less exactly what you wrote. Quote Duh! I may be slow, but I think I will get it eventually. You are not slow at all, believe me! Thanks. But sometimes, it is very difficult to fully grasp "new" concepts. (New to me, although not new to many of you!) I was in the process of editing the post you QUOTED (Reply #18) while you posted the above. In the edit I am requesting a bit more clarification, if you would be so kind. Thanks again. (With your expertise, maybe my questions and your answers will help a few others, who are weak in the "for-in-do" area like me. )Quote from: llmeyer1000 on June 15, 2008, 10:08:49 AM
That is correct. They can be on separate lines if you use brackets as I have shown. In essence, brackets (or "parentheses" in N. America) can be used to extend statements over multiple lines. The commands contained within a pair of parentheses are treated like a single command. Such a construct is referred to as a "parenthetical expression". This is one of the major differences between MS-DOS/Win9x (which does not have them) and NT/Win2k/XP/Vista command languages. They also serve to keep commands that need grouping, together. Services.txt exists. Service.txt does not. These don't work... Code: [Select]C:\>if exist services.txt echo yes else echo no yes else echo no Code: [Select]C:\>if exist service.txt echo yes else echo no But these do... Code: [Select]C:\>if exist services.txt (echo yes) else (echo no) yes Code: [Select]C:\>if exist service.txt (echo yes) else (echo no) no These are equivalent in a batch... Code: [Select]if exist services.txt (echo yes) else (echo no) Code: [Select]if exist services.txt ( echo yes [...] ) else ( echo no [...] ) One slight gotcha is that variables in parenthetical expressions are evaluated before the expression is executed, so sometimes you need to use delayed expansion, but I think you need not worry about that until you encounter it naturally. |
|
| 5047. |
Solve : < - standard in? |
|
Answer» hey all, hey all, Code: [Select]set /p var=<myfile.txt arh, /p - thats what I needed. Cheers boss. |
|
| 5048. |
Solve : Sneak Preview? |
|
Answer» Quote from: blastman on June 14, 2008, 08:25:19 AM Jacob, you've inspired me...Good Luck!Quote from: Carbon Dudeoxide on June 14, 2008, 06:09:40 AM I can't wait to see the creditsMeaning?It would be nice to see my name on a game. It will give me motivation to finish the game to see the credits. Quote from: Carbon Dudeoxide on June 14, 2008, 08:50:35 AM It would be nice to see my name on a game.I'll put your name on my game Quote from: Carbon Dudeoxide on June 13, 2008, 09:57:50 PM I've done something like that before. I used the call COMMAND for that. The whole game I made was 23 Batch files Sounds quite simple, make a main menu like Jacob's first post and call a random MISSION batch on selecting "mission" Though including those EXTERNAL batches in labels might be handier. Even then you could add labels with call commands later after the labels with batches... if you get what I mean. Kinda modular system..Quote from: Schop on June 14, 2008, 09:17:31 AM Quote from: Carbon Dudeoxide on June 13, 2008, 09:57:50 PMIt's a bit more complex than that....well what I did anyways....I've done something like that before. I used the call command for that. The whole game I made was 23 Batch files |
|
| 5049. |
Solve : DOS 6.22? |
|
Answer» Hi We have an old PC which is only used to run DOS. It is in a very hostile environment (engineering factory). Whaletx, If you are still monitoring this post, I suggest that the easiest and probably safest way to backup the drive is to remove it and temporarily attach it to another PC. Then copy the entire drive to a folder on the other HD. Then, do you have access to another small HD that the PC in use will recognise? If so, great. Then you can experiment on the 2ND HD, without worrying about screwing the original up. What is the PC used for, and what software is it running. DaveLembke gave you a list of OP system requirements. Win98SE will very likely do the job for you either in real DOS mode, or possibly out of a Windows command prompt. We can help you get it going if you need more help. This is just a stab in the dark, but are you using the PC to communicate through the com port to an industrial machine? Thanks everyone. I followed your advice and now we have a newer PC with the data and a way to back up in the future. Yes you are right limeyer1000 the PC sends data to 2 very old CNC machines. Thanks again everyone, I am a Filemaker developer so if you have any questions on that front I may be able to help. Cheers Brad Quote from: Whaletx on June 13, 2008, 02:47:46 PM Yes you are right limeyer1000 the PC sends data to 2 very old CNC machines. When you said "very hostile environment (engineering factory) ", I knew it! You're post brings back memories. We have a 1984 Mark Century 2000 that had a NON-DOS computer with 2 - 5 1/4 floppy drives, and no HD. I don't even know what the OP system was but management where I work told us that it would "NEVER communicate with a DOS computer." Several years back I got it communicating with an old 286 & DOS 6.22. (The CNC machine didn't know or care what the OP system was. It was simply looking at serial data transfer through the com port.) The operator moved all of his programs directly from the old NON-DOS computer to the "NEW" 286 computer one at a time over the com cable. Since then, we have progressed to a P4 with Windows XP. We used to have proprietary software for every different CNC we had.(Five different controllers & 5 different softwares) Now we use DostekDNC from: http://www.dostek.com/ on 13 different CNC machines. Doug Struthers at DostekDNC was great working with us to get us set up. (It is Windows software, despite the DOS sounding name.) We couldn't get any software from anywhere to work (well) on our Fadals, except the old DOS software that CAME with them. Doug & I emailed back & forth repeatedly to work out the bugs on the Fadals. He actually altered the software to make it work on the Fadals, which had some weird stuff in the handshake that wreaks havoc on most other software. If you are looking to get to a user friendly Windows environment, look into the above software. It can be set to work with almost every CNC out there. The guys here complained at first, but now love it because the software is easy and all the machines are the same now. I forgot to MENTION this. Really glad to hear that you got the files backed up & the upgrade computer going. Quote from: Whaletx on June 13, 2008, 02:47:46 PM I am a Filemaker developer so if you have any questions on that front I may be able to help. I have three questions in that area. What does a Filemaker developer do? What kinds of files do you work on? What software do you use to assist in the filemaking? |
|
| 5050. |
Solve : [Solved] Hard drive not detected by DOS install CD? |
|
Answer» Hello, Creating Bootable Partitions: PartitionMagic 8.0 User Guide I don't currently have PartitionMagic installed, so I couldn't look at the Help, as suggested, but I believe this means that DOS 6.22 or earlier cannot see beyond 8GB & in order to be a bootable partition, the partition must reside within the first 2GB of the physical drive, so ... my MEMORY was close, but ... not completely accurate. Quote from: llmeyer1000 on June 09, 2008, 03:38:11 PM Also, it may be that you need to put your DOS partition at the beginning of the drive in order to be bootable. (DOS had more limitations than newer OP systems, as you know) but I'm not sure that the location at the end of the physical drive would prevent DOS from seeing the drive. If you want to boot DOS 6.22 on your HD, you will need to a tool such as PartitionMagic to resize and move your existing partitions, so that the FAT partition is at the beginning of the drive. I have this suggestion: As an alternative, why not install DOS 6.22, or Windows 98SE DOS on a jump drive and boot with it when you want to run DOS. I have a couple of bootable jump drives with Windows 98SE DOS for that purpose. Is there any reason in particular that you need DOS 6.22? Windows 98SE DOS is very similar to DOS 6.22 as far as functionality, but has much higher limitations. IE: It has a Boot Boundary of 8 GB & can see either FAT or FAT32 partitions anywhere on very large HD drives. The Edit.com program is way better and able to handle much larger files. A bootable jump drive will save you a lot of trouble and get you pretty close to where you want to be! Also, go with 98SE DOS, if you can. Thank you for the investigation, llmeyer. The problem then indeed lies with the partition being at the end of the drive. Judging from what you wrote I guess Partition Magic can actually physically move partitions on the disk? I have Windows installed so that might give some trouble as well when moving its partition and using the first one for DOS. That is my main concern now: can I move my system partition without breaking Windows? If not I'll indeed try another medium for DOS, or just wait a month or so when I (hope to) get a second HDD. Also, the reason I am trying to install DOS 6.22 is that fooling around with different OSes is a bit of a HOBBY. Linux also had a try but it just worked as it should, not much fun And second, I like old-school original software, my ultimate goal is to run the original version of Tetras in a native and as old as possible environment. The most reasonably possible is then DOS 6.22, the latest version of like.. "the original DOS" Not the later ones extracted from Windows 9x. Again, thanks for your post.Yes, PartitionMagic can move partitions, without losing data, but I still suggest learning how to setup a bootable jump drive as a safe simple solution to your needs.I will USB booting isn't quite hard at all these days an I'll give it a go for the time being. Until I have my second HDD it will do just fine i guess. Nothing i do will require anything near the maximum data transfer or storage capacity of my 1Gig jumpdrive |
|