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.
| 5201. |
Solve : desertstormx_jm? |
|
Answer» how to SAFEMODE my PC....#1. Wrong section |
|
| 5202. |
Solve : Batch- Count variable from text file & kill task remotely? |
|
Answer» Using batch scripting, |
|
| 5203. |
Solve : how to set the date in my ini file using a batch file?? |
|
Answer» Well I just needed to know what came before what the OP already posted, but now I am thinking that even with that what I was planning on posting would not work anyway. why not use type and find on a for loop why not use type and find on a for loop??you could try the following as a template for your issue. the code will need to be changed to work for what you are wanting to do but: Code: [Select] set name=[name of ini file] for /f "tokens=*" %%a in (%name%) do call :AddText "%%a ECHO JOB COMPLETE..... PAUSE :AddText %1 set Text=%~1% IF NOT "%Text%"=="<CURR_NUMBER NUMBER="425" TDATE="01/09/2009" /> " ECHO %Text% >> %name% if "%Text%"=="<CURR_NUMBER NUMBER="425" TDATE="01/09/2009" /> " " ECHO "<CURR_NUMBER NUMBER="1000" TDATE=%date:~4% />" >> %name% EXIT /b QUOTE from: wbrost on September 10, 2009, 09:39:04 AM you could try the following as a template for your issue.are you sure it works the next time the script is run on a different date?the script pulls the current date from the %date:~4%. Unless I am missing something or the SYSTEM date is not correct it will pull the correct date. Please let me know if I over looked something or if there is a better way to do this type of thing in batch.Quote from: wbrost on September 10, 2009, 11:16:40 AM the script pulls the current date from the %date:~4%. Unless I am missing something or the system date is not correct it will pull the correct date.in this portion of code Quote Code: [Select]if "%Text%"=="<CURR_NUMBER NUMBER="425" TDATE="01/09/2009" />you hardcoded the date. I was asking, what if the date changed becomes 02/09/2009 and when the script is run the next time, it won't find 01/09/2009 anymore , right? therefore your "If" statement above would not be executed. (or have i misunderstood your code?) also, there is never a guarantee that every date SETTINGS the OP runs his script in is the same as yours. Hi, I don't want the value of CURR_NUMBER to be checked against 425 because it's only a dummy value. The code should set the value of CURR_NUMBER to 1000 and TDATE to current date. I was just wondering if this can be achieved through a batch file so that i can put it in my Start Up folder and it gets executed when i boot my PC. Any ideas?Quote from: rajesh_38 on September 09, 2009, 12:42:28 AM Hello,@echo off For /f "tokens=1,3,5 delims="" %%a in ('type file.ini') do ( If "%%a"==" >>newfile.ini) else (echo %%a>>newfile.ini) ) Now, I need to know 2 things before I can make this code work. (I'm not sure it will work anyway) 1. What is the ENTIRE contents of the file IF there are any " after the part you gave me. 2. What do you see when you run ECHO %time% at the command prompt. @helpmeh, have you run that batch yet? echo %time% gives me time in hh:mm:ss.dd but i do not require time to be set.It's only the date. Looks like there is no way this can be achieved through a batch file... |
|
| 5204. |
Solve : I need to replace a corrupt shell32.dll file win 98? |
|
Answer» And I am gathering that the only way is to copy the file onto a floppy, boot computer into command prompt, and then run commands to copy the file to c:\windows\SYSTEM folder |
|
| 5206. |
Solve : Help with parsing the %TIME command previously provided? |
|
Answer» Hello all again, been a while. Everything has been WORKING great but I need some clarification on a command given to me prior. I want to be able to work on this myself So I won't do it for you. Now you know all you need to know to process the %time% string. Thank You, Dias....Got it. set CURDATETIME=%yy%%mm%%dd%%CURRENTHOUR%%TIME:~3,2%%TIME:~6,2%%TIME:~9,2% |
|
| 5207. |
Solve : Delete temp folders? |
|
Answer» I am trying to create a batch FILE that will delete the contents of any folder (not the folder itself) called "temp" located on my C drive. The temp folders may or may not be directly under the root. For example I would want it to delete the contents of the following folders. |
|
| 5208. |
Solve : create text file of list displayed on screen? |
|
Answer» I want to start by apologizing because I am not very dos savy. |
|
| 5209. |
Solve : read file and store in a variable? |
|
Answer» HELLO I wanted some help to perform the following TASK 1.read a .txt file 2.read a PARTICULAR COLUMN from an excel sheet (say all the contents from 2 column ) 3.store the contents in a variable with a white space as a separator or a (,) as a separator The content of the test file and the excel sheet will look like 8889.0 8889.1 8889.2 8889.3 8889.99 any help in this regards will be highly appreciated ok to read the excel sheet isnt possible in batch nor in DOS but it is possible in VBthanks instead of a excel sheet can we read a text file u can use .CSV its readable both by excel and DOS will Read help in this case for /F "tokens=1 delims== " %%i In (sample.txt) Do set latest_file= %%i set newval= " "+ latest_file echo values are %latest_file% i am using this ? but this stored only the latest value, i need to store all the values to latest_file or newval if you want to read excel, you might want to learn some vbscript. Code: [Select] Set objExcel = CreateObject("Excel.Application") Set objWorkbook = objExcel.Workbooks.Open _ ("C:\test\test.xls") intRow = 1 Do Until objExcel.Cells(intRow,1).Value = "" Wscript.Echo "Col 1: " & objExcel.Cells(intRow, 1).Value Wscript.Echo "Col 2: " & objExcel.Cells(intRow, 2).Value Wscript.Echo "Col 3: " & objExcel.Cells(intRow, 3).Value intRow = intRow + 1 Loop objExcel.Quit Thank you very much, this helped |
|
| 5210. |
Solve : How to retrieve the value of a variable from startup.bat of tomcat into jsp? |
|
Answer» I start my tomcat SERVER by double clicking on the startup.bat of the tomcat server. When i ACCESS the url of the appalication deployed in the tomcat server i will get a login page. After entering the user id and the password and clicking ENTER it leads to the home page which is a JSP. I want to retrieve the VALUE of the variable DEFINED in the startup.bet into the homepage jsp. |
|
| 5211. |
Solve : Batch File to Run Python Script? |
|
Answer» I need to MAKE a batch file that will ask for a "from" filename and a "to" file NAME using a python script. Example of script: python "python script file name" "from file name" "to file name" PID I would also like for batch file PROMPT for another file. Any help would be appreciated...Thank You!Im not sure what you are asking for here, do you just want to get user input using a batch file, if so, all you need is something like this - Code: [Select]Set /P Scriptname=[Your script] Set /P InputName=[Name of Input file] Set /P OutputName=[Name of Output file] python %Scriptname% %InputName% %OutputName% PID If this isnt what you wanted, let us know Graham Many thanks Graham, it works like CHAMP. I knew it was something simple. garlin |
|
| 5212. |
Solve : How to avoid complete path? |
|
Answer» I have defined a batch file log.bat that basically takes a string as INPUT and displays the same string but with the timestamp as output |
|
| 5213. |
Solve : [SOLVED] Batch single command---multiple times. How?? |
|
Answer» I feel like a newbie. I've not played with batch files in 20 years. What if the .spx files are not all in the same folder? What if some .spx files had been placed in another folder on 02/04/2008? It would be nice to find the lost files. Let's wait for the OP to ask for the help that he or she actually requires. Mr Trout wrote: Quote Let's wait for the OP to ask for the help that he or she actually requires. You may wait if you like. If all the original files did not have SEQUENCE numbers in the file name my code adds the squence number. Nice touch. Quote from: billrich on September 13, 2009, 03:39:33 PM
I didn't see where he asked for that. Unnecessary touch. Please do not call me "Mr Trout" unless you really are intending to start an argument, OK? Quote from: Salmon Trout on September 13, 2009, 03:44:20 PM
Ok, I call you Fishman. You code is very compact and efficient. Very difficult for most of us new people to decipher. But code is for show not for ease to understand or use.Quote from: billrich on September 13, 2009, 04:01:33 PM Ok, I call you Fishman. bill you are just being rude and humorless. and weird, i thought code is for use. not the other WAY aroundQuote from: BatchFileBasics on September 13, 2009, 04:22:08 PM bill you are just being rude and humorless. and weird, i thought code is for use. not the other way around I agree with both parts of the above, but I suppose Billrich raises a point that needs answering, even if only to demolish it. I always thought of this forum as a help forum where people post a question and other people suggest solutions. If I answer in a thread I therefore suggest bits of code which I have tried out which do the job. The code I post is not primarily intended as a teaching aid or an educational resource. Although batch coding is not rocket science!!! If it is "difficult to decipher" then I would suggest more study is needed. Quote You code is very compact and efficient. I take that as a compliment; I don't see the point of adding lines that aren't needed, just because some folks find terse code frightening, although I will break code down and explain it step by step if asked, and if I have the time.S.T. wrote: Quote I don't see the point of adding lines that aren't needed, just because some folks find terse code frightening, although I will break code down and explain it step by step if asked, and if I have the time. S.T. is such a nice guy. S.T. not only helps the original poster but all the new readers and students. And S.T. is so humble.Quote from: BatchFileBasics on September 13, 2009, 04:22:08 PM bill you are just being rude and humorless. and weird, i thought code is for use. not the other way aroundcode is for use AND be maintained. when you maintain code, its best that code is readable and understandable without having to spend 10 minutes finding out what one expression means. |
|
| 5214. |
Solve : how to find the file is empty or not?? |
|
Answer» Hi, |
|
| 5215. |
Solve : extract line data from files and insert original file creation date? |
|
Answer» I have a collection of files that contain order LINE DATA. show your input file, describe how the output looks like using that input file Input files: Order_1.txt (file creation date 2009-09-04) 90000 40216608110520900033012641 90000 40216608110525900033090641 90000 40216608110555100140001000 Order_2.txt (file creation date 2009-09-07) 90000 40169008310351900315090000 90000 40169008310342800026001002 Order_3.txt (file creation date 2009-09-14) 90000 40365401110325000219001651 ...and so on. There are thousands of more files.. This is the output I want in the file orders_merged.txt 200909044021660811 200909074016900831 200909144036540111you can run this vbscript Code: [Select]Set objFS=CreateObject("Scripting.FileSystemObject") strFolder = "c:\test" Set objFolder = objFS.GetFolder(strFolder) For Each strFile In objFolder.Files strFileName = strFile.Name If InStr(strFileName,"Order_") > 0 Then strDateCreated = strFile.DateCreated y = DatePart("yyyy",strDateCreated) mth = DatePart("m",strDateCreated) dy = DatePart("d",strDateCreated) If Len(mth) <2 Then mth="0"&mth End If If Len(dy) <2 Then dy="0"&dy End If Set objFile = objFS.OpenTextFile(strFile) Do Until objFile.AtEndOfLine strLine=objFile.ReadLine s = Mid(strLine,13,10) WScript.Echo y&mth&dy&s Loop objFile.Close End If Next output Code: [Select]c:\test> cscript /nologo myscript.vbs > orders_merged.txt Quote output I fixed up the paths, but I end up with an empty orders_merged.txt file. Am I doing something wrong?Quote from: swede on September 14, 2009, 04:49:55 AM most obviously. what did you change when using my code? make sure you have the files in the path c:\test. As you can see, my code checks for files with "Order_" in their filename. Remove the ">" output redirection and just run the script. show the output here if any. Thanks for your quick response. Quote from: gh0std0g74 on September 14, 2009, 04:54:59 AM most obviously. what did you change when using my code?I found the cause - the below string is case sensitive so I changed the code according to the file names. Code: [Select]If InStr(strFileName,"order_") > 0 Then Your code and my sample order files from above result in the output file orders_merged.txt: 200909144021660811 200909144021660811 200909144021660811 200909144016900831 200909144016900831 200909144036540111 This isn't correct. As I wrote in previous post, I want the output to be the first line of each file together with the file creation date. The output I'm looking for is this: orders_merged.txt 200909144021660811 200909144016900831 200909144036540111Quote from: swede on September 14, 2009, 05:37:37 AM I want the output to be the first line of each file together with the file creation date.I want you to try yourself. since you only want the first line, then remove the Do Until loop, but leave the inside of the loop intact.... Quote from: gh0std0g74 on September 14, 2009, 05:43:48 AM I want you to try yourself.That's how I like it. Quote since you only want the first line, then remove the Do Until loop, but leave the inside of the loop intact.... Works like a charm! Unfortunately I haven't done VBS since 1995, so this will take a while to grasp. Can I run this from a batch file? I usually schedule batch files with the built-in event scheduler in XP. Or is it possible to schedule the script itself? Thanks again for your help!Quote from: swede on September 14, 2009, 08:02:30 AM Can I run this from a batch file?if you can run something on the command line, you can most certainly put them into a file and name it .bat. Quote I usually schedule batch files with the built-in event scheduler in XP. Or is it possible to schedule the script itself?yes of course you can schedule the script itself. it is just executing another PROGRAM (which in this case , its cscript.exe ). When you set your scheduler, just put in the EXACT command you executed on the command line into the scheduler.... |
|
| 5216. |
Solve : Monitoring Time? |
|
Answer» Hello Everyone, |
|
| 5217. |
Solve : Removal of READ ONLY from CD(s) disks -- not hard disks? |
|
Answer» >:(Search, including many messages hereon, has not provided answer. Hope to do better here. |
|
| 5218. |
Solve : Important information about the MS-DOS section. For ALL members? |
|
Answer» In the MS-DOS section, we try to help you with batch programs (usually not in MS-DOS, but the Command Prompt). What we don't do is help you with scripts that are potentially dangerous or malicious. That includes making batch files "invisible" or doing things like deleting system files. In the MS-DOS section, we try to help you with batch programs (usually not in MS-DOS, but the Command Prompt). What we don't do is help you with scripts that are potentially dangerous or malicious. That includes making batch files "invisible" or doing things like deleting system files. I got rid of INVISIRUN.exe.Quote I got rid of INVISIRUN.exe. He's not talking about you. He's talking about the people coming after you. This should be made sticky, or at least INCLUDED in the READ THIS FIRST post. I know that there is a page with the rules, but repeating things isn't a bad thing in this situation. Two-Eyes %Quote from: Helpmeh on September 13, 2009, 08:31:49 PM I'm just tired of new members posting questions like "How do I make a batch file run without anyone knowing", and other members actually TELLING them how to do it before we tell them they're not supposed to. Sorry BOUT postin invisirun.exe didn't know it was against rulez. I don't think anyone downloaded the pack anyway, well now it's completely harmless. Just a preventative measure...helpmeh, can you provide a quote of exactly where in the rules this isn't allowed? It's not... and that's the problem.Which is why this thread exists. Not the PLEASE. This is a request, but it really should be a rule. |
|
| 5219. |
Solve : searching for a string in dos window output? |
|
Answer» Hello everybody, In my case i launch the application "A". When in the output i read "running" i want to launch application "B".Quote from: macdad- on September 09, 2009, 07:29:58 AM Thats what's its supposed to do: Code: [Select] @echo off appA.exe | findstr "running" > temp.tmp for /f %%a in (temp.tmp) do ( if '%%a'=='running' goto appB ) :appB This code will go to label :appB, whether or not the word 'running' is found, so what is the point of the IF test? Quote from: Salmon Trout on September 09, 2009, 07:40:09 AM Code: [Select] it is not supposed to do that it should go do label appb only if i see in the console output the "prograM is running" string. i would prefer to read to console because the output to teMp file, after a while, stops and i think it is redirect to another file. I've tried with the /g OPTION but i do not understand how to insert the "/" for the console. I tried everything with any result. Anyway if you have a link with a clear explanation of batch coMMands it would help a lot. Thanks byeQuote from: mrguzzi on September 09, 2009, 01:46:58 PM it is not supposed to do that Indeed. Quote from: Salmon Trout on September 09, 2009, 01:48:57 PM Indeed.so? any proposal?Quote from: mrguzzi on September 09, 2009, 02:13:08 PM so? any proposal? Quote In my case i launch the application "A". When in the output i read "running" i want to launch application "B". Let me make sure I have this right. You launch A and it produces screen output, which might, or might not, include the word "running"? Is that right? Or do you mean, it will produce the word "running" sooner or later, and you want to wait until that happens? Quote When the log file written by "B" contains the "running" string i launch application "C". You see, that word "when" is niggling away in my mind. Are you aiming to monitor the logfile while program B is running, and when you once again see the word "running" in it, then you launch program C? And please, why are you being all coy and calling the programs A, B and C? Why is it such a big secret what you are trying to do, what the programs are called, and what they do? How do you expect any serious help if you just give part of the needed information? The logic for batch files can be LIKE this: Code: [Select]If thing == true goto NotFalse goto IsFalse :NotFalse echo It was ture. goto AllDone :IsFalse echo Yes, it was not ture. :AllDone You use the goto to create code blocks. Quote from: Salmon Trout on September 09, 2009, 03:41:37 PM .. it will produce the word "running" sooner or later, and you want to wait until that happens? this is it Quote from: Salmon Trout on September 09, 2009, 03:41:37 PM You see, that word "when" is niggling away in my mind. Are you aiming to monitor the logfile while program B is running, and when you once again see the word "running" in it, then you launch program C?sorry for my bad english. I mean that as soon as i see in the logfile the phrase "program B is running" i want to launch the program C Quote from: Salmon Trout on September 09, 2009, 03:41:37 PM And please, why are you being all coy and calling the programs A, B and C? Why is it such a big secret what you are trying to do, what the programs are called, and what they do? How do you expect any serious help if you just give part of the needed information? No secrets at all :-) it's just for semplification. Anyway program A is Bea weblogic server, B is a server-side code running on bea weblogic and program C is a TESTING unit that runs on B. That's all Actually i'll try Geek solution. The only open point is how to use findstr on console without reading the temp file. Thanks a lot Byeok i went forward now my problem is here appA.bat | findstr "running" > temp.tmp until appA finishes (and it does not do it) the batch does not continue Actually appA = run server_admin I've tried all of these start run server_admin >temp.tmp run server_admin | findstr /c:"RUNNING mode" >temp.tmp call (run server_admin) | (findstr /c:"Server started in RUNNING mode")> temp.tmp don't know how to try So how can i launch a bat file (in my case run.bat), get it's output to a file and continuing searching in this file before run.bat finishes? like this: run server_admin >temp.tmp :wait_admin_console findstr /c:"RUNNING mode" temp.tmp if not ErrorLevel 1 goto continue goto wait_admin_console :continue ... thanks a lot bye |
|
| 5220. |
Solve : i can't get out of dos? |
|
Answer» Hello, |
|
| 5221. |
Solve : the format command isn't working!? |
|
Answer» I'm trying to FORMATE my PC using DOS (I can no more enter windows: "ndlr file is MISSING"). I had also to run DOS thanks to a DOS-boot-disk... Can't remember where I found it... and the "format C:" command doesn't WORK! Please, help!What?Use your OS installion disk to repair or reinstall your OS. |
|
| 5222. |
Solve : Copy multible files to auto generated folder? |
|
Answer» I'm using the following batch with Scheduled Tasks in XP to do a daily backup for a complete folder, now I want to copy only certain files in that folder... does any ONE know how I can do this? |
|
| 5223. |
Solve : How to delete virus through DOS Command? |
|
Answer» how to delete virus through dos CMD, i already USED attrib -s -h *.* /s /d, but the result is access denied C:/ System Volume information.... what is this?Quote from: yelrig c:/ System Volume information.... what is this?Quote |
|
| 5224. |
Solve : How do I write a batch file to use WinRAR to archive and delete the file? |
|
Answer» I need to write a dos batch file to archive my history data, the files have specific file NAME or file extension. I want to archive file older than 30 days. Is that possible?Why do you need to do this? What's WRONG with Windows Explorer? |
|
| 5225. |
Solve : find and replace option? |
|
Answer» i am using windows server 2003. |
|
| 5226. |
Solve : Error opening Command Prompt? |
|
Answer» I got an error when i open my CMD prompt,, and my computer shut down automatically,, i dont KNOW whats the problem,, can any one help to solve this,, i dont like to format it because its a server., TNX what KIND of operating system do you have? ALSO what are your computer specs im using windows XP SP2 512MB 80G My mother board Asus P4S333-MDownload HijackThis: http://www.trendsecure.com/portal/en-US/tools/security_tools/hijackthis/download Click on Download HijackThis Installer Post HijackTHis log.is it for free? Yes. |
|
| 5227. |
Solve : How to supply password in batch file? |
|
Answer» Hello, |
|
| 5228. |
Solve : How can i run a hidden batch file ?? |
|
Answer» Hi You're not trying to do anything devious are you? I suspected the same thing last week and maybe I shouldn't speak for Mental, but when I LOOKED at his RECENT POSTS, it looked to me like he is on the up & up. He has a bit of TROUBLE conveying his thoughts and sometimes a lot is lost in the translation. I wouldn't worry about helping him. I think he is OK! He might just be interested in what COMMAND Prompt can do.mental you realise that when you run ur app in ghost mode, the only way to shut it off is to turn it off at task manager.save it to the c:\ folder run the dos file minimizedThx for all comment @all i want without any app do it ( just with command prompt ) i think does not any command in cmd for my request @llmeyer1000 thx , i want it for my previous app i can use bat2exe too and i select ghost app in bat2exe option but : my bat = 1 kb with bat2exe = about 160 kb There is no command in CMD for silent operation. The closest thing I know of is pwekn68's suggestion. Quote from: pwekn68 on May 23, 2008, 07:18:57 AM run the dos file minimized Quote from: Mental on May 23, 2008, 10:59:25 AM with bat2exe = about 160 kb Why does it matter about the size of the file? 160 KB is not that large by today's standards. yea unless you have a 386 computer. Quote yea unless you have a 386 computer.hehe Quote There is no command in CMD for silent operationok ! i want this ... so i will use b2x ... thx |
|
| 5229. |
Solve : How to give input as Ctrl+ in Batch file (eg:Ctrl+L)? |
|
Answer» Hi Guyz |
|
| 5230. |
Solve : Elementary file rename problem.? |
|
Answer» First the obvious: I don't know much about batch files. |
|
| 5231. |
Solve : Check if a folder exist...? |
|
Answer» Hi there I've spent the last hours trying to move some files... that does work- and all this time I've been doing "if exist <foldername>\nul <command>" Checking for \nul is a venerable way of checking if a folder or drive exists. NUL always exists on a local MS-DOS FAT drive; therefore, if C:\ exists, then C:\NUL exists, and if C:\WIN exists, C:\WIN\NUL exists. However it does not work in EVERY situation, and therefore is regarded as obsolete, and is not needed in NTFS. The following table shows when IF EXIST returns NUL: With 32-Bit File No 32-Bit With 32-Bit Access and NetWare Drive Type File Access File Access 3.x connectivity Local FAT correctly always never Windows for Workgroups FAT correctly always never Microsoft LAN MANAGER HPFS never always never Windows NT FAT/NTFS never always never NetWare correctly never never It's just a habit from my old batch programming days with DOS 3.21 since I don't really use batch anymore I don't have a bunch of batch files in my C:\BELFRY directory peppered with TESTS for the NUL file. Back when I first started I used If exist dir\*.*, which worked if there were any files. But without files it didn't work. MS-DOS is phat. I was taught this way to check for a folder. Code: [Select]if exist folder\. command Every folder has a . directory, even if empty, so this test works in all versions. Quote from: llmeyer1000 on May 23, 2008, 08:38:06 PM I was taught this way to check for a folder. we have a winner! |
|
| 5232. |
Solve : stuck in DOS? |
|
Answer» no i know it's not it was used earlier and it is the original disk Do you have any other suggestionsQuote from: hancock85 on May 21, 2008, 03:30:42 PM no i know it's not it was used earlier and it is the original disk Do you have any other suggestions Sorry you don't like my answers. How do you know the disk isn't FAULTY? If... 1. You have set the BIOS up to boot from the CD-ROM DRIVE 2. The disk is a good bootable Windows install disk 3. The CD drive is working properly 4. The computer motherboard etc is working OK then it should boot up. You will find that one of these 4 things is the problem. i will work on it later and let you know but as of now everything is the way you say. I know that the disk is good. I just can't get anything to boot in dos and i can't get the computer out of dos mode. I do appreciate all you HELP and if you think of anything else please let me know and i will try it.Ok try this: 1) turn off your computer 2) unplug it from the wall 3) remove the battery from the motherboard (should be a silver disk looking thing about the size of a nickel assuming you are American) 4) keep the battery out for a few min and put it back in 5) plug in computer and turn it on 6) On the very first screen you should see a message somewhere on the screen that says "Hit (something) to enter setup" it might be at the top or bottom, if you do not see it, reboot your computer and try again. 7) Assuming you saw the message and hit the correct button you should see some sort of bios screen. It could be blue or grey. Find the option for Boot order, this could be under a menu that says advanced options...I am not SURE so you may have to look around. 9) Make note of the current order, and change it so the CD rom is the first and if possible the ONLY thing to boot from. 10) usually it says somewhere on the bios screen to press a button (usually F10) to save changes and exit. In either case SAVE CHANGES and let the computer reboot. 11) If the CD is in the CD-rom drive you should hear it "spin up" and the drive light should come on and the computer should boot from the CD-rom. 12) let us know what happens. If it still goes to dos, there is something wrong with the disk, or your CD rom drive, or possibly your motherboard. It is possible your mother board (depending on how old it is) cannot boot from a CD and requires a floppy drive to boot from. thank you so much for not giving up on me. I am home now but i will stop by my parents house again hopefully tomorrow but on Friday at the latest and i will try again. I don't see why it wouldn't be able to boot from cd when it has run cd's before and came with a cd player in it. I will be sure to keep you up-to-date. thanks again for all your help. HeatherQuote from: NCwill on May 21, 2008, 06:38:30 PM the size of a nickel assuming you are America Is everyone on here American except me? No. |
|
| 5233. |
Solve : Can I use secure copy "SCP" in batch file?? |
|
Answer» Hi, |
|
| 5234. |
Solve : Win/Batch: Question in DOS IF command? |
|
Answer» Hi, different value of %task% displayed if you set and read a variable inside parentheses (brackets) you need to use "delayed expansion". Otherwise it will either keep the value it had before the parentheses or if it had none, be null. 1. put this line before the parenthetical structure (e.g. at the start of the batch file setlocal enabledelayedexpansion 2. A variable which may be set or changed inside parentheses needs to use exclamation marks ! and not percent symbols % @echo off setlocal enabledelayedexpansion set task=0 abd ^/? > nul REM %ERRORLEVEL% was set outside the parentheses REM so it keeps its value REM %task% was set to 0 and retains that value REM unless you use delayed expansion and REM exclamation marks IF %ERRORLEVEL% NEQ 0 ( CLS SET task=%ERRORLEVEL% echo errorlevel is %errorlevel% echo task_flag is !task! ) echo error !!! pause exitGot it. Thanks. Where can I found the information about "delayed expansion" and "A variable which may be set or changed inside parentheses needs to use exclamation marks ! and not percent symbols %"Google ?Billrich attacking me again, for his own painfully obvious reasons. When we FEEL that Googling is more useful than writing YADEE (yet another delayed expansion explanation) (I have done about 6) we say so. Here is a good link however. http://www.robvanderwoude.com/variableexpansion.php |
|
| 5235. |
Solve : Using a Batch file to create another batch file? |
|
Answer» Hi, guys. Posted by: Nowsor Mirza Posted on: 26-05-2004, 23:28:20I DIDNT spot the date ... just replying in my usual helpful way !doesn't it say "warning you are posting to a topic that is more than 30 days old!" I don't think so...i knew i saw it [attachment deleted by ADMIN]Never seen that before. Oh well. |
|
| 5236. |
Solve : Too many parameters? Help please!? |
|
Answer» Hi, Hi, remove the SPACE between the drive name and the slash. as In: Code: [Select]c:\dos\edit.com c:\fruit Quote from: BC_Programmer on May 25, 2008, 09:14:57 PM Quote from: php111 on May 25, 2008, 08:32:31 PMphp11, this is what you wrote (which is wrong)Hi, copy c: \dos\edit.com c: \fruit This is what BC_programmer wrote (which is right) copy c:\dos\edit.com c:\fruit Do you see the difference now? Quote from: Dias de verano on May 25, 2008, 11:52:31 PM php11, this is what you wrote (which is wrong) I am getting confused. There looks like a space either way I go.There is a space after c: in what you wrote. There is no space in what BC_programmer wrote. Anyway, why don't you TRY it and see? |
|
| 5237. |
Solve : For command Help..? |
|
Answer» I'm not a scripter, but I think the FOR command tool can help me ACHIEVE what I want to do. I need to run a job so that it can create a share WITHIN MS Cluster software according to the clustername. So I have found how I can create a RESOURCE in cluster by following: |
|
| 5238. |
Solve : Parsing a string? |
|
Answer» I am SURE there is a simple method to do this but I am missing it. I want a batch FILE which will take an incoming variable, take it apart and put it together in a little bit different order. I might want to take the date string (Mon 05/26/2008) and reorder it as (2008\05\26). For any difference which it might make, I will be doing this under WinXP CMD. Thanks.you can extract part of a string as follows you forgot to mention the venerable for loop I didn't forget; I chose not to mention it, because I think it may be off putting to beginners and those seeking a simple concise solution. Of course, if the position of the desired substring(s) is/are not known exactly, and there are identifiable token delimiters, then FOR is very useful. I have noticed that many people seem to find FOR somewhat non-intuitive. mmcoy, if you hang around this forum, you will soon discover that ghostdog has a habit of jumping into threads where people have asked for a batch solution, and offering them a vbscript solution. I don't think he has shares in vbscript; I suspect he can't help it. I hesitate to criticize him seriously for it, because some of the solutions he offers are very elegant and sometimes better. I think he genuinely feels that vbscript code looks better than NT/XP/2K/Vista command language, which I think he considers to be crude and ugly. That is a matter of opinion, of course. I think everybody knows mine! Quote from: Dias de verano on May 26, 2008, 07:10:11 AM Quote from: ghostdog74 on May 26, 2008, 06:17:57 AMi mentioned it, because OP seems to want to manipulate the output of date. Therefore, the for loop with token/delimit may come in handy.The output of date has an unvarying, predictable structure, and i cannot see why one method of slicing it should be preferred to another, but I am willing to be persuaded.you forgot to mention the venerable for loop |
|
| 5239. |
Solve : NEED HELP: a batch file that analyze a text log.? |
|
Answer» hi guys. im new here. and new to making a batch file. |
|
| 5240. |
Solve : How can I learn MS-DOS 6.22?? |
|
Answer» I mean REALLY OLD, like the DOS versions.Quote my memory doesn't serve me well enough to remember what exactly it was Norton did that... Quote from: php111 on May 25, 2008, 03:44:14 PM One other thing, my Uncle when he has time he is going to email me the old DOS version of Norton Utilities v3.5. Norton Utilities were awesome! In fact Bill Gates got a lot of his best stuff from Pete (Peter Norton). NDD(Norton Disk Doctor) was called Scandisk when released with DOS. Pete's SpeedDisk was called Defrag in DOS. Peter Norton always released a new version of his utilities that had a few more features than on the version he sold to Bill. For example in Speedisk you could specify particular files that you wanted to move to the beginning of the disk (while you were defragging), for faster execution. (Disks were slower back than and this could actually make a difference. Today, what's a few nanoseconds?) That said, you should be WARNED! DO NOT use old utilities, no matter how well they worked back in the day!!! I recently warned another user of the dangers in the following link: Batch file help The biggest problem is this: DOS & Windows prior to Windows95 only worked with short filenames (8.3) If you run any of the disk management utilities mentioned above or a few others, you will be very SORRY . This is the voice of experience. I ran NDD & Speedisk on a Windows 95 system.(One time was all it took for me.) The long filenames were gone and the system was crippled & barely booted up at all. There is little or nothing of any real value that you can LEARN from DOS 6.22 that you can't learn by using the the "DOS" found in Windows XP or Vista. But, if you really want to use the "real" DOS (DOS6.22) Please do so on a separate COMPUTER, or at least a separate partition. And be very careful even then. You have been warned! Now have some fun learning! Quote Norton did that...LOLQuote from: php111 on May 25, 2008, 06:20:43 PM Willy, As that was commercial software, I doubt that it can be downloaded legitimately. But - Do you know what was included in it? In other words, do you have something specific that you need, because often there is another solution. If there was some specific job you needed to do, describe it here and perhaps someone will know a trick or tip or other software, to share with you. While I've been away from the forum overnight, I see many other responses here, along the same line. Lastly, just for the heck of it, I tried Google. Found this: http://www.softwarecheaper.com/product1005.html Says Norton Utils v.3.5 is $5.00, and I see a SMALL note about free delivery. If you really want it, five bucks sounds pretty cheap. I know nothing about this vendor, and haven't looked for any fine print on their site - I'll leave that for you. |
|
| 5241. |
Solve : DOS syntax? |
|
Answer» I don't want to reinvent the wheel Cheers Dias! You need a mix of Windows API calls and Delphi I guess. Quote from: llmeyer1000 on May 28, 2008, 12:15:02 PM Curious. Is there some reason in particular, or goal that you are trying reach, by reprogramming the batch file?Yep, by doing away the need for the batch file itself and to avoid using Windows Explorer. I can built this into a GUI application which will make it easier for a beginner to UNDERSTAND. Granted, beginners prob don't know about AC3 files, etc, but it is also a learning curve for me. Quote from: Dias de verano on May 28, 2008, 12:39:20 PM [You need a mix of Windows API calls and Delphi I guess.I think I would. Heck, won't hurt me to experiment and learn There are a number of GUI front-ends for programs like avisynth, virtualdub, etc. |
|
| 5242. |
Solve : Calculate in batch? |
|
Answer» Hi, I have the following code: The Dutch alphabet must be hard to learn in school... 28 letters, with 'e' and 'f' appearing twice! LOOOOL, firstly, we indeed have strange quotes, but this has nothing the do with the letters in the alfabet :-). And flamish = dutch (more or less) so don't think if anyone says that he speaks flamish and dutch, that he speaks two languages ;-). Secondly, I typed that really fast, so indeed I made an error, LOL. And last, thanks for your more compacted version, and also carbon thanks for your help. Much appreciated :-) |
|
| 5243. |
Solve : Batch File to Copy into Multiple Directories with Different Names? |
|
Answer» It seems like a batch file would be the best for what I need to do, but I'm certainly open to other suggestions. |
|
| 5244. |
Solve : Help with loading device driver manually from batch file? |
|
Answer» Greetings, |
|
| 5245. |
Solve : Windows Batch/DOS - How to remove all lines from text file that end with '_' und? |
|
Answer» I have a file 'users.txt'. It's just a listing of usernames: |
|
| 5246. |
Solve : determing the creation date of a file in batch? |
|
Answer» how can you check to see the creation date of a file in a batch PROG? ok that works but how can i get the creation date of a specific file and place it into a variable? Code: [SELECT]@echo off set filename=test.txt for /f %%D in ('dir /B /T:C "%filename%"') do set creation-date=%%~tD echo %filename% CREATED %creation-date% thanks Dias |
|
| 5247. |
Solve : Format command? |
|
Answer» 2 methods 1. Start Windows 95 I think you will find format.com in the folder C:\Windows\COMMAND. (2) Maybe easier Quote 1. Boot from floppy If you have confidential or sensitive data, then you want something better than the FORMAT command. The format command will make the data inaccessible to a novice computer user, but computer professionals and experienced computer users can easily recover your files that were on a partition that was simply formatted with a boot disk. What are you going to do with the computer(s) after you have wiped the drive?Quote from: sooz on May 20, 2007, 01:36:20 PM Thanks so much to all of you for trying to solve my problem! This is a function of the level of security that you feel you need. For me, simply formatting the drive(s) would be ok... because there is nothing really critical on this machine. No credit card numbers... nothing like that. Quote I don't mind DOWNLOADING a freeware program to get the same thing accomplished, assuming the two methods give the same results (). Not QUITE the same. See GuryGary's post above. That's a more secure method. On GENERAL principle, that is what I would do anyway. The absolute secure method is to remove the hard drive(s) and destroy them. But for most folks, that is overkill. Quote After this I need to wipe out my old Win 98 computer too. Even though you don't need this if you follow GuruGary's suggestion, for future use... if you ever need/want a Win98 or Win95 boot floppy disk: visit www.bootdisk.com You can download executable files there. Grab the one you want, and run it. It asks you to insert a floppy. Then it makes it a boot floppy. Easy. It is free. (I don't remember if the CREATED boot floppy includes format.com or not. Maybe somebody else here can jump in and let us know. ) Quote The first one called for going to Start--Settings--Control Panel--Add/Remove programs and selecting Startup Disk to create one from the original Win 95 CD which I no longer have. So I went to method #2 which had me open My Computer (can't find my notes on where I went after that) and then format a new disk clicking "create a systems disk". Is a systems disk the same as a boot disk??? Anyways, I checked the dir for that disk (as Contrex suggested), and there was only one file named command.com. So that probably explains my format command problems. So what direction do you suggest now? Thanks again, Sue Quote IO.SYS ; System boot file. Quote (I don't remember if the created boot floppy includes format.com or not. Quote from: patio on May 20, 2007, 04:36:51 PM Quote Viola` ! Thank you. Ta-da, mission accomplished !!! GuruGary's explanation on formating vs a delete freeware pgm was most helpful, so I downloaded DiskDeleter ZW and it did the job on both my Win 95 and 98 systems. Ha, almost cried as I put the later to bed one final time. Now to haul them to the hazardous materials recycling center. Seems a sad demise for my old friends but I had to move on.... Thanks to all for your input! SueQuote Anyways, I checked the dir for that disk (as Contrex suggested), and there was only one file named command.com. So I OWN 2k_dummy. Code: [Select]W00TThe problem was solved 5 days ago. Quote from: GX1_Man on May 24, 2007, 07:06:38 PM The problem was solved 5 days ago. Someone read the first post and just hit "reply" without reading the whole thread... how can i reformatt my computer microsoft xp? Following this thread may make it longer to accomplish... Start a new Topic with more DETAILS on what exactly you want to accomplish and someone will be along shortly.good day to all, my is when start my computer there is ****STOP:0X0000007B.....INACCESSIBLE BOOT DEVICE I CANT LOG ON TO MY COMPUTER PLEASE HELP ABOUT THIS PROBLEM! |
|
| 5248. |
Solve : command line syntax? |
|
Answer» If exist 1.txt and 1.doc del 1.txt Would this be the right command line syntax to find out if both a .txt and a .doc version of the same file name exists in a directory and then delete the file with the .txt extention if both exist?You could try this: Code: [Select]if exist file.txt ( if exist file.doc del file.doc )Yes, thanks. I tried that for one filename and it works but what I really meant to ask was how to do all of the files in a directory? Would I proceed the if exist statement with DIR > and if so what kind of parameter would I use in the if exist statement to receive the directory statement output?Quote from: Dizzzy on June 16, 2008, 12:05:19 AM I really meant to ask was how to do all of the files in a directory? DEL *.* does that. Quote from: Dias de verano on June 16, 2008, 12:17:03 AM Quote from: Dizzzy on June 16, 2008, 12:05:19 AMI really meant to ask was how to do all of the files in a directory? You have taken my statement out of context and then provided an mindless and irrelevant response. DEL *.* does not do what I asked. DEL *.* does not test all filenames to see if a particular file extension exists and then delete a different file extension for the same filename. Quote from: Dizzzy on June 24, 2008, 11:45:33 PM You have taken my statement out of context and then provided an mindless and irrelevant response. I understand now. Sorry. I do know an answer to your query, but since you were so rude, I shall not bother posting it. Good luck.One reason people ask and answer questions on a public forum is so that other members can benefit from the question and answers as well. Your answer was serious enough to put everyone at risk. If it was only a thoughtless answer without intent of causing harm you would have corrected it. I couldn't think of a way to do this with a batch file, but I made a VBScript that should do the job sufficiently. I apologize for it's length. It probably could have been shorter, but it worked for all my test cases I could contrive. I recommend you back up the files before running this script on them. I don't want to be responsible for loss of important data. Just Copy & Paste it into a script file- I recommend extvdel.vbs, but anything goes, as long as you remember the filename. Code: [Select] 'extvdel VBScript program 'given two extensions, deletes all files in the current directory that have the SECOND extension but only if a file with the same base name and the first extensions 'also exists. Dim FSO Dim FileLoop,Folduse,outstream Dim Extension1,Extension2 wscript.echo "HI!" If Wscript.arguments.count < 2 then ShowHelp WScript.Quit() End If Extension1 = Wscript.Arguments(0) Extension2 = WScript.Arguments(1) If Extension1 = "/?" then showhelp WScript.Quit end if Set FSO = CreateObject("Scripting.FileSystemObject") set outstream = FSO.getStandardStream(1) 'retrieve the stdout stream set folduse = FSO.GetFolder(FSO.GetAbsolutePathName(".") ) 'retrieve current directory. For each FileLoop in folduse.Files if FSO.getExtensionName(fileLoop.name) = Extension1 Then 'determine if a Doc file exists with the same base name. 'on error resume next wscript.echo "found """ & fileloop.name & """. Finding:""" & FSO.GetBaseName(fileloop.name) & "." & extension2 & """..." wscript.echo on error resume next if not folduse.Files(FSO.GetBaseName(fileloop.name) & "." & extension2) is nothing then If Err.Number = 0 then on error goto 0 Wscript.echo "deleting file, " & fso.getbasename(fileloop.name) & "." & Extension2 ' on error goto 0 folduse.Files(FSO.getbaseName(fileloop.name) & "." & extension2).Delete else wscript.echo """" & fso.getbasename(fileloop.name) & "." & Extension2 & """ not found." end if 'err end if end if next Sub showhelp Wscript.Echo "Extension verifier/Deleter" Wscript.echo "determines if files with the same basename and two different extensions exist," Wscript.echo "And of so, Deletes one of them." Wscript.echo "" wscript.echo "Usage: ExtVdel.vbs <extension1> <Extension2>" wscript.echo "(might require CScript extvdel.vbs <extension1> <extension2>" Wscript.echo "" Wscript.echo "For example, ExtVDel txt doc" Wscript.echo "the second parameter is the extension whose file will be deleted." end Sub I won't go to in-depth into it, but for some reason I felt compelled to have it work for other extensions. just save it to the folder you wish to operate on, and run "Cscript extvdel.vbs txt doc" to get it to run on your files there. In the future if you need similiar functionality with other file types, you can just change the txt and doc portions of the commandline. I hope this works for you... And Dias- how was he rude? he only said anything even CLOSE to offensive after you contrived a new question out of a contextually removed sentence of one of his posts, and even then he only told it like it was that is, "mindless and irrelevant", and even if that was arguable, one thing definitely stands- it didn't help, and as far as I can see that was the whole reason he posted here in the first place (once again, ) You are right I was out of order and I apologise. I hope this might make up for it in a small way I called it dnam.bat Code: [Select]@echo off REM Find files with same name but 2 extensions REM 2 parameters from command line REM %1 extension to look for & keep REM %2 extension to look for & kill REM E.g. dnam doc txt REM For each doc file delete a txt file REM that has same name part, if it exists set ext1=%1 set ext2=%2 for /F "delims==" %%A in ('dir /b /a-d *.%ext1%') do ( if exist "%%~nA.%ext2%" ( echo found %%A. Deleting %%~nA.%ext2% del %%~nA.%ext2% ) ) Quote from: BC_Programmer on June 26, 2008, 09:42:19 PM I couldn't think of a way to do this with a batch file Call me old fashioned- I haven't read up on these new thingies they added for batch commands and such- I just go with what I know for DOS 6.0 Mine may be longer, but, do I get points for having it look more complicated? I wasted a good hour learning the WSH objects just to make it... and I just read it over... Quote from: BC_Programmer on June 26, 2008, 09:42:19 PM Code: [Select]set outstream = FSO.getStandardStream(1) 'retrieve the stdout streamwhy the heck did I put that there? Completely pointless... Quote from: BC_Programmer on June 27, 2008, 10:45:02 AM
I deliberately made mine verbose but you can fit it all in one line Code: [Select]for /f "delims==" %%A in ('dir /b /a-d *.%1') do if exist "%%~nA.%2" del "%%~nA.%2"&& echo deleted %%~nA.%2 Batch language is very good at doing the things it was designed for, and can be beautifully concise IMHO. Hey BC, Please take a look at your last post. (Reply #9) It has an extra end quote symbol at the end of the message. I think that is why the screen is so wide. Please modify & correct. Thanks! Quote from: BC_Programmer on June 27, 2008, 10:45:02 AM Call me old fashioned- ... I just go with what I know for DOS 6.0 I certainly wouldn't consider your VBScript to be "old fashioned" I am way behind on newer DOS batch programming also, and have a hard time following the loops that Dias creates, but the VBScript is even more difficult for me to follow. You must have spent a considerable amount of time learning it. I personally favor sticking with the batchfile programming if at all possible, because of the fact that most of the "mainstream" antivirus software throws up errors when you run VBScript (like sendkeys). Yes, you can click that it's OK to run it, but the message will scare the "H" out of most users. They will think that you have infected their computer. While that is not true, the average user will not be able to handle the error message without a lot of panic.Quote from: llmeyer1000 on June 27, 2008, 11:18:53 AM Hey BC, Fixed. I think. still looks wide to me though, not sure. Quote from: llmeyer1000 on June 27, 2008, 11:18:53 AM I didn't spend any time learning VBScript per se, but rather Visual Basic 6.0, if that Script makes your head spin, I'd hate to see the mess when you view the code in the Class module I felt compelled to attach... You can't do anything with it, since you don't have the evaluation Library, to which the class is just a PLUGIN. "just" a plugin. performs the core operations/Functions for the parser itself. Imagine, if you will, some of THAT String parsing. Quote from: llmeyer1000 on June 27, 2008, 11:18:53 AM I personally favor sticking with the batchfile programming if at all possible, because of the fact that most of the "mainstream" antivirus software throws up errors when you run VBScript (like sendkeys). Yes, you can click that it's OK to run it, but the message will scare the "H" out of most users. They will think that you have infected their computer. While that is not true, the average user will not be able to handle the error message without a lot of panic. that's the main reason I tried to write a batch program first. I don't know any of this new-fangled batch stuff, so I couldn't FIGURE out a way to do it in my (comparatively limited) DOS 6.0 Batch knowledge. I think I got to, "For %%P in (*.txt) do"... and then I realized, that I couldn't do string manip. So I started a Script. That was my very first shell script [recovering disk space -- attachment deleted by admin]Quote from: BC_Programmer on June 27, 2008, 11:58:24 AM I didn't spend any time learning VBScript per se, but rather Visual Basic 6.0, if that Script makes your head spin, I'd hate to see the mess when you view the code in the Class module I felt compelled to attach... You can't do anything with it, since you don't have the evaluation Library, to which the class is just a PLUGIN. "just" a plugin. performs the core operations/Functions for the parser itself. Imagine, if you will, some of THAT String parsing. Like I said, Quote Batch language is very good at doing the things it was designed for, and can be beautifully concise IMHO.BC, It looks like Reply #9 is OK now, but there is still something wrong somewhere, making the screen so wide. It's probably something I did in one of mine, but I can't find it. I don't have time to look for it anymore. (It could be anywhere. When I found your extra end quote code, I thought that had to be it.) Help! Someone. |
|
| 5249. |
Solve : start up programs? |
|
Answer» can SOMEONE tell me how to untick or delete programs that are starting up every time we switch PC on. it takes alot of time up. I saw a tech open something , i think was in DOS that comes up with a list which can all be ticked or unticked, and it helped my laptop, but i have forgotten the dos command am i on the right track here. |
|
| 5250. |
Solve : Wireless security encryption? |
|
Answer» how do i ENCRYPT my wirelss ROUTER for SECURITY so that OUTSIDERS cannot ACCESS? |
|