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.
| 1551. |
Solve : Need help with 2 batch files? |
|
Answer» OK, I need to make 2 batch FILES in DOS, and I'm not really handy with DOS, so if you could help me out... The first one: A batch who merges the content of 2 .txt files, into a new .txt file, and then saves it into a specific directory (if the directory already exists, the batch stops), and then it sorts the content of the new file (A-Z), and then it saves that into a new .txt. And the file paths have to be entered when you open the batch. The second: A batch who merges the content of all specified .txt files into a new .txt file, and saves it to a specific directory (if it already exits, stop). The file paths have to be entered when you open the batch. It's COMPLICATED (I think), tnx i think you should lern somethink about COPY SET (SORT?) and IF commandif you have some UNIX tools installed, 'sed' and 'cut' would do nicely here. |
|
| 1552. |
Solve : Rename files with Date and then copy them in batch file? |
|
Answer» Hi i have a Batch FILE that does not work . Its meant to RENAME the files to the current date and then copy them to an archive folder |
|
| 1553. |
Solve : From Bad To Worse? |
|
Answer» I have an old PC (PII, 500), originally had 98 on it, but wanted to network with my other PCs in the house, so I recently loaded 2000 Windows and Office. All was fine (as a standalone, not networked) until I loaded McAfee Suite on it and all of the sudden started getting fatal errors anytime I went into I-Explore. I unloaded the McAffee and it improved some but still got intermittent IExplore errors. No errors when offline but after varying amounts of time on-line, I will eventually get an error and it either closes Explorer or reboots completely. Out of desperation, I tried installing XP today and all sorts of new trouble started. XP INSTALL failed due to numerous "Can't find such-and-such...."errors and now is locked in a continuous loop of "Can't find Command.com" and FORCES reboot. Nothing I have been able to do with my old 2K Restore disk or XP Install disk gets me past this. I am willing to reformat the HD and completely start over but can't get to a DOS command. Any thoughts as to how to get passed it's desire to finish the aborted XP Install? Is there a bootable disk I can download on-line (using another PC) that will allow me to reformat everything and start fresh? Any help would be appreciated. BTW - the PC is a no-name and I have no documentation for it. Thanks...JHBoth the Win2K and the XPCD's should be bootable...make sure to enable the CDRom as the first BOOT device. |
|
| 1554. |
Solve : Inputting username and password on one line? |
|
Answer» hi, |
|
| 1555. |
Solve : Merge files (computer XP)? |
|
Answer» Hey peoples, I have a windows XP computer and I have a request to make. There are few (if any) legitimate reasons for hiding one file inside of another file Well I don't think so there is away. Maybe if you know a alot about dos then you can give me an answer. The files that I would be doing this with would be a .jpg and a .zip. If you could post code it would be much appreciated. Regards, Tan_Za |
|
| 1556. |
Solve : Fixed Length and Variable Lengthing a file?? |
|
Answer» Hopefully someone can help |
|
| 1557. |
Solve : DIR - DiscLetter? |
|
Answer» how can do for loop which will do sth like this: what is the /i switch? Or is it even a switch? if you type IF /? at the prompt you'll find out. STRICTLY speaking it was unecessary in the post above where you saw it. |
|
| 1558. |
Solve : Help deleting directory with out knowing name? |
|
Answer» There are some kids at my school who have installed games like halo and grand THEFT AUTO and other games on the school computers. I am in internship and have been put in charge of deleting the games from the school computers. I am wondering how I can get the directory name. |
|
| 1559. |
Solve : NET USE MAPPED DRIVES QUERY? |
|
Answer» Hi logon script to map drives and folders |
|
| 1560. |
Solve : run vbs from remote machine? |
|
Answer» on my servers i have created a vbs SCRIPT that will save the security log in a specific path with the date name. Is there a way of running a command so it runs on the remote system as if i was physically logged in and running it? Can you use a 3rd party tool? Psexec from the pstools (Sysinternals) should do it. The pstools are working fine with NT4. hope it helps uliPSEXEC from Sysinternals as suggested by Uli, or SOON.EXE from Microsoft (in the WINDOWS resource kit) should both do what you want. |
|
| 1561. |
Solve : check user input is x characters or specific forma? |
|
Answer» Hi, |
|
| 1562. |
Solve : Count Rows in a Text File? |
|
Answer» Hi Chaps, |
|
| 1563. |
Solve : Batch to run ping loop? |
|
Answer» Hey guys, Basically I want to ping an ip constantly to keep a connection going So he needs to ping every minute or 10 minutes, etc., not every 10ms. If you know a way to do the QBASIC equivalent of SLEEP 10, suggest that. Mac would a simple way to do this be : :ping ping x.x.x.x wait 10 goto :pingBasically my iplist.txt is going to have a few different ips so I don't give 1 website the sh!ts by constantly pinging them. I am looking to send a ping out every few minutes to keep the connection established. while I try to figure out what another problem is. Cheers for the replies guys.The "wait 10" idea doesn't work in WindowsNT. WAIT is not a command. However, if you just want to stall to give hosts a break, try this Use my suggested BAT file (change filenames as desired) In the TXT file, put your real sites you want to ping and then FOLLOW by a zillion instances of your own IP address. By the time it gets through trying to ping them, some time would have elapsed.Qbasic cheers for that I will give it a try. What about this :ping ping -n 100 127.x.x.x goto :ping I have been pinging a MATES website as he does not mind as I am having trouble making it find the txt file with the iplist.At what interval do you want to ping your iplist.txt? Do you want to wait between each ping? Or ping everything in your iplist.txt, and then delay? Try this for once every minute, delay between each ping: Code: [Select]echo off :Start for /f %%a in ("C:\Documents and Settings\Matt\My Documents\Matt\iplist.txt") do ( echo %TIME% >> pingLOG ping %%a >> pingLOG ping -n 61 localhost >NUL ) goto :StartIf you are just looking for a result without the nuts & bolts then Connection Keeper will do it all for you. http://www.gammadyne.com/conkeep.htm Of course you will learn a lot more talking to these scary dos guys. Hi FELLAS! Quote would a simple way to do this be : use the "sleep" command from the [RK] uli I would swear I just posted this, but I don't see it. A bat file which can be named SLEEP.BAT and put in your path Code: [Select]echo off if x%1==x ( echo Usage: SLEEP n [where n is the number of seconds] goto Adios ) if not %1==NewCall %0 NewCall %1 >nul ping -n %2 localhost :Adios SLEEP 10 will sleep 10 seconds. Based on GuruGary's ping -n 10 localhost >nul which doesn't work on windowsNT for unknown reason Mac Cheers for the tips guys. I will give them a GO and see how it goes. We have been running a ping utility but it is a trial and my manager wanted a bacth file. Thanks again guys cheers |
|
| 1564. |
Solve : Batch file does not exit? |
|
Answer» Hi. I'm trying to make a bat for Win 2000 that will run a few printer related commands and then OPEN an executable. The printer commands help with a glitch related to the exe. The printer commands work fine. I want the final action to start the exe and then have the CMD prompt window close. Is there some way to have the window close even if the exe is still running? It does make it all the way to the exe line, but stays open until the exe is closed. Here is what I have so far: |
|
| 1565. |
Solve : Passing a blank line to a file? |
|
Answer» Hello all. |
|
| 1566. |
Solve : complete beginner? |
|
Answer» hi, im a complete begginer with BATCH files, but what I have to is create a batch file that will all I know about batch files is that you create them with notepad. You probably mean "I know nothing about DOS". You see, normally you would start a DOS (CMD window) by Start/Run/CMD There, you would issue DOS commands. For example, the AT command might help you run something on another computer. To learn how a command works, enter the OPERAND "/?", for example AT /? Now MOVE will move a file, COPY will copy one. So you just figure out how to solve your problem one DOS command at a time. When you know what you want to do, you put the commands into a single file with SUFFIX "bat" and voila. The only thing you might need to learn about BAT is that %1 means the first operand, etc. like this The file is Z.BAT: copy %1 d:\here\file1.dat copy %2 d:\here\file2.dat That is a nonsense two-line BAT file that will do this, if you enter Z abc.txt def.txt copy abc.txt d:\here\file1.dat copy def.txt d:\here\file2.dat So now you know about BAT files. Work on it and let us know if you have some specific question. Mac |
|
| 1567. |
Solve : Deleting files older than 15 minutes? |
|
Answer» I need to create a batch file that will delete temp files in a directory. I want to delete files that are older than 15 minutes or more. I can use ?? > to cover the file names but can't narrow down the date/time. This seems like a pretty simple thing but... |
|
| 1568. |
Solve : Problems mapping network drives after wireless net? |
|
Answer» Hello. I have a BATCH file witch maps two (linux ubuntu) network drives and then |
|
| 1569. |
Solve : Batch file to fetch user defined file? |
|
Answer» I'm looking to make a batch file that would ask the user to enter a 2 digit number to specify what file they need. The files are located in a shared folder with each file located in a folder named XXXXXX## with the ##'s representing the 2 digits I would want the user to enter. I can cover the rest as far as fetching the files and where to put them etc. Here's a simple way that works on all versions of DOSActually, the parenthesis grouping in an IF statement is not SUPPORTED in DOS 6.x and older or Windows 9x. Dam1an: What version of DOS are your users running? If it is Windows 2000 / XP / 2003 / VISTA you can try something like this: Code: [Select]echo off set /p number=Please enter the 2-digit code for your file: echo The directory specified is xxxxxx%number% You may want to add more error checking, but I THINK that is the basics of what you want.How do you see version number? All I see is Microsoft(R) Windows NT(TM) (C) Copyright 1985-1996 Microsoft Corp. Mac Thank you GuruGary, that WORKED great. QBasicMac: You can use the VER command to tell the DOS version. If it is really DOS, it will return a string like MS-DOS Version 6.22. If it is a command processor running under Windows it will return a string like Microsoft Windows 2000 [Version 5.00.2195]. You can also look up the version of your command processor extensions (under supported operating systems) with the command: Code: [Select]echo %cmdextversion% Dam1an: Glad it worked |
|
| 1570. |
Solve : A "autorun batch file"? |
|
Answer» HELLO everybody! It feels like i've looked everywhere but i cant find any solution to my PROBLEM... I want to make a batch file that, when you start it it starts a program and if this program is already RUNNING i want nothing to happen.. can anybody plz make my life a bit easyer by solving this problem of mine ? Best Regards LeXWhat version of Windows are you running? You can try the TASKLIST command. Something like: CODE: [Select]tasklist /fi "imagename eq MYRPOG.exe"or Code: [Select]echo off tasklist /fi "imagename eq MYPROG.exe"|findstr PID if not errorlevel 1 goto :Nothing echo Make something happen goto :EOF :NothingWindoes XP Pro cant get it to work :-? what to put in "imagename"? Quote ...I want to make a batch file that, when you start it it starts a program and if [highlight]this program[/highlight] is already running i want nothing to happen...What is "this program"? For this to work, you need to replace the MYPROG.exe in my code with the real file name of "this program". |
|
| 1571. |
Solve : net use? |
|
Answer» I'm setting up a scheduled task to retrieve some files from a remote server over VPN using MS DOS. A drive has already been mapped on my machine but, SINCE connecting VIA VPN is part of the process, the drive is disconnected and requires a LOGIN to connect it. Could someone just give me an example of how to connect to a drive using NET USE with a user name and password? Thanks.Code: [SELECT]net use x: \\server\share /user:username password |
|
| 1572. |
Solve : ms dos 3.31 HELP!? |
|
Answer» I have a paperweight pc in my basement and wanted to boot it up and see what I could do on it, maybe play some old floppy games on it, whatever else. |
|
| 1573. |
Solve : unable to start format? |
|
Answer» hey i am new here and i have a minor problem if someone would at least try to help i would appreciate it. anyway my problem is i have alot of viruses and other minor PROBLEMS so i would like to format my c: but when i type in format c: like i usually do it says bad command or file name. i am using a boot disk (floppy) to do so and running windows xp home on a compaq presario. once again anyone who replies thank you for your timeSo you have booted from a floppy. It therefore doesn't matter if you usually are "running windows xp home on a compaq presario" or not. Now you are running DOS and there is no WindowsXP running - right?? O,that's too bad !I heard that on XP system ,there is no really DOS system in it !Can you find anther way to format you c:\ ,or you can try again to format u c: on DOS!May be it can be effect! Get a Job ! !.... Quote O,that's too bad !I heard that on XP system ,there is no really DOS system in it !Can you find anther way to format you c:\ ,or you can try again to format u c: on DOS!May be it can be effect! Wangming, I am THIS close to just deleting all of your POSTS. If you get an urge to type something and then click on the POST button - don't.hey thanks for the help everyone and sorry i took so long to post again. yea i didnt have the right boot disk and thats why it wasnt formatting but i got a copy of the one i needed and it worked. so i am virus free, for now. is there any free anti virus progs that you can just download? if so does anyone reccomend anything. Well thanks again ns :|Avast AVG Choose one or the other. AdAware Spybot Search and Destroy Ewido CCleaner Grab all of these. Make SURE after installing each one to grab the online updates and scan your entire system the first time in Safe Mode with each one with System Restore turned offk thanks |
|
| 1574. |
Solve : DOS 6.22 installation on new HDD? |
|
Answer» I have a new formatted HDD. To search on the net!May be u can find one ver of DOS!W Who knows what this means? Quote QuoteTo search on the net!May be u can find one ver of DOS!W Probably as much as his other posts so far...Nil. |
|
| 1575. |
Solve : file.txt to file.hex? |
|
Answer» i not know if it's easy to do but .. try to ask: 02E37CFE2445E08C04EF2049445FE3E6 at the end of every line i have 0d0a (i think "return" hex code) i need to translate this line into hex code for make hex file 16byte, delete 0d0a, attach next 16 byte and go on 02 e3 7c fe 24 .... usable like hex dataexplain more clearly what you are trying to do. you said you have "0d0a" at end of every line, but i don't see it in your sample file. also, GIVE a sample of your desired output.You need to write a program to do that. Here is one in QBasic. If you have QBasic in your DOS system, then SAVE this program as z.bas and your data as z.dat and do QBasic /run z That will produce z.com, your hex file of 80 characters. Mac Code: [Select]OPEN "z.dat" FOR INPUT AS #1 OPEN "z.com" FOR OUTPUT AS #2 DO WHILE NOT EOF(1) LINE INPUT #1, l$ PRINT l$; "<---" IF LEN(l$) <> 32 THEN PRINT "Wrong length record": SYSTEM FOR i = 1 TO 32 STEP 2 v1 = INSTR("0123456789ABCDEF", MID$(l$, i, 1)) v2 = INSTR("0123456789ABCDEF", MID$(l$, i + 1, 1)) IF v1 * v2 = 0 THEN PRINT "Non-hex in file": SYSTEM v3 = ((v1 - 1) * 16) + (v2 - 1) PRINT #2, CHR$(v3); NEXT i LOOP CLOSE SYSTEM i have one txt with more hex data (or i make one by copy/paste part from one other big txt) if i see with hex editor the txt file i see at the end of every line one CR like 0d0a (2 byte) now i need to make from this txt file one hex file .... one functional way are to delete manually all "CR": Quote 02E37CFE2445E08C04EF2049445FE3E603F5ED7538AA386C9C38087546FAC0F4 like first two line and paste it into hex editor ... but are about 189 line frankly, i don't understand. Since you are using hex editor to see the file, does the editor have any way to save it as hex??with hex editor i see hex data (the hex data i need into hex file) like ASCII code into right windows Quote frankly, i don't understand. Two options: He has a text file, not a hex file. The text file has 32 characters in the range 0-F on a line. Each line is terminated by a line-feed plus carriage return as is true for all text files. So if first two lines are this in the text editor: 02E37CFE2445E08C04EF2049445FE3E6 03F5ED7538AA386C9C38087546FAC0F4 then in the hex editor, he sees this (starting with E3E6 at the end of line one: E 3 E 6 CRLF0 3 4533453613103033 And if so, my QBasic program will work. Otherwise, he ALREADY has a file where the characters are 0-255, but each 16 characters is delimited by the crlf. He just wants to eliminate the crlf. This can be DONE by LINE INPUT #1, L$ PRINT #2, L$; The semi-colon will eliminate the crlf. Mac i'm really newbie :-? i have just maked Qbasic program and it work (i not have test all hex code), so i need to put into little tool directory Qbasic executable i'm searching for one more little (in disk space) solution really thanks QbasicMac Quote You need to write a program to do that. one other question ... for me it's usefull to have into beginning list (TXT FILE) some text word to esplain some information but, of course, when i trasform file.txt to file.hex thie word not have trasformed can you adjust this program for not consider, for example, line begin with # char ? Quote 02E37CFE2445E08C04EF2049445FE3E6 thanks againscriptors, I think this is what you want... If text1.txt contains: [edit]02E37CFE2445E08C04EF2049445FE3E6 03F5ED7538AA386C9C38087546FAC0F4 # # text for information about and not to translate # 045F94AE3C85B806F73CEFF523D069E8 0499247205BE3F73DF99299D9525A7AF 08F8D5130625DEABDED4A7988DF1259D [/edit] Then you want to convert it into one continuous: [edit]02 E3 7C FE 24 45 E0 8C 04 EF 20 49 44 5F E3 E6 03 F5 ED 75 38 AA 38 6C 9C 38 08 75 46 FA C0 F4 04 5F 94 AE 3C 85 B8 06 F7 3C EF F5 23 D0 69 E8 04 99 24 72 05 BE 3F 73 DF 99 29 9D 95 25 A7 AF 08 F8 D5 13 06 25 DE AB DE D4 A7 98 8D F1 25 9D[/edit] The following batch script will do the job: [edit]echo off ( for /f "eol=#" %%a in (file1.txt) do ( set hx=%%a for /l %%n in (0,2,31) do ( call echo.%%hx:~%%n,2%% ) ) )>%~dpn0.htm[/edit] Copy the code into a new batch file named myhex.bat. Have text1.txt in the same directory. Executing myhex.bat will create a new file named myhex.htm that you can open in a web browser and then copy your hex code from there into the hex editor. DOS IT HELP? |
|
| 1576. |
Solve : DOS comand dir? |
|
Answer» When I write a COMAND DIR inside existing folder, I receive a list of folders, and always at the beginning there are two of them: |
|
| 1577. |
Solve : Getting a variable in FOR loop? |
|
Answer» Hi, |
|
| 1578. |
Solve : Batch Files That Create Dir's w/ Today's Date? |
|
Answer» Hi All, I need to pass to mkdir: i.e., mkdir mmddyyyyhourmin? Well, I recommend yyyymmdd so your names SORT like this 200612311104 200701010015 etc. It is normally a mistake to put year last, but you can easily patch my code below if your management is stupid and insists. If the BAT file is just for your own use, fine. Otherwise, be aware that %date% and %time% are not defined in WindowsNT DOS (and maybe others) I had a solution that required 'date /t', but learned that other systems don't have that command. So I don't know a solution that is portable. This one will work on your system. The SET DATE and TIME are just to give me test data as %date% normally returns nothing for me. Mac Code: [Select]echo off set date=10/26/2006 set time=11:04:30:22 cls echo Debugging for date=%date% and time=%time% echo. for /F "tokens=1 delims=/" %%i in ('echo %date%') do (set dmm=%%i) for /F "tokens=2 delims=/" %%i in ('echo %date%') do (set ddd=%%i) for /F "tokens=3 delims=/" %%i in ('echo %date%') do (set dyy=%%i) for /F "tokens=1 delims=:" %%i in ('echo %time%') do (set thh=%%i) for /F "tokens=2 delims=:" %%i in ('echo %time%') do (set tmm=%%i) echo The directory name will be %dyy%%dmm%%ddd%%thh%%tmm% QBasicMac: Windows 2000 / XP / 2003 / Vista have built-in DATE and TIME environment variables. I'm not sure about Windows NT. I would strongly recommend against replacing these system variables with set time= or set date=. The format of %date% and %time% depends on your regional settings. If yours is set for U.S. English this should work. For mmddyyyyhourmin (as requested) you can make a directory with: Code: [Select]set hour=%time:~0,2% if %hour% LSS 10 set hour=0%hour:~-1% md %date:~-10,2%%date:~-7,2%%date:~-4%%hour%%time:~3,2% Like QbasicMac, I personally prefer to use the year first. So for the format of yyyymmddhourmin you would replace the MD line with: Code: [Select]md %date:~-4%%date:~-10,2%%date:~-7,2%%hour%%time:~3,2% The reason I do the HOUR seperately is because by default a single digit hour (1-9) is padded with a space. Quote I would strongly recommend against replacing these system variables with set time= or set date=. Oh, definitely!! I thought I made it clear that I did that only for debugging my NT script where they are not reserved WORDS. I guess I failed. Right! Do not put SET DATE in your script, OP, especially if you WANT the current date rather than a constant. Mac For a more "portable" solution. You can use Perl/Python or other scripting languages. Eg in Python Code: [Select]import time,os date = time.strftime("%Y%d%m%H%M%S" ,time.localtime()) ## date = 20062710110431 os.mkdir(date) #make directory with format 20062710110431 Of course, this assumes you know other languages besides batch |
|
| 1579. |
Solve : General Forum Question? |
|
Answer» In the index, I see "Replies" and "Views" I post alot here and my replies go generally ignored...that might be a part of it. Step into the light, Patio, step into the light... Quote I post alot here and my replies go generally ignored...that might be a part of it. |
|
| 1580. |
Solve : Problem with writing batch file? |
|
Answer» Hi all, Thanks a lot for that reply.Yes Quote Thanks a lot for that reply.Yes Quote Thanks a lot for that reply.Yes The FOR /F loop will save resulting output to a variable as in my previous example. To concatenate 2 variables (let's say named numfiles1 and numfiles2) into a new variable (numfilesconcat) you can do: Code: [Select]set numfilesconcat=%numfiles1%%numfiles2%If you want to add them together instead you would do: Code: [Select]set /a numfilestotal=%numfiles1% + %numfiles2% To remove the LAST character off a variable named "string" you can do: Code: [Select]set new=%string:~,-1%Thanks a lot. It worked. |
|
| 1581. |
Solve : Repair Connection? |
|
Answer» Hello, |
|
| 1582. |
Solve : format a floppydisk without questions? |
|
Answer» I want to format a FLOPPY in a batch file without the usual input i have to give. I have done something like that for a hard drive which WORKS fine: Code: [Select]echo.>fmt.tmp Learn something every day! I always wanted to write blank lines with echo, but always got "echo is on/off". You meant, of course, to use >> instead of > for the rest of the prompt file. But you have to put "jn" together to avoid a line feed. Code: [Select]echo.>fmt.tmp echo jn>>fmt.tmp Mac Quote I dont know if it has anything to do with it but i am using a dos window in w98. i believe dos 7.xx. it could be the reason why it worked on your pc and not mine. I am embarrassed that the answer is that I goofed. I didn't test with FORMAT, but tested with some commannd which has no such prompt for an enter-key. So I gave poor advice. See GuruGary for the right idea (with my small correction). So to attone for my sin, I just used the Bat file below to test on a floppy. First floppy I have formatted for at least 10 years: Don't use them much and if I ever buy any, they come pre-formatted. It took about 2 minutes, seemed like 20. LOL. Mac Code: [Select]echo off echo.>z.dat echo yn>>z.dat format a: >z.lst <z.dat You can use "nul" rather than "z.lst" if you don't want to keep output. Use any names you want for the files. Good catch, Mac. Yes, as corrected by QBasicMac, the code should be set to append the file. |
|
| 1583. |
Solve : what is *.*? |
|
Answer» i'm trying to create a boot disk and this site told me to COPY format*.* a: then press enter and my pc said FILE not found. does the *.* mean something else?* is a joker sign copy format*.* a: copy format*.* means to copy all files that begin with "format" that are in your current DIRECTORY, for example format.exe format1.exe formatx.com format~2.zip "file not found." means that in your current directory, there are no such files. In general, it means you are not in the CORRECT directory or the instructions you are following do not apply to your environment. Mac |
|
| 1584. |
Solve : ramdrive? |
|
Answer» i want to create an image drive on floppy msdos-startup disk using sorry,i still don't understand bout extended and expanded memory.. There is no need to reinvent the wheel. That information and much more is readily available through Google, etc. Here you go: http://www.google.com/search?hl=en&q=extended+and+expanded+memory |
|
| 1585. |
Solve : setting paths from search result? |
|
Answer» Hi all, TIA TIA? Is there an outstanding question? LOL. I thought I was finished here. Maybe I misunderstood your previous post........... Quote Uh, yep, the tokens stuff should work if you can't avoid the date. Were you suggesting that tokens will work in 9X?Sorry, my friends tell me 98 does not support date /t so I don't know how you get the date there. Bummer Mac Think we got crossed somewhere on what I'm trying to achieve. I have a text file of filenames with path, and the file size. File size precedes the path/name. I need to search every file in that text for a string and output the results to another text. No date involved, and it's my understanding that 9X does not support tokens option, therefore the use of ' for /f %%i in (my.text) do find "string" %%i >> my2.txt' will try to search the string from the filesize rather than the path/filename. Will putting the filesize after the path in my.txt allow it to search the files? example of current my.txt 19225 C:\windows\filen.ame 19225 C:\progra~1\Norton\filen.ame if changed to, C:\windows\filen.ame 19225 C:\progra~1\Norton\filen.ame 19225 will %%i search the files for string as if the size isn't even present? Quote T I'm pretty sure. The variable, %%i, will be set to the first string up to a space, the default delimiter. At least I know the following works on NT4: Code: [Select]echo C:\windows\filen.ame 19225 > z.txt echo C:\progra~1\Norton\filen.ame 19225 >>z.txt for /F %%i in ('type z.txt') do ( echo Got a filename echo It's name is %%i echo So I am happy ) Mac Thanks. I'll give it a try on 9X. |
|
| 1586. |
Solve : Batch file programming? |
|
Answer» I am putting some error checks into to some batch files that I inherited and need some help with the following: Could anyone tell me why this is not working? WELL, you probably guessed this from GuruGary's correct response, but anyway here is an explicit answer to your question. command ---> if not exist \\server\share\folder\%1.txt tells BAT that if the file does not exist, do NOTHING which is what will also happen if the file does exist. After that command finishes doing nothing, it goes on to the next instruction. command ---> echo cute message So instead, you want to tell it to do SOMETHING. command ---> if not exist \\server\share\folder\%1.txt ( tells BAT that if the files exists, do commands until ")" and if the file does not exist, skip everything until the next ")". Mac [Well, the parentheses can be nested, so interpret my word "next" in that context] |
|
| 1587. |
Solve : Install without floppy drive? |
|
Answer» Can anyone help with this---
If you have the floppy disks, and you have a USB floppy, and your computer supports booting to USB, then why not use that? I was having a brain fart. For some reason, I wasn't even thinking about checking the BIOS for the USB boot option... :-/Simply copying the files to the machine will not WORK...you have to run setup.exe in order to install DOS. patio. 8-) |
|
| 1588. |
Solve : Link over serial port? |
|
Answer» Hi, I need to help a friend with a very old machine still using floppies (12 inches original floppies). I think it would be possible to connect two computers via serial PORT and appropriate cable (a LapLink cable) using an old DOS command that I am unable to remember or find. Thanks to this command two DOS machines can see each other files and then copy them. I hope, in this way to be able to tranfer those old files to a more modern support. Thank you very much for your help, Massimo ([email PROTECTED])I think the command you are looking for is INTERLNK, which works in conjunction with INTERSVR. They came STANDARD with DOS 6.x.I found some more information here: http://www.microsoft.com/technet/archive/msdos/comm5.mspx ... you have to scroll down the page a ways.Thank you. I think the command you are looking for is INTERLNK, which works in conjunction with INTERSVR. They came standard with DOS 6.x.i just crashed into this topic. LOOKS like ancient times. when i just started with computerwork (XT 086) there was a program called nortun utility. i used to work with it a lot and it had an option to link computers with serial. works easy and what you need. where to get is another problem. other option might be something like xx.txt >com1 (this works) xx.txt good luck |
|
| 1589. |
Solve : Password Param for Batch File?? |
|
Answer» Hi all, |
|
| 1590. |
Solve : how do i make a Batch file run Always-On-Top?? |
|
Answer» I wolud like to run my batch file always on top. Is it possible. |
|
| 1591. |
Solve : PLease Help me Exit MS DOS!? |
|
Answer» I accidentally RESTARTED my computer on MS DOS mode and I can't get out! How do I RETURN to normal Windows?Reboot & tap the F8 key until you get the menu up, then SELECT whatever you want.It should go back to Windows if you type |
|
| 1592. |
Solve : Keyboard input through batch file? |
|
Answer» What would be the command to have f5 and enter entered through a batch file to a program that was just opened with a batch file?There is not one. However, if this is a TRUE DOS batch file, you might use a utility that will STUFF the KEYBOARD BUFFER. Do a google SEARCH for "keyboard buffer stuffer" and see what pops. |
|
| 1593. |
Solve : What is your preferred way of checking for parms? |
|
Answer» Just wondering if people have a favourite WAY of testing for parameters? |
|
| 1594. |
Solve : Why is my FOR loop not working?? |
|
Answer» Hello everyone, just found this forum today and have already searched over 10 pages of history as well as used the search but no luck in the last step. |
|
| 1595. |
Solve : boot with msdos startup disk? |
|
Answer» i just made msdos startup disk.. how to run it ? |
|
| 1596. |
Solve : Batch File Creation help needed? |
|
Answer» Hi, for /F "delims= " %%i IN (c:\Scripting\Servers.txt) DO (c:\Scripting\rcmd.exe net user administrator testpassw0rd >> c:\Password.txt) Kind of lost me, buddy. What do you expect "delims" to do? Your file apparently has no delimiters. Well, anyway, I guess it doesn't hurt anything. But you have no %%i inside the DO. So all you will do is repeat the DO as many times as there are lines in your data. Try this to see what I mean: for /F %%i IN (c:\Scripting\Servers.txt) DO (ECHO MyStuff: %%i) if you omit the %%i, you just get MyStuff repeated. How about just explain what you would do if there was no BAT file and you were going to sit and enter stuff 40 times. Would you enter this command list: c:\Scripting\rcmd.exe net user administrator \\lvpwpnas01 >> c:\Password.txt c:\Scripting\rcmd.exe net user administrator \\lvpwpnas02 >>c:\Password.txt ... (etc.)? Forget about BAT files and come up with a list of 40 COMMANDS that do what you want. (Of course, start with messing with only 2 servers). When you have them, simply put them in a BAT file and run them. Do it the straightforward way with no tricky FOR-stuff. Then later develop tricky stuff if you just want to play around. MacI think QBasicMac is right ... you forgot to use your %%i. Try this: Code: [Select]for /F "delims= " %%i IN (c:\Scripting\Servers.txt) DO c:\Scripting\rcmd.exe %%i net user administrator testpassw0rd >> c:\Password.txt Pause |
|
| 1597. |
Solve : .batch simulating user typing and pressing enter? |
|
Answer» Hi! I am with a program in Fortran that when executed ask the input FILE name, output file name and a parameter. But I have to do this for many files that have always the same names. So for this I am trying to make a “.bat” file to help me. So I need to know which command can simulate the user typing and pressing enter. |
|
| 1598. |
Solve : Batch File - automated password input? |
|
Answer» Hi, Hi,you zipping program should have command options you can use to input password. check with manual of your zip program |
|
| 1599. |
Solve : Comparing two character dates? |
|
Answer» Ok last problem (I think). |
|
| 1600. |
Solve : Problems using the TIME function? |
|
Answer» When I use the following set statement before noon, I get a blank in the time (HOURS) portion of the statement. As for the Python solution, thanks but I do not want to install anything on my client machines unless absolutely required. I want to keep the install as NATIVE as possible. I am also reproducing this on a UNIX machine (I have a working version, just have to make it now work similar to this now for support reasons). FYI, you do not need to reproduce if you use scripts made in Python/Perl. Those scripts can be ported to unix with little or no modification at all. Well anyway, its your CHOICE. |
|