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.
| 5301. |
Solve : Playin with time? |
|
Answer» Hi all. |
|
| 5302. |
Solve : missing file problem? |
|
Answer» Hi Folks....I'm new and naive! After years of success with my old Dell Inspiron 3500, I booted it up the other day and it immediately went into DOS with the following ERROR message: "VMM32.VXD required to run Windows." I did a directory search and found the file in the C:\system directory. I thought it might be corrupted, so I tried to delete it in hopes of then reloading the Windows 98 OS and solving the problem. However, when I tried to delete the file, I got a "file not found" message. I then tried reloading the OS anyway, but it woudn't run and I got the same original error message. In summary, Windows doesn't recognize the file, it IS in the C:\system directory, but I can't delete it. Any thoughts? Thanks, in advance, for any consideration. |
|
| 5303. |
Solve : commands for Batch file to enter strings? |
|
Answer» HI Guys!!! |
|
| 5304. |
Solve : how to use batch file as a background process?? |
|
Answer» Hi, How can I make a batch FILE that will execute some process that is not visible, in the background ?You COULD try running your application as a service. Check out SRVANY |
|
| 5305. |
Solve : how to copy files from one pc to another pc in dos? |
|
Answer» hi, |
|
| 5306. |
Solve : Batch to close window? |
|
Answer» Hi |
|
| 5307. |
Solve : To count the no.of lines in a text file? |
|
Answer» Hi, |
|
| 5308. |
Solve : Batch File Tidying up? |
|
Answer» ok Ive created a batch file that checks that Oracle services on a server are running and it works |
|
| 5309. |
Solve : Batch Files to Check Services on local Machine? |
|
Answer» I wish to create a batch file that will check if a service is running on my machine (namely OracleOraHome92TNSListener). |
|
| 5310. |
Solve : Schedule upload file with different name? |
|
Answer» Just created a batch file for DAILY BACKUP, |
|
| 5311. |
Solve : How to: create a text file from a bat? |
|
Answer» HELLO, Hopefully this is easy for someone. What I'm trying to do is have a bat file leave a text file in the ROOT of c:\ It doesn't need to have anything in it, it just has to be there. What we are doing is RUNNING audit software and we have the ip range check accounted for but would LIKE the process skipped if the audit has run correctly. thanks in advance!echo >c:\done.txt for example should do it. hope it helps uli I knew it was something simple, thank you!!You can also use >> c:/Yourfilename.txt ECHO something in your file |
|
| 5312. |
Solve : Batch file to return ping response? |
|
Answer» Hello All, |
|
| 5313. |
Solve : REBOOTING HARDRIVE PROBLEMS? |
|
Answer» hi, i have recieved an old computer running windows 98, the computer is pretty much useless except i WANT to use the 20 GIG hardrive from it, and put it in my current computer. but im trying to reboot it while its plugged into the old computer and im having trouble doing so. i've tried the dos COMMAND reboot/autotest but it says the is a required perameter missing. is there an easier WAY or if not a way of fixing this. |
|
| 5314. |
Solve : How to know if a file is "in use"? |
|
Answer» How to know if a FILE is already "in use" (opened) by another computer in a network? |
|
| 5315. |
Solve : bat file to run file in my network places? |
|
Answer» Hi everyone. All your connections are in my network places, lan, internet etc etcFrom your description, I suspect your TALKING about the "Network Connections" folder not My Network Places. The Network Connections icons are not executable but rather hold the configuration for each type of connection. It is this information that programs accessing the telecommunciation features of your PC use to make their connections to the outside world or to other devices. If you want to access a device/internet you generally start software which will be configured to use a specific connection. (Ex: IE can be configured to use a Dialup, a LAN or wireless connection). It is this software your batch file would contain a pointer to, not the connection it might use. I'm so very confused what you're trying to do. :-? |
|
| 5316. |
Solve : Testing memory...? |
|
Answer» Hi, i am new here and i am wonderin if someone can point me in the right direction. i have to make a batch file that does the following: When you run the bat file, it wont carry on from where it left off after the restart. Try write a bat file that inputs the values into autoexec.cfg file then deletes them if you dont want anything there. Huh ? ? ? lol ok never mind i explained all wrong.You can change the registry KEYS to autologon to the pc. (To find out the keys make a reg dump, change it with tweak ui, make a reg dump, compare it with the fc command...) To autostart the batch file again after the REBOOT, do it with the registry. Change the registry back at the end of the batchfile. The reg commmand is in the [RK]. Will be tricky and timeconsuming but... hope it helps uli (I don't know the reg keys, sorry.) |
|
| 5317. |
Solve : how to put password for a folder in do? |
|
Answer» hi every one, im just a new MEMBER of this forum , i'll be greatfull if u people forgive me if i do mistake . |
|
| 5318. |
Solve : How to configure network on MS-DOS ??? |
|
Answer» Hi, I'm trying to connect my old laptop (PII 300MHZ, 128MB RAM) to my desktop computer (AMD XP 2600+, 1GB RAM) by LAN. The laptop has actually MS-DOS 6.22 and desktop is running under Windows XP Professional SP2. I'm not so crazy... I want to install Windows 2000 on it. Any solution for network config?? Sorry bout that i saw the reference to the i386 folder and AUTOMATICALLY assumed XP... The last time i had this dilemna i just purchased a 2.5"HDD adapter to IDE...that way you can slave that HDD onto your desktop machine and copyl away. Replace the HDD in the laptop and you should be good to go. patio 8-) |
|
| 5319. |
Solve : partition won't go away? |
|
Answer» after installing windows 98 i realized that by accident I left a partition that takes up 177 mb on the hard drive. FDISK says it's an extended DOS partition but i'm pretty sure that it's a swap partition that I made when I installed Red Hat 7. FDISK won't DELETE it because it says something about some logical DOS drive and when I tell it to delete it it says no logical DOS drives identified. I can't delete it but I want the 177 mb because the hard drive is only 1.5 Gb.SOLUTION: get a bigger hard drive (then 177meg is very very very very small) |
|
| 5320. |
Solve : end frozen applications using dos? |
|
Answer» i want to end FROZEN applications using dos prompt in windows xp. how can i do it? |
|
| 5321. |
Solve : Files from DOS to Windows? |
|
Answer» I am upgrading a COMPUTER at my office. The current one is very old, has windows 95! There is a very important program with lots of important info that I need to have in the new puter. Problem is this program is in DOS format! They have newer programs for windows now, but if I purchase one of these programs (atleast $1000) will I be able to transfer the files from the old program? Or can I transfer the old program right ONTO the new puter? I am not very computer literate if you haven't noticed, so I kinda need some help....... |
|
| 5322. |
Solve : Running an .MSP Windows Installer Patch? |
|
Answer» Hi guys, |
|
| 5323. |
Solve : How to delete folders with common characters name? |
|
Answer» I want to delete a lot of sub-folders with files. Folders named with some common characters e.g. /foldera/200406, /folderb/200407, /folderc/200408 ...... many. |
|
| 5324. |
Solve : DOS Shell? |
|
Answer» I KNOW, its odd that a person like me would still be running DOS 4.1, but, I still need help here. |
|
| 5325. |
Solve : continuing bat file after restart? |
|
Answer» hi there...is there a way where I can run a bat file which shuts down the computer then continue running the bat file after it restarts? i've search HIGH and low and still cant find the command or procedure to do it. thanks for any help.Not directly and not easily. The computer remembers remarkably little from boot to boot. |
|
| 5326. |
Solve : Compare Directory listing (file names and size)? |
|
Answer» Hello , |
|
| 5327. |
Solve : registry remote and errorlevel?? |
|
Answer» HELLO, I am changing 2 REGISTRY KEYS on remote COMPUTERS which works fine. Little PROBLEM is the errorlevel. How can I intercept failures? Seeking and solve would be very timeconsuming. (OS is NT4) I am a bit pressed for time at the moment, sorry... Uli |
|
| 5328. |
Solve : getting one folder down, take it in a var, g? |
|
Answer» Hello... |
|
| 5329. |
Solve : %systemdrive% question? |
|
Answer» Is there a COMMAND LIKE %systemdrive% wich is MOSTLY c:\, for a dvd DRIVE? |
|
| 5330. |
Solve : For Loop Problems? |
|
Answer» Ok, I am trying to write a batch file that will make a MS Word document, and I have 99% completed, the document is a list of tracks in a directory, and serves as a label for a CD, my only problem, is that I have a FOR IN DO loop, in which the file name of each track, minus the extension is written to the file, works perfectly, however, I also have an ITERATOR variable in the loop that I += each time to INCREMENT, this allows the track number to be written to the file, here is an example of the code I am trying to write, and the problem with it is that when I access the index variable, it writes the pre FOR loop value, not the new += value that is assigned in the FOR loop, any suggestion?!? |
|
| 5331. |
Solve : echoing the? |
|
Answer» I'm automating a batch file that will CREATE another batch file and put the & character in it. When I TRY to: |
|
| 5332. |
Solve : XCOPY: Asking for the destination folder? |
|
Answer» How could I have the .bat file ask for the destination folder. |
|
| 5333. |
Solve : Need Help Batch file? |
|
Answer» hi |
|
| 5334. |
Solve : Re: Real DOS on XP? |
|
Answer» Not on XP as DOS is also an operating system. You could dual BOOT a system with DOS on the first partition and XP on a second partition. There is also DosBox. Note: DosBox is an emulator not an OS. i got a legal version of[highlight] DOS 6... but MINE can simply read FAT32[/highlight], i never had any other! I would be interested in the details of this as FAT32 wasn't even around with DOS 6. Install Virtual PC 2004 and install DOS (or Win 95) in that I have done it for a client on their Win XP box, and DOS programs are running happlily (and faster) inside a virtual Win 98 environmentMS Virtual PC is listed in the software FAQ. No SEARCH necessary. See my signature.Quote GX1_man, i got a windows 98 using FAT32... and DOS is running like it should! You said DOS 6 running on FAT32. I want to hear the details of that. From a command prompt or DOS type in ver and press enter. What does it say? |
|
| 5335. |
Solve : Win2k recycled bin? |
|
Answer» I am using an old SAGE database program on Win2k. The data transfer is traditionally sent via floppy disk. I have since eliminated this, using networked drives with the A: or B: drive letters. I am attempting to make this operation able to work without the network present, but without floppy DISKS. I am trying to use a logical partition in place of the floppy drive. The A: or B: are not really an issue, since the program now allows any drive letter to be the destination. |
|
| 5336. |
Solve : small problem? |
|
Answer» HI All, |
|
| 5337. |
Solve : batch to open and close mapped drive? |
|
Answer» Hi In other words, what command would I use to now close the L drive window I opened with command 'start'? "exit" closes the window uli uli both solutions sound interesting, my only PROBLEM is how to syntax your results would you be able to help me CONSTRUCT the batch file CODE? I have really no idea how to do it |
|
| 5338. |
Solve : Batch file to convert a file? |
|
Answer» Hello, |
|
| 5339. |
Solve : Copying a folder? |
|
Answer» HELLO again, I'm making myself an AUTO installer wich also copies folders into another folder. But the problem is that i don't have the code to COPY the whole folder to somewhere else. I hope you guys (and girls) can help me! Greetz RubenXCOPY?Hmm doesn't seem to work, I've got this so far: Code: [Select]XCOPY "C:\ZStuffZ\CounterStrike Source\Data\CounterStrike Source\Level Parts\materials" "C:\ZStuffZ\CounterStrike Source\Data\CounterStrike Source\Level Parts\test" The names of the root map is *materials* , in this map there 3 other maps, I want that the batch file copies them all with content to the map NAMED *test* Thanks in advanceXCOPY /s "C:\ZStuffZ\CounterStrike Source\Data\CounterStrike Source\Level Parts\materials" "C:\ZStuffZ\CounterStrike Source\Data\CounterStrike Source\Level Parts\test" The /s SWITCH copies all subfolders with contents. try xcopy /? for more info. uliThanks guys! I got it fully working now! |
|
| 5340. |
Solve : delete line from the file? |
|
Answer» How do i delete the line from the file ? How do i delete the line from the file ? can you provide a use case for this? from what i see, it SEEMS your intention is to delete all the lines of the file? if it is, just Code: [Select] type nul > yourfile.txt will do. This will blank out your file. I may be wrong though |
|
| 5341. |
Solve : Who has real dos?? |
|
Answer» Because I don't have real dos, just command prompt, and I was wondering if theres even people that use dos anymore??!!!I have it on one old machine (v 6.22), and up to Win98 can be considered "kind of" a real DOS as well, even though it has a command prompt as you can reboot in DOS mode. |
|
| 5342. |
Solve : Any help maybe?? |
|
Answer» Basically, Ive been writing a batch file which activates all firewalls/proxies/anti-virus etc. programs at once. I was wondering if there is a way to properly deactivate my networkcard from DOS. |
|
| 5343. |
Solve : Recovering files in DOS?? |
|
Answer» How can I recover a deleted file in DOS? |
|
| 5344. |
Solve : Assigned for Awk in another Section? |
|
Answer» Quote from: ghostdog74 on December 27, 2009, 07:13:53 PM I see your code, but wonder where are awkbat6.bat and awkbat8.bat ? I have also run your code, but I have another question, if I have more data, like 309, 310, 311 etc...do i have to create awkbat09.bat , awkbat10.bat, awkbat11.bat etc as well? I posted awkbat8.bat but you said you were not interested. Awkbat6.bat and awkbat8.bat is generic code that will work for any line as it did for line 301. I saw no other input files from Eldorado,Topic Starter, other than what was used. If Ghostdog 74 is really interested in a batch solution, please post the code you have written and we will work together. I see no need to continue if you don't offer to help. Quote Only one person in 1000 have access to Awk (gawk ) files HuH? gawk for windows is available to everybody with internet. http://gnuwin32.sourceforge.net/packages/gawk.htmQuote from: Geek-9pm on December 27, 2009, 07:33:17 PM HuH? My mistake. I should have written that only one in 1000 ever download or use awk (gawk). Thanks for the download site. http://gnuwin32.sourceforge.net/packages/gawk.htm I will try again.Quote from: BillRichardson on December 27, 2009, 07:46:06 PM My mistake. I should have written that only one in 1000 ever download or use awk (gawk).this is baseless and is fit for the rubbish bin.Quote from: BillRichardson on December 27, 2009, 07:29:28 PM I posted awkbat8.bat but you said you were not interested.you keep saying there is awkbat8.bat, but where is it ?? and if they are generic, then why are there 2 versions of it awk6 and awk8?? if its generic, you should make it such that it works for all scenarios, no matter whether there are 309, 310 or 411 etc... why is there a need to call that many .bat files?? I am really a beginner in batch, and my gawk solution solves the problem for data like this Code: [Select]C:\test>more file 301|AF_ACC_BDL|774; 301|AF_WMG_BDL|6660; 301|AF_REP_BDL|4735; 303|AF_ACC_BDL|1360; 304|AF_ACC_BDL|5092; 305|AF_ACC_BDL|32384; 306|AF_ACC_BDL|80859; 306|AF_REP_BDL|80875; 308|AF_ACC_BDL|1418; 308|AF_WLH_BDL|78273; 308|AF_WSL_BDL|9990; 308|AF_WFL_BDL|9998; 309|AF_BLA_DDD|9999; 309|AF_BAL_DDE|99999; 309|AF_AAA_DDW|99959; 310|AF_XXX_AAA|1345; 310|AF_YYY_AAA|1235; 310|AF_ZZZ_BBB|1245; C:\test>gawk -F"|" "{a[$1]=a[$1] FS $2 FS $3}END{for(i in a){ print i,a[i] } }" file 310 |AF_XXX_AAA|1345;|AF_YYY_AAA|1235;|AF_ZZZ_BBB|1245; 301 |AF_ACC_BDL|774;|AF_WMG_BDL|6660;|AF_REP_BDL|4735; 303 |AF_ACC_BDL|1360; 304 |AF_ACC_BDL|5092; 305 |AF_ACC_BDL|32384; 306 |AF_ACC_BDL|80859;|AF_REP_BDL|80875; 308 |AF_ACC_BDL|1418;|AF_WLH_BDL|78273;|AF_WSL_BDL|9990;|AF_WFL_BDL|9998; 309 |AF_BLA_DDD|9999;|AF_BAL_DDE|99999;|AF_AAA_DDW|99959; notice the data now has 309, 310?? (and you can add more), but it will still solve it, without adding extra code. Now all i am asking you , since you started to do this in batch, is to do the same. I do not want to create extra batch files. I just want to do it in one batch file...is that ok ?? can you show me how please, in batch ? GH, I'm not an expert with batch. I suspect someone by email has given you a better batch solution. My solution works. It is not a good design nor good code. You need someone with more skill than I can offer. Good Luck. We are getting nowhere. You need a new start. Send me your new batch program. p.s. I got the gawk to work but not with the "all one line" problem. As good as you are: start from scratch and write a new batch for this problemI nominate this thread for *censored* of the year award. In fact, I find it so *censored*-ey that I might even require it's URL as part of a shebang line for BCScript files, heh. Quote from: BillRichardson on December 27, 2009, 10:10:34 PM As good as you are: start from scratch and write a new batch for this problem Why? he has a working AWK solution. Additionally I might wonder aloud why it is that you prefer batch over VBScript and JScript? your reasoning for awk is that it needs t be downloaded; but VBScript and JScript COME with ALL installations of windows since windows 98SE; any windows install past windows 95 (in fact, windows 95 has an OS update that I believe installs ActiveX Scripting engines such as VBS and JS) can use VBScript files. There is no reason to write a batch file if a working VBS or JS solution is provided, and works better. your statements that they are "easier to understand" are merely expressions of your own opinion and not actually decided through any real experience with people using VBS and batch files. batch files ALWAYS open a command prompt window; this, in and of itself, is enough to scare new users sometimes. VBScript, on the other hand, can be written to use WScript.exe and therefore use dialogs and Inputboxes rather then scary text mode Command prompt UI, so anybody who wouldn't understand VBScript would likely prefer the VBScript solution anyway, which brings up the point that the idea isn't always to educate the person seeking help as to the intricacies if the language, but rather to simply provide a solution; sometimes a batch solution, sometimes VBScript, but there is absolutely, positively, no reason to lean towards batch unless the OP has expressed a EXPLICIT interest in only batch-based solutions, and even in those cases a VBScript can be adapted to run from within a batch script anyway so the point is moot. If the OP then becomes interested in learning VBScript, they can be referred to a number of fine resources. I might even conclude that VBScript is EASIER for a new user to understand; BASIC statements roughly translate into plain english: Code: [Select]For Each Value In Collection Print Value Next Value Is a *censored* of a lot easier to read then: Code: [Select]For /f %%P in (`type collection`) do echo %%P Sure, they both have similarities, but the batch version is not exactly plain english, there are far too many semantics that would need to be explained, such as why there are percent signs, and of course why it is that when the OP uses the command at the command prompt you need only a single % sign. Batch being "simple" is a huge misperception by a large number of users, even the base language as used in Pure DOS is relatively confusing. Only language I can think of being more "english-like" then BASIC might be python; I don't have extensive experience but I will not argue the repeated point Ghostdog makes that it is easy t olearn for a beginner. It may not ALWAYS be the best choice (which I believe is where I and ghostdog disagree) but it certainly isn't a bad starting point for anybody. Batch Is. Trust me, I know from experience that learning batch programming first can become a hurdle later on when learning a less domain-restricted programming language. When I first started with QBASIC after using batch, it took some time to realize that I wasn't writing commands, I was writing statements; my previous experience with batch was certainly only a minor hurdle, but a hurdle nonetheless. It's not necessarily a bad thing to learn batch; it's a bad thing to try to learn another language from the PERSPECTIVE of batch semantics, which I believe would hold true for nearly any programming language; they have different "spirits" to steal the term from Bruce McKinney, Author of "HardCore Visual Basic"; for example, the C "spirit" pretty much says the programmer is in control of everything; memory allocations, deallocations, everything must be done by them, and it is this "total control" concept that lends itself to streamlined, low-level C code. Visual Basic tries to hide a good number of things about windows programming from the programmer, sparing them the troubles of creating and maintaining window handles, sending and recieving window messages, etc. There is of course some allocation to be done, such as dimensioning variables (optional, actually, defaulting to the Single data type in Version 1 and to Variant In versions after, unless a Deftype statement is found in the declarations section of a module, in which case the default type for that module is the specified type), but once a variable goes out of scope, it is automatically destroyed. To some extend, C will do this; for static variables declared within procedures. However, pointers will NOT be automatically deallocated in C and this must be dealt with properly. The "spirit" if batch is the very essence of a "glue" language, that is, calling of a number of programs that were compiled in other LANGUAGES (things like format, find, etc) in predefined orders, and with very specific and basic Control flow that was pretty much a spaghetti of gotos. It has evolved past this stage but it is still a glue language at it's core, and a glue language is limited in far too many ways to count and at the same time its powerful by the sum of the parts that is happens to glue together. One of the things that batch can use as a glued piece is AWK, just as VBS code can be written to a file and executed from a batch, so to can AWK be executed from the command line, as an extension of batch. Consider for a moment that almost every batch program calls into another program to do it's work, and all batch programs rely on cmd.exe to perform at the very least basic interpretation of the file; ther eis no denying that it has limitations, and one of these limitations can be found in text processing. warranted, it CAN do text processing, but it takes experience and patience to get it working; on the other hand, scripting languages like VBS have a number of string functions at their disposal, and their Date/time manipulation is simply not matched by any feasible batch solution. Quote from: BC_Programmer on December 28, 2009, 07:47:04 AM I nominate this thread for *censored* of the year award. BC writes many lines of nonsense and says nothing and offers no code of any kind as a solution. What happened to the Perl Solution from BC? Where is there a solution of any kind offered by BC? Is Bc the DILETTANTE of the Hope Board? dil·et·tante (dl-tänt, dl-tänt, -tänt, -TNT, -tnt) n. pl. dil·et·tantes also dil·et·tan·ti (-tänt, -tn-) 1. A dabbler in a field of knowledge. See Synonyms at amateur. Superficial; amateurish.Learn to read, troll.Quote from: BC_Programmer on December 28, 2009, 04:19:12 PM Learn to read. Where is BC's code?Quote from: BillRichardson on December 28, 2009, 05:17:53 PM Where is BC's code? What code? I never promised any code.Let's boycott him. |
|
| 5345. |
Solve : How do we use gawk.exe?? |
|
Answer» I got the following errors using gawk.exe. MAY we run gawk.exe from the command line? C:\batch>"C:\Program Files\GnuWin32\bin\gawk.exe" -F"|" '{a[$1]=a[$1] FS $2 FS $3 } END {for(i in a){print i,a} }' awkinfile.txt gawk: '{a[$1]=a[$1] gawk: ^ INVALID char ''' in expression C:\batch>type awkinfile.txt 301|AF_ACC_BDL|774; 301|AF_WMG_BDL|6660; 301|AF_REP_BDL|4735; 303|AF_ACC_BDL|1360; 304|AF_ACC_BDL|5092; 305|AF_ACC_BDL|32384; 306|AF_ACC_BDL|80859; 306|AF_REP_BDL|80875; 308|AF_ACC_BDL|1418; 308|AF_WLH_BDL|78273; 308|AF_WSL_BDL|9990; 308|AF_WFL_BDL|9998; C:\batch> use double quotes instead of single quotes on win32. Read the gawk manual under Getting Started section 1.1.6.1 Quoting in MS-DOS Batch Files. CODE: [Select]gawk.exe -F"|" "{a[$1]=a[$1] FS $2 FS $3 } END {for(i in a){print i,a[i]} }" awkinfile.txt Quote from: ghostdog74 on December 27, 2009, 08:18:09 PM use double quotes instead of single quotes on win32. Read the gawk manual under Getting Started section 1.1.6.1 Quoting in MS-DOS Batch Files. C:\batch>"C:\Program Files\GnuWin32\bin\gawk.exe" -F"|" "{a[$1]=a[$1] FS $2 FS $3 } END {for(i in a){print i,a} }" awkinfile.txt gawk: (FILENAME=awkinfile.txt FNR=13) fatal: ATTEMPT to use array `a' in a scalar context C:\batch>type awkinfile.txt 301|AF_ACC_BDL|774; 301|AF_WMG_BDL|6660; 301|AF_REP_BDL|4735; 303|AF_ACC_BDL|1360; 304|AF_ACC_BDL|5092; 305|AF_ACC_BDL|32384; 306|AF_ACC_BDL|80859; 306|AF_REP_BDL|80875; 308|AF_ACC_BDL|1418; 308|AF_WLH_BDL|78273; 308|AF_WSL_BDL|9990; 308|AF_WFL_BDL|9998; C:\batch>I really can't stand you. Did you copy and paste my code properly? if not, type it in correctly on your terminal.!!! Quote from: ghostdog74 on December 27, 2009, 08:46:24 PM Did you copy and paste my code properly? if not, type it in correctly on your terminal.! The code does not work and you blame me? We can see the code is the same as was given. I USED copy and paste. How could we not copy and paste correctly? Here it is again: C:\batch>"C:\Program Files\GnuWin32\bin\gawk.exe" -F"|" "{a[$1]=a[$1] FS $2 FS $ 3 } END {for(i in a){print i,a} }" awkinfile.txt gawk: (FILENAME=awkinfile.txt FNR=13) fatal: attempt to use array `a' in a scalar context What is typed incorrectly? C:\batch>Quote from: ghostdog74 on December 27, 2009, 08:46:24 PM Did you copy and paste my code properly? if not, type it in correctly on your terminal.! I used another awk program* and it worked: http://www.pement.org/awk/awk1line.txt C:\batch>"C:\Program Files\GnuWin32\bin\gawk.exe" "{ total = total + NF }; END { print total}" awkinfile.txt 12 Quote from: ghostdog74 on December 27, 2009, 08:46:24 PM Did you copy and paste my code properly? If not, type it in correctly on your terminal. I finally got your "all in one line" gawk to run. Thanks for your help. Here it is from my machine: C:\batch>"C:\Program Files\GnuWin32\bin\gawk.exe" -F"|" "{a[$1]=a[$1] FS $2 FS $3}END{for(i in a){ print i,a } }" file || 301 |AF_ACC_BDL|774;|AF_WMG_BDL|6660;|AF_REP_BDL|4735; 303 |AF_ACC_BDL|1360; 304 |AF_ACC_BDL|5092; 305 |AF_ACC_BDL|32384; 306 |AF_ACC_BDL|80859;|AF_REP_BDL|80875; 308 |AF_ACC_BDL|1418;|AF_WLH_BDL|78273;|AF_WSL_BDL|9990;|AF_WFL_BDL|9998; C:\batch> p.s. I used copy and pasteCode: [Select]gawk.exe" -F"|" "{a[$1]=a[$1] FS $2 FS $3}END{for(i in a){ print i,a } }" file the above will give you error at this part here ---------------------^. it should be Code: [Select]gawk.exe" -F"|" "{a[$1]=a[$1] FS $2 FS $3}END{for(i in a){ print i,a[i] } }" file so i really doubt you are doing the right thing.gawk.exe" -F"|" "{a[$1]=a[$1] FS $2 FS $3}END{for(i in a){ print i,a } }" file [/quote] So I really doubt you are doing the right thing. [/quote] I got the right answer and posted the output. Thanks for your help. I finally got your "all in one line" gawk to run. Thanks for your help. Here it is from my machine: C:\batch>"C:\Program Files\GnuWin32\bin\gawk.exe" -F"|" "{a[$1]=a[$1] FS $2 FS $3}END{for(i in a){ print i,a } }" file || 301 |AF_ACC_BDL|774;|AF_WMG_BDL|6660;|AF_REP_BDL|4735; 303 |AF_ACC_BDL|1360; 304 |AF_ACC_BDL|5092; 305 |AF_ACC_BDL|32384; 306 |AF_ACC_BDL|80859;|AF_REP_BDL|80875; 308 |AF_ACC_BDL|1418;|AF_WLH_BDL|78273;|AF_WSL_BDL|9990;|AF_WFL_BDL|9998; I had a long rant here but realized it was just a waste of time. Quote from: ghostdog74 on December 27, 2009, 08:46:24 PM I really can't stand you. We'd be hard pressed to fine somebody who does!Quote from: BC_Programmer on December 29, 2009, 10:26:18 AM I had a long rant here but realized it was just a waste of time. Thanks for the kind words. I'm doing something right. Sincerely, Bill Richardson |
|
| 5346. |
Solve : Delete?? |
|
Answer» HI I own a Game Server and I need a Batch that will DELETE any file inside the folder the batch is in that has a name longer than 12 chars.. Example It will be in the "characters" folder and it needs to delete any .txt file that is named ANYTHING longer than 12 chars. C:\batch>type great12.bat Code: [Select]@echo off dir /b *.txt > 12long.txt awk.exe "length > 12" 12long.txt > great12.txt for /f "delims=" %%i in (great12.txt) do echo %%i rem for /f "delims=" %%i in (great12.txt) do del %%i Output: C:\batch> great12.bat 2awkinfile.txt awkinfile.txt awlinfile.txt caavsetupLog.txt christmas.txt endresult.txt finalziplist.txt Instruct_for.txt list_of_program_files.txt outinfile.txt testfilnam.txt xsplfiles.txt C:\batch>@OP: you might want to put rem before this line: Code: [Select]for /f "delims=" %%i in (great12.txt) do echo %%i and remove the rem from this line: Code: [Select]rem for /f "delims=" %%i in (great12.txt) do del %%i Quote from: BillRichardson on December 29, 2009, 12:19:26 PM C:\batch>type great12.bat you can use gawk's FILENAME variable, IF you have gawk. Code: [Select]C:\test>gawk "length(FILENAME) > 4 {print FILENAME;nextfile}" *.txt |
|
| 5347. |
Solve : Check the free disk space? |
|
Answer» ENOUGH...once again. Topic Closed. patio. |
|
| 5348. |
Solve : Copying backup files in DOS? |
|
Answer» What I want to do is to boot up in DOS and copy every file on my hard drive to another partition or burn it to a DVD, so that later I can format the system partition and copy all those files back. Can this be done from the command prompt?Welcome to the CH forums. |
|
| 5349. |
Solve : How to search a certain file and repeat until found? |
|
Answer» Hello, I am new to the forums and thanks everyone for your help. Here is how to increment in batch: Something along those lines. I was exploring a solution for this thread with that particular construct but realized that it would be more difficult than that: the numbers would need to have an appropriate number of zero's prepended. the bleeding obvious VB equivalent, Code: [Select]strnewname= "mx one " & String(4 - Len(Trim(Str(Number))), "0") + Trim(Number) & ".exe" doesn't work in batch. Oh... heh, I could always write a little script, I suppose; I'm not certain what the desired result is; that is, what "newfilename" is to be (?) Making a good batch file can be a lot of fun. But a person is better motivated to do a good job if they have a good reason. Looking over your original post, I don't see a very good reason for doing this. Pardon me, but that freeware program you're REFERRING to works very well just the way it is. So I don't get the point. You already know that it's going to give itself another name and delete the prior version. So what's wrong with that? But, if you insist, it's quite easy to find a file that has a certain name or has some ambiguity in the name. Now the question would be; Suppose to found 100 files that have ambiguous names. Do you want to delete them all? You want to rename the mall? Or just rename the last one and delete all the others? You objective is either not clear or in unreasonable. Remember, Reason must precede logic.Quote from: Geek-9pm on December 30, 2009, 02:18:47 PM Making a good batch file can be a lot of fun. But a person is better motivated to do a good job if they have a good reason. Thanks for the help. The purpose of this batch file, is that when the common box dialog that Autorun launches, it calls this batch file. I was creating the ability for the user to open the program every time it clicks on the desired option of the Autorun Select Option Dialog. As I said, I can do this everytime I want if the file I'm looking for is named Mx One 0001, for example, as I said. But when I do want to execute it, via the command line, in order for it to be called, executable files cannot have spaces in their names, so that's why I have to rename Mx?One?0001.exe to MxOne_Antivirus.exe, that is a valid executable file name at Command prompt. The reason I'm doing, is for a school project, hehe sorry to not mention that. My logic behind this, is to look the file name with an Index, as BC_Programmer stated with a VB Script instead of a Batch file; first I rename it (obviously a command prompt shows up as usual) and then, it renames Mx One 0001.exe IF Found IF NOT EXIST, then I have to look over the removable drive (only at its root) for the *.exe name containg at Least Mx One+an Index over it, then again, IF FOUND, rename that file to MxOne_Antivirus.exe that is a valid executable filename and last, launch it via command prompt (batch file), repeating this operation several times with a limit. (similar to search until found, obviously this limit has to be a little bigger). If this is more complex, and there's another portable, or practical solution like C, C++ or Java, or another programming language, please suggest Thanks PD With an Index I mean that the file has an ambiguity in its name, following your advice. This ambiguity is that the file deletes itself when you update, and changes its version that follows a sequence. So I do want to look up for the filename with an Index over its String name, and if found rename... bla.. Quote from: BC_Programmer on December 30, 2009, 01:47:51 PM Something along those lines. The new filename to be is, as my previous reply with a valid name, in order to be executed. It searches for Mx One 0001.exe, IF Found it renames this *.exe file for MxOne_Antivirus.exe, then it launches MxOne_Antivirus.exe that is the new Filename prior to the last one that was Mx One 0001.exe. This obviously, always works due that it only has to look for Mx One 0001.exe, but when you update it, a new filename with the next sequential version creates, deleting the previous one and leaving only the new one. So as I firstly explained: Mx One 0001.exe no longer exists, and Mx One 0002.exe is created instead. This is the UPDATED filename, with the newest deffinitions. I want to look over this ambiguity, leaving the ability for it to be an Auto-Execute option, that is called from my Modified Autorun.inf file, that calls this particular batch file. Thanks for any further help If I understand correctly, your filenames are in the form: "Mx One 0001.exe" with different 4 character numbers on the end or what have you. you can rename them ALL at once! I just remembered our good friend, the ? wildcard: Code: [Select]ren "?? ??? ????.exe" "??_???_????.exe" of course, if for some reason you have other exe files with 2 characters, a space, three characters, a space, and four characters, it will rename these, as well. But that seems unlikely.Quote from: BC_Programmer on December 30, 2009, 05:09:51 PM If I understand correctly, your filenames are in the form: Yes, that was exactly I was looking for, didn't know MS-DOS had that pattern . Ok, one last issue and it is minor. Obviously anyone who gets into their USB and launches my particular option I created with Autorun it will open a Command prompt window. I want it to be hidden, or show Up, but when the Antivirus program is called, I mean when this sentence is completed succesfully, close it immediately by itself, but leaves the Antivirus program opened. Can this be done? I've heard something about hstart execute file you have download, but it has a lot of features and more complex than I want to do.Not sure I understand, but you can use Exit in a batchfile to close it; programs it started will still execute.Quote from: Helpmeh on December 30, 2009, 01:27:17 PM Here is how to increment in batch:FYI: That way would only work if the OS he ran the batch on was NT or later. But BC's method is more methodical(and never knew about the ? wildcard ) |
|
| 5350. |
Solve : MS Dos and Compressed Virtual drives? |
|
Answer» I have a hard drive with three volumes. Two are compressed volumes and are easily viewed in the 98SE OS, but not in a dos environment. I am attempting to edit both of the compressed volumes using Nortons Diskedit, but cant get Norton to see the compressed volumes. Norton sees the volumes when I run it from the 98SE OS, but not when I run it in dos. The problem is that Norton Defaults to a Read Only status in a Windows OS. I am unable to edit the volumes that WAY. If I can get dos to see the volumes (uncompressed) then I can get Diskedit to modify the same volumes. Are these NTFS compressed volumes? DOS does not support NTFS. neither does win98SE. Maybe they are Double-spaced or DriveSpaced?They are Drvspaced or perhaps Dblspace for sure. They are all FAT volumes. drvspace will decompress the volumes when I boot to a 98SE OS, so that is not an issue. The problem is when I attempt to return to a pure dos mode, the two virtual volumes are gone. It is like this: Windows 98SE D: E: F: DOS D: Quote from: hminus on December 29, 2009, 07:37:57 AM They are Drvspaced or perhaps Dblspace for sure. Is this when you exit Windows 98 to the command PROMPT? To access a Drivespace compressed "volume" in MS-DOS, you need to create, and then boot from a DOS 7 boot floppy with drvspace support. It is. Here is the breakdown.. I work the HD from a forensic boot disk , before any DCA takes place. I will look for data in the file slack and anything in the unallocated space, ect... After I am satisfied with that search, I will then shut the system down, remove the boot disk and do the following: 1. configure the HD that I wish to examine as the slave drive 2. configure my windows 98se HD as the master 3. boot to win98se and let DCA do its thing. (it is at this point I start having problems... I have some forensic tools loaded on the 98se machine in the root directory. These tools are dos tools. I can run them in 98se in a dos box and they see the logical drives just fine, but when i exit to c:.... they are gone..) Now one might say just use these tools in the windows dos box and be done with it... I would except programs like nortons diskedit will not allow you to get out or read only mode while operating in windows...) ======oh yea, my boot disk is version 7... I believe that is the version that comes with 98SE. Thanks for any help. I ask again, are you loading the drivespace compression driver when you start with the boot disk? Yes, Drvspace, IO.SYS are there.So you are a law enforcement officer?Yes I have been for nearly 15 years now.. I am currently working on my CCE and am having a bit of trouble getting some of my DOS tools to work. When you exit to C: and they don't show up, your doing that in DosBox on the 98SE volume right? That's the problem. The volumes show just fine in the DosBox,.. the dos tools I am using need to be in a pure dos environment to work properly. I need the volumes to show when I exit windows to DOS. Nortons diskedit will not let you write to a disk if you are running it in a DosBox. I think you will have to do a boot from a floppy, bypassing the hard drive W98 boot altogether. I thought you were doing this? |
|