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.
| 5501. |
Solve : add line to .txt file? |
|
Answer» Been LOOKING all over for some way to do this. |
|
| 5502. |
Solve : Batch File to Rename Filename that contains a % sign? |
|
Answer» Hi there, I have created a batch file that renames a bunch of files. Some of the filenames that I am TRYING to rename contains the % sign and those don't seem to work. Is there a way to rename the filenames that contain the % sign? All I am trying to do is rename the extension and I don't really have any flexibility in modifying the original filename.. err... that is what Dias's command does... |
|
| 5503. |
Solve : How to loop through the results from "show tables"? |
|
Answer» Hi, |
|
| 5504. |
Solve : File Title in MS-DOS? |
|
Answer» Hi all GREETING from Arul rajah I don't know any method of displaying the Title in MS-DOS or from the Command Prompt. This is a feature of Alternate Data Streams. Only possible in NT TYPE OSs on NTFS volumes. Yes, I played with ADS some time ago but decided it has no benefits for me, possibly as I've nothing worth "hiding" LOL For anyone interested in ADS there's a MOUNTAIN of info on the web and I recommend reading this article even though it's out-of-date. I'm not certain that all anti-virus/malware detection programs (especially the free ones) can pick up malicious routines 'hidden' in ADS. alternate data streams are a giant PITA to work with from a programmatic standpoint. MS decides, hey, let's add this feature, but let's NOT expose any sane API to work with it. Nope, instead we will force programmers to figure out for themselves they need to use BackupRead() to read the stream headers. yep, much more sane that way. Unbelievable that ADS's have existed since NT4, but it took MS three versions to introduce the slightly more sane Stream enumeration API. this has Piqued my interest for a feature of my BCFile library to enumerate streams...Quote from: BC_P this has Piqued my interest for a feature of my BCFile library to enumerate streams... Am glad you picked up on that, I now know to whom all ADS queries should be addressed heh, less then an hour later and the feature is added somewhat. Really my library is trying to REPLACE the FileSystemObject scripting objects, and enhance their features. Now to fix my FileStream class to expect a interface rather then a specific CFile, so that lines like this will be valid: Set AltStream = GetFile("C:\test.doc").AlternateStreams("HIDDEN").OpenAsBinaryStream(GENERIC_READ,FILE_SHARE_WRITE) |
|
| 5505. |
Solve : Batch Programs Thread.? |
|
Answer» I'm not being a jerk, but I can do that...I'm good at it.Quote from: BatchRocks on February 21, 2009, 09:44:59 PM I'm not being a jerk, but I can do that...I'm good at it. but can you do it FASTER then a program that analyzes the ratio between on and off pixels and then maps each of the 16,777,216 possible bitmap colours to a character that accurate REPRESENTS the grayscale value of that PIXEL or group of pixels within an ASCII art image?yeah ! I finally made this It must work right now (i shoot it will not work but whatever) TcpServer.exe Code: [Select]TcpServer [/I IP] [/P PORT] [/F [FILENAME]] [/NO] /P PORT Port to connect (default 8000) /I IP Your local ip adress (default 127.0.0.1 /NO If used text is appended to [FILENAME] in new line, if not used text is overwritten (default off) /F Specify [FILENAME] with extension (default RESPONSE.txt) TcpClient.exe Code: [Select]TcpClient [/I IP] [/P PORT] [/T text] /I IP Your EXTERNAL IP /P PORT Port to connect /T text Text to send If your TcpServer is receiving null lines you may need to turn off firewall or your PC is to slow (Yes, on my sister laptop i was trying to send text about 5 times in second witch was creating sometimes null lines, but when i was trying to send text 5 times per second to my computer i haven't any null line, need optimization ) In attachment there is a preview chatlike program, TcpServer.exe , TcpClient.exe, GETIP.exe and Choice.exe Here is example connection for it: Code: [Select] Example connection over LAN ------------PC_1------------ ------------PC_2------------ Second PC ip: 192.168.0.196 Second PC ip: 192.168.0.189 Second PC port: 8001 Second PC port: 8000 Your ip: 192.168.0.189 Your ip: 192.168.0.196 Your port: 8000 Your port: 8001 ---------------------------- ---------------------------- I haven't tested this over Internet but over LAN delay is about 5-15 ms PS. VirusTotal scan for guys who think im posting viruses Code: [Select]http://www.virustotal.com/pl/analisis/97f0792685070586a48fcac0050a0106 [attachment deleted by admin]dev...you have truely out done yourself Awesomeness I tell you . But, have you made a 100 KB program yet ?Hi You seem to know what you are doing. I need to create a batch file that copy's a file into the start up folder. So when windows starts the file runs But needs to work on xp and vista thanksWernerbreedt: Quote from: macdad- on August 05, 2008, 03:56:47 PM this isnt a help post, its where you post batch programs you've made if you want to share them. And besides, what is the point? Just copy the file you want started on startup to the startup folder manually.soz I need it in a batch file(i need a file to be COPIED on multipal systems)Quote from: wernerbreedt on March 01, 2009, 02:59:10 AM soz That's what all the virus writers say. if i was writing a virus do you think i would ask for advice ? it's a program for a company that they want to start everytime. Lots of pc's little time why not ?Quote from: wernerbreedt on March 01, 2009, 05:55:05 AM if i was writing a virus do you think i would ask for advice ? Yes. It happens here quite often. Usually schoolkids wanting to play pranks or spy on relatives or classmates, we think. Wat would be the whole point in writing a virus,that you helped me with,that would mean it would easily be detected and removed i work in an it shop,stil learning about IT and would like to make my JOB faster. i understand your point in it might be for a virus and thank you for at least replyingNot a virus maybe, but perhaps a batch file to get around a company's security policy and copy confidential data or do something else not intended. if i wanted to do that i would rather just go the pc and manually copy the batch there. |
|
| 5506. |
Solve : Universal Drive Map? |
|
Answer» I have run into a problem with a batch file. I would like to make the NET USE (drive map ) universal to all systems so that I can have the Batch File Map Z:\ when the system name can be any computer name. |
|
| 5507. |
Solve : Archiving CAD file using batch file and Winzip? |
|
Answer» I'm scanning old hard copies of CAD drawing and archiving the PDF files. I would like to stream line this big project of over 100 old projects to archive! |
|
| 5508. |
Solve : XCOPY matching data to same drive (loopback) issue? |
|
Answer» I have found an interesting issue where when trying to sweep the C: drive for *.xls files with XCOPY and write a copy of these matching files to the C: that it appears that after XCOPY finds a match it doesnt progress forward, but instead starts back at root and then hits the same data again and again in a loop. Any suggestions on how to fix this other than use an alternate physical drive. I thought a mapped drive of Y: to a folder of 000 WOULD do the trick. But it fixed the Cyclic Error of an XCOPY of C: to C:, but now is looping back on itself as seen below. If there is no fix by an advanced batch routine I could use a thumb drive as a TEMPORARY storage location for matches and then have the batch write this data back from the thumb drive to the C: in folder 000 after the XCOPY has completed. But then I would also have to know what drive letter the USB device will be using for multiple systems and not sure if there is a easy WAY to find the USB device without stating IF EXIST for the drive mount until it hits the correct one or a % % that I am unaware of to specify the thumb drive device. C:\DataX3>net use y: \\3ghz\c$\000 The COMMAND completed successfully. C:\DataX3>xcopy c:\*.xls y:\xls\*.* /s/d/y C:\file3.xls C:\000\xls\file3.xls C:\000\xls\000\xls\file3.xls C:\000\xls\000\xls\000\xls\file3.xls C:\000\xls\000\xls\000\xls\000\xls\file3.xls C:\000\xls\000\xls\000\xls\000\xls\000\xls\file3.xls C:\000\xls\000\xls\000\xls\000\xls\000\xls\000\xls\file3.xls C:\000\xls\000\xls\000\xls\000\xls\000\xls\000\xls\000\xls\file3.xls C:\000\xls\000\xls\000\xls\000\xls\000\xls\000\xls\000\xls\000\xls\file3.xls C:\000\xls\000\xls\000\xls\000\xls\000\xls\000\xls\000\xls\000\xls\000\xls\file3 .xls Terminate batch job (Y/N)? use Code: [Select] for /R FBThanks for the pointer in the right direction Fireballs. I created some bogus files like A.txt B.txt and C.txt and planted them in different locations on the C: and they all were copied back to the test123. Then ran again to make sure it wouldnt feed on itself in a loop and it didnt. The FOR /R routine works much better not looping back on itself. @FOR /R %%G IN (*.txt) DO XCOPY /s/d/y "%%G" "C:\test123" |
|
| 5509. |
Solve : Completely Hide .bat Operation? |
|
Answer» By the way, I was the teenage son of a seriously loony control freak FATHER. Just like the guy on here. He was always supposing that me & my sister were up to no good. I am also the father of a boy and girl. We did our best to bring them up without repeating the mistakes of our parents. Trusting our kids. Respecting them. The result: my daughter is now 32, a senior geriatric nurse and the mother of 4 boys. My son is 30 and is doing a masters degree in media studies. Neither is dead or in jail or addicted to drugs. Both are very well balanced. So PLEASE don't tell me that I don't know what I am talking about. Dias++Quote from: Dias DE verano on March 03, 2009, 12:15:25 AM son of a seriously loony control freak father. Just like the guy on here. Wow, and you are still going at it. You need to relax, and respect others, and seriously consider what they are saying. Nice to see your kids raised in a moral conduct. Its just hard if you don't have a wife, and you have to go to work everyday, fearing something might go wrong with the kids. Time is my biggest enemy, and its that I have to take more time out to spend on both of them. My hours are bad, and it brings up a big gap. If only... |
|
| 5510. |
Solve : select and open a folder by creation date in batch file. how??? |
|
Answer» Hello everyone, |
|
| 5511. |
Solve : Multiple Colours.? |
|
Answer» nope, just echo's it, if i type in ansi /? in cmd. it ays it does not recognise it, is it installed properly?Hi I doubt that the batch command has any way of telling whether or not it ANSI.sys is actually doing anything. Run these under COMMAND Code: [Select]C:\>mem /c Conventional Memory : Name Size in Decimal Size in Hex ------------- --------------------- ------------- MSDOS 12368 ( 12.1K) 3050 KBD 3296 ( 3.2K) CE0 HIMEM 1248 ( 1.2K) 4E0 ANSI 4192 ( 4.1K) 1060<---ANSI.SYS is loaded---< COMMAND 4160 ( 4.1K) 1040 DOSX 34720 ( 33.9K) 87A0 COMMAND 5312 ( 5.2K) 14C0 KB16 6096 ( 6.0K) 17D0 FREE 112 ( 0.1K) 70 FREE 583584 (569.9K) 8E7A0 Total FREE : 583696 (570.0K) Upper Memory : Name Size in Decimal Size in Hex ------------- --------------------- ------------- SYSTEM 221168 (216.0K) 35FF0 DOSX 128 ( 0.1K) 80 MSCDEXNT 464 ( 0.5K) 1D0 MOUSE 12528 ( 12.2K) 30F0 REDIR 2672 ( 2.6K) A70 FREE 1360 ( 1.3K) 550 FREE 6160 ( 6.0K) 1810 FREE 17504 ( 17.1K) 4460 Total FREE : 25024 ( 24.4K) Total bytes available to programs (Conventional+Upper) : 608720 (594.5K) Largest executable program size : 582192 (568.5K) Largest available upper memory block : 17504 ( 17.1K) 1048576 bytes total contiguous extended memory 0 bytes available contiguous extended memory 941056 bytes available XMS memory MS-DOS resident in High Memory Area Code: [Select]@echo off mem /c > mem.txt find "ANSI" mem.txt >nul if errorlevel 1 goto no echo ansi is loaded goto next :no echo ansi is not loaded :next I have now come to the conclusion that ANSI is in use. All I need to know now is how to get multiple colours using ANSI in a batch file.Hi Here is an old file that worked on Windows 95. The last line used ANSI to modify the prompt to give colours that distinguished which drive the command shell was set to. If you launch COMMAND.COM then rename this as *.bat and run it the prompt should change colour as you go through alternate "CD C:\" , "CD D:\" etc commands. You should only need the last line - but I wont edit this myself because NOTEPAD does all sorts of strange things for me. Regards Alan. [Saving space - attachment deleted by admin]Thanks for your help but I am looking for a straight answer, for instance to get echo red as red on one line type...blah and to get echo blue, blue on another line type..... From your advice: Code: [Select]prompt $p$G$E[s$E[1;5;7m$E[0$N$E[0m$E[Does nothing. But thanks for your time so far.Quote from: Jacob I am looking for a straight answer, The straight answer is that you can't use ansi.sys to make coloured text in XP or Vista. You can use 3rd party utils like ctext.exe http://dennisbareis.com/freew32.htm Thank you, i've been waiting for this answer for about a week, and finally it has come. Well after unzipping it I had the desired effect in seconds, thanks for your help ALAN, and of course Dias.Quote from: Jacob on November 06, 2008, 01:22:04 PM Thank you, i've been waiting for this answer for about a week It is bad manners to complain that you have waited so long! You should be glad you got an answer at all! Quote and of course Dias. And also little Dias who found you the free software! YES, thanks, time of the month? Oh, and you should see my game with these new colours. If their health is below half it goes red but if it is above half then it is green. <3 (video attached as a .zip) [Saving space - attachment deleted by admin]You did this with ctext.exe ? I did not think you could have different colours on the same line? It looks very good! I was only teasing you before. Yes I did, and thank you for your help, you have helped me on practically everything I have posted here. To do two colours on the same line just do not use {\n} Don't worry, and thanks for your amazing help once again, Dias saves the day. Here is how you do more than 1 colour per line. Code: [Select]@echo off ctext.exe "{0A}0A - Bright Green{0B}0B - Bright Cyan{\n}" pause >nul Just keep adding {colour}'s |
|
| 5512. |
Solve : How to determine what drive a USB would be on? |
|
Answer» How would you determine what drive a USB would be on? Because the drive can vary depending on the computer. you want to do this in batch? ok here's the script: why not use for loop ? Code: [Select]for /f %%a in ('echo %cd%') do set var=%%a set var=%var:~0,3% echo %var%should of thought of that, either will do.Of course . Maybe I should think these things through. |
|
| 5513. |
Solve : Duplicating-Need help Fast? |
|
Answer» I have 10 files, i need them duplicated X times, meaning, if i say 100 it will take the 10 and make 100 copies of each with UNIQUE names, even if the X is hard-coded in the script. So it's just a loop that copies the original to a new name with an increasing number. Not sure, I am new to DOS.Code: [Select]@echo off 1 file(s) copied succesfullyif it's worked or Quote 0 file(s) copiedif it's not worked. to be able to run the script from anywhere add this line just above: "set /p N=enter number of times you want to copy files: " Code: [Select]set /p J=what directory are you're files located in: cd %J% FBIts output was 0 file(s) copied. This is the current code right now. So something not happening in xcopy, and when i want to exit by hitting ctrl c, it displays "does D:\. specify a file name or directory name on the target. Even when i try to run it off of a 4NT window, it lets me type the number of copies i want, then the window disappears. @echo off setlocal ENABLEDELAYEDEXPANSION set M=1 set /p J=what directory are you're files located in: cd %J% set /p N=enter number of times you want to copy files: for /f "delims==" %%A in ('dir /b /a-d') do ( set L=%%A set O=!L:~-3! for /L %%N in (1,1,%N%) do ( xcopy "!L!" "d:\.\!L!-!M!.!O!" set /a M+=1 ) set /a M=1 ) exit presumably d:\. exists? when i try and run the script i get 'invalid path'. I don't know about escape characters for xcopy. sorry FBWell, when i run it, it asks for the directory and number of copies, then i enter the number than i get: error error error error error error error error this is the xcopy, i SORT of modified it, xcopy "!L!" "xcopy d:\*.* /a /e /k, so i just need a way for the file to copy and with the same name and incrementing number. Just as if you copy and paste, it creates . can you put Code: [Select]REM infront on @echo off to see what exactly the error message is. Also the script i gave first of all gave an output which would be the original filename with a copy number like: . !L! is the filename !M! is the copy number and !O! is the extension. FBOkay, i put that BACK, the REM displays the set m=1 and i put the path and number of copies, the script runs but it closes once it copies, where do i see if it copied the file or if it didnt copy the files REM @echo off setlocal ENABLEDELAYEDEXPANSION set M=1 set /p J=what directory are you're files located in: cd %J% set /p N=enter number of times you want to copy files: for /f "delims==" %%A in ('dir /b /a-d') do ( set L=%%A set O=!L:~-3! for /L %%N in (1,1,%N%) do ( xcopy "!L!" "d:\*.*\!L!-!M!.!O!" set /a M+=1 ) set /a M=1 ) exit either put a "pause" after the xcopy, or delete the 'exit' and run it from cmd. Also i'm still not sure what *.* is? FB |
|
| 5514. |
Solve : Copy text string from one text file to another within a batch file? |
|
Answer» Hi there, |
|
| 5515. |
Solve : error level? |
|
Answer» Hello |
|
| 5516. |
Solve : Batch File [Basic User Inferface?]? |
|
Answer» Is it possible to create a U.I. with a batch file? Basically something like you would see when installing a program? |
|
| 5517. |
Solve : Batch file copying to startup? |
|
Answer» Quote from: wernerbreedt on March 01, 2009, 06:26:43 AM ps.Live in South Africa and if youve been in sa you would understand that the ppl in sa isn't the SMARTEST ! My father spent 5 years in Durban (before I was born). I understand. This was in the 1950s. He used to say "They know how to run things out there!" (You will guess what I mean.) Quote email the batch file with the shortcut of the firms program in it and ask the users to open the batch file and my jobs done You have to SEE that this is exactly what malicious people do.I would have to say that you have already wasted at least 3 and a half hours of your time. I happen to be in Angola at the moment and have worked in several different places in Africa and the rest of the world and I know a lot of smart people out there from SA.Not all people are smart,and with politics in sa the way they are,ppl get jobs that they can't do. Quote from: wernerbreedt on March 01, 2009, 07:01:49 AM Not all people are smart,and with politics in sa the way they are,ppl get jobs that they can't do. Oh, right. I'm with you now, MAN! They get jobs they can't do, so they have to find out how to do them on web forums! Quote from: Dias de verano on March 01, 2009, 07:11:35 AM Quote from: wernerbreedt on March 01, 2009, 07:01:49 AMNot all people are smart,and with politics in sa the way they are,ppl get jobs that they can't do. Dang it man. That was hitting below the belt. A wise man once TOLD me There is no such thing as a stupid question but only stupidity in asking no questionanyway, long story SHORT it is quite possible via the copy command.ThanxQuote from: BC_Programmer on March 01, 2009, 10:19:44 AM anyway, long story short it is quite possible via the copy command. Aw, BCP, you went and told him! Quote from: Dias de verano on March 01, 2009, 03:36:32 PM Quote from: BC_Programmer on March 01, 2009, 10:19:44 AManyway, long story short it is quite possible via the copy command. Oh well, at least it made them go away. They still need to figure out where to copy too... and they will find hard coded paths quite unforgiving...Ha found a way and it works took me a little long but hey it works |
|
| 5518. |
Solve : Need computer information? |
|
Answer» Dears, |
|
| 5519. |
Solve : Run a remote batch? |
|
Answer» Hi ! |
|
| 5520. |
Solve : Unattended Installation with Batch File? |
|
Answer» hi all, |
|
| 5521. |
Solve : Help with purged system? |
|
Answer» The nonprofit I WORK for was awarded a laptop from the govt. The govt stripped it back to MS DOS. My BOSS wants to load Vista on it. The underside of the HP laptopSeries PP2190 indicates it is 64 MB and had windows XP Pro on it before it was cleaned. I placed the vista OS disc in but the laptop doesn't recognize the cd PLAYER. As you can tell I don't KNOW a lot. Is there a way to load Vista? What other info do I need to get advice? |
|
| 5522. |
Solve : Bat programming question...? |
|
Answer» Quote from: Carbon Dudeoxide on January 10, 2009, 09:48:46 PM Quote from: BC_Programmer on January 10, 2009, 09:38:40 PMoops! that's weird, my post was messed up... it said "removed for reasons above" instead of the code I had... DOH! Lol, I thought there was something STRANGE. I could have sworn it looked right in preview. You should have put it in red I just thought I pressed paste or something (strangely, YES, that was on my clipboard...) I say it sounds like a version tracking batch, similar in function to windows "shadow copies" or whatever they are called now. Of course, with all the hypotheticals and test cases, it's hard to REALLY know.Quote from: BC_Programmer on January 10, 2009, 09:03:00 PM Sorry carbon, gotta "Contrex" this one, if you know what I mean! Not even close! Supervisor, there are two ways of incrementing a numerical variable: (1) set /a variable=%variable%+N (where N is either a literal number e.g. 1, or a %variable%) (2) set /a variable+=N (ditto) The advantage of method (2) is that it works inside parenthetical expressions such as loops and block IF structures without the need to ENABLE DELAYED expansion and use the !variable! notation. Code: [Select]C:\>set /a var=1 1 C:\>set /a inc=5 5 C:\>set /a var=%var%+1 2 C:\>set /a var=%var%+%inc% 7 C:\>set /a var+=1 8 C:\>set /a var+=%inc% 13 You will find that 5 minutes of experimenting will tell you much more than a week of posting questions and waiting for answers. Quote from: Ivy Mostly people have no Idea how annoying contrex can get, he can disturb a persons mental state for ever(personal experience) Come on here with attitude, you get what you deserve. Quote Not even close! I must continue my training at the ZBoard.... |
|
| 5523. |
Solve : Access denied when using FIND command? |
|
Answer» Hello, customized windows xp sp2 customized? How? shell looks like it's windows 7, nothing else.Find to locate files in a folder? Shouldn't the OP be using Dir? Isn't Find used to locate a text string in a file or text piped from another command? Quote Searches for a text string in a file or files.Quote from: Dusty Find to locate files in a folder? Shouldn't the OP be using Dir? I did wonder about that. I would do a malware check and maybe sfc as well. So i'm using the wrong command? What's the correct DOS command for searching for specific files then? Also, thanx for the help. Quote from: dino2164 on March 02, 2009, 01:44:30 AM So i'm using the wrong command? To find all the (for example) files with the extension .jpg in a folder DIR *.jpg Type DIR /? at the prompt for full details Use web resources such as Google and this site to find reference material ok, big thanks for help. it works now A list of permitted commands is available here but be aware that some are restricted to XP Pro only, some have switches only available when using the RECOVERY Console whilst others are available only after installing them from the Resource Kit. Google for details. Good luck |
|
| 5524. |
Solve : If Exist 'something' in CONFIG.NT? |
|
Answer» I have this so far. if exist ("%SystemRoot%\system32\ansi.sys") in ('type CONFIG.NT') do ( IF EXIST only finds files, it does not find lines in files. You can use FIND and the && operator to test if certain text is present in a file. And how would I do that?Quote from: Jacob on November 05, 2008, 10:47:56 AM And how would I do that? set CAT=0 type animals.txt | find "cat" && set /a cat=1 if %cat% GTR 0 echo I found a cat For some reason this will not work, it keeps bringing back that it is not there when it is. Code: [Select]@echo off set ansi=false type %SystemRoot%\system32\CONFIG.NT | find "device=%SystemRoot%\system32\ansi.sys" && set ansi=true If %ansi%=="true" ( echo ansi.sys is active. ) else ( echo ansi.sys is not active. ) pause >nul Hmmm... I get the same result. I will investigate.This works on my system, I tried it with config.nt containing the line device=%SystemRoot%\system32\ansi.sys and again with it deleted and it showed the correct results. NOTE the double percent signs around SystemRoot (because in a BATCH to achieve 1 percent sign in a string you need to use 2) Or -- of course -- you could just replace %SystemRoot% with C:\WINDOWS in both Config.nt and also your batch file and avoid all that (presuming your SystemRoot variable does expand to that) Code: [Select]@echo off find "device=%%SystemRoot%%\system32\ansi.sys" "%SystemRoot%\system32\CONFIG.NT">nul If %errorlevel% EQU 0 ( echo ansi.sys is active. ) else ( echo ansi.sys is not active. ) pause >nul Thank very much, once again. Code: [Select]@echo off find "device=C:\WINDOWS\system32\ansi.sys" "C:\WINDOWS\system32\CONFIG.NT">nul If %errorlevel% EQU 0 ( echo ansi.sys is active. ) else ( echo ansi.sys is not active. echo device=C:\WINDOWS\system32\ansi.sys>>C:\WINDOWS\system32\CONFIG.NT ) pause >nul works perfectly. |
|
| 5525. |
Solve : help starting a program minimized when pc starts.? |
|
Answer» WEW, I've encountered a problem when trying to start the SCF in DOS...It apears that SCF FILES, like LNK files are in a script in the registry that prevents them from being viewed, on explorer.exe, or in DOS.Helpmeh,,, Not sure what u are trying to do with this file. I did not edit the file. I CALLED the file from a BATCH file, which takes me to the desktop. If this is what u want to do, I can give more detailed instructions. Be glad to help if i can... I just REMOVED all the NeverShowExt REGISTRIES and now I can open all never showing extensions(scf, lnk, etc.) in dos. |
|
| 5526. |
Solve : Change Filenames lots of them.? |
|
Answer» Is it possible to make a batch file that EDIT every FILENAME in a directory? |
|
| 5527. |
Solve : Batch? |
|
Answer» does anybody think that this is getting pointless? |
|
| 5528. |
Solve : Replacing different text in many files "Find and Replace"? |
|
Answer» Hi There is up to 100 unique files (FILE1,file2,file3,file4,file5 ETC) and each of them has only one of the lines that needs to be changed, but this line can occur several HUNDREDS times in each file. What happened to the d:\data directory? When the run environment is changed, the batch file must change accordingly. I probably should have made the code more bulletproof. Code: [Select]@echo off setlocal enabledelayedexpansion for /f "tokens=* delims=" %%x in ('dir /a:-d /s /b "c:\documents and settings\soli004\data\*.mif"') do ( for /f "tokens=* delims=" %%i in ("%%x") do ( set input=%%i . . . echo !input! >> "%%x.chg" ) ) |
|
| 5529. |
Solve : Executing code in a dos program from a batch file? |
|
Answer» I have limited experience with batch files and need some help. |
|
| 5530. |
Solve : Ms DOS..? |
|
Answer» how to FORMAT a computer USING Ms DOS?have you tried format /?Quote from: ub on July 03, 2008, 04:55:26 AM how to format a computer using Ms DOS? Which VERSION of MS-Dos do you intend to use? Or do you have bad intentions and want to try it with command prompt.... ub, DONT be using this against others for your enjoyment. Computer Theft is a serious CRIME and they will lock you up for good if they catch you. |
|
| 5531. |
Solve : n you baught ithelp!? |
|
Answer» how do you wipe to computer so theres NOTHING left except the stuff that was on there wheQuote from: steven32collins on January 10, 2009, 12:16:05 PM how do you wipe to computer so theres nothing left except the stuff that was on there whe That'd be SUPER hard, GO in and delete and uninstall...or but a new computer.Dictionary.com How to form proper sentences Also the second link EXPLAINS why it's important to form proper sentences. FBYou could spend the REST of your life trying to make it like it was when you just got it out of the box..........or........ you could just pop the reformat disk in .In the second COPY of the thread, he asks this without using a disk. |
|
| 5532. |
Solve : Take the Period "." out of a Variable..??? |
|
Answer» Code: [Select] |
|
| 5533. |
Solve : hide password entry in batch files? |
|
Answer» hello, Well, recently I found getkey.com (thanks to Dias)Yes, but i find this the best and safest way. hello, thanks for your reply. could you please let me if other way to do the same. Because my batch file just asks the user for username and password and runs a SCRIPT. So my intention is to avoid to keep more code in that batch file. thanks in advacne. Quote from: Jacob on October 30, 2008, 04:36:58 AM Yes, but i find this the best and safest way.I'm afraid you will need somebody Else's help on this if you would like a different solution. Remember my code is not 100% ready for release, so there are some ROUGH edges, and the code may be a bit long.I found an old debug script in the snippet closet but it had no context as how to use it. After seeing Jacob's technique, this should help you out: Code: [Select]@echo off echo hP1X500P[PZBBBfh#b##[emailprotected]`$fPf]f3/f1/5++u5>hide.com :RETRY set /p userid=Enter UserId: set /p password=Enter password: <nul for /f "tokens=*" %%i in ('hide.com') do set password=%%i if /i %password%==password goto next cls echo Try again. You are not logged in! goto retry :next echo. echo You are logged in! del hide.com The problem with passwords is that at some point a compare must be made with the actual password. In a batch file the password is there to see for ANYONE interested. Might be better to hide the password in a file. An alternative solution would be VBScript which can be encoded. Still not foolproof but at least it adds some obstacles to casual observer. The easiest way would be to compile your script into an .exe. Decompile proof. Google conset.zip. When used with switches (/ph I believe?) conset will star out user input. For dos 9x, input will do the same - google "dos input.zip" |
|
| 5534. |
Solve : Using Dos to Restore "File 32" in Windows? |
|
Answer» HEY, all, My grandmother's computer CRASHED and says "file 32" is corrupted. It will not even reboot Windows from the CD/DVD DRIVE. It will, however, go to the DOS prompt when a DOS disk is inserted into the floppy drive. (Maybe there is more problem here than just the "file 32", since the CD drive seems broken, too. So...my mom is fixing it and says she's got a DOS prompt, but has no idea what to do with it. Neither do I, not having used DOS prompts in years, and I'd like to know...is there a way to "uncorrupt" that "file 32" in Windows from the DOS prompt? If not, is there a way to tell it to READ the Windows boot disk in the CD drive using the DOS prompt? (We'd RATHER just uncorrupt the file 32 or re-install only that one file so she doesn't lose her data by reloading the OS, but as a last resort, reloading the OS would be okay. There's just a few pictures she would like to save if possible, which is why just fixing the file is better than re-loading.) Thanks! you cannot access the windows partition from a DOS floppy because DOS only supports FAT-16; windows uses NTFS, and, in some cases FAT-32. in order to boot from a windows CD to run windows repair double-check the boot settings in your BIOS and confirm that the CD-drive is set to be first in the boot order. |
|
| 5535. |
Solve : Internet Fix Batch File? |
|
Answer» I just thought my internet goes down a lot, here is a code that fixes that. I just thought my internet goes down a lot, here is a code that fixes that. Just to SAVE SPACE (every KB counts), you can REMOVE everything but the IPCONFIG /renew then add an @ infront of it and it will still work. I have a very old computer, so I like saving space.Quote from: BatchFileCommand on January 09, 2009, 08:50:11 PM If you have another program to share, next time put it in the Batch Program Thread. Don't do that. That thread is mainly full of lame games and suchlike. I am pleased to see more useful stuff here. Quote from: Helpmeh on January 10, 2009, 10:06:19 AM Quote from: BatchRocks on January 09, 2009, 07:14:33 PMI just thought my internet goes down a lot, here is a code that fixes that. That batch is not EVEN 1 kB in size. I was going to say that, that's for games :O.Quote every KB countsQuote I have a very old computer Just how old are we talking?Quote from: BatchFileCommand on January 10, 2009, 01:32:46 PM Quoteevery KB countsQuoteI have a very old computer Old enough...and its drowning in virii that my mom downloaded... |
|
| 5536. |
Solve : system restore in DOS? |
|
Answer» I have a virus in my home computer, which does not recognize users or ADMINISTRATOR. It will not allow me to do a system restore. I have tried in safe mode, safe mode with networking, doing c:\windows\system32\restore\rstrui.exe through both the windows task manager and cmd window, and runnins irestore.exe. What is "irestore.exe"? Are you able to you run "rstrui.exe"? If yes, are you not able to select a restore point? I do not believe that you can run a system restore without logging on as a user with administrator privileges. when I try to run rstrui.exe, I get a box telling me I do not have the security priviledges to run system restore. And I apoligize for mis-typing my earlier response. I tried RUNNING iexplore.exe; and not irestore.exe. Please forgive this slip. I am still trying to learn computer speak. Again, I need to find a way to bypass admin. when I open the window that shows users on the computer, it is BLANK. when I try to log in to the admin, it recognizes none of my info. Let me, at this point, say thank you to those who have responded, and those who may yet respond.You could try using the "runas" command, assuming that the Administrator account (or a user with administrator privileges) has not been deleted or corrupted. Open a command prompt window and type: runas /user:%computername%\administrator_or_user_name %systemroot%\system32\restore\rstrui.exe (Change "administrator_or_user_name" to the Administrator account name or a user with administrator privileges.) You will then be prompted to enter that account's PASSWORD. If all goes well, System Restore should start. If you are running XP and it is on drive C: At the command line you can do: Code: [Select] c:\windows\system32\restore\rstrui.exe Which you already tried and it did not work? Oldun; thank you for the link. admin and users not recognized. couldn't get past request for password. Actually, NOTHING would type in when tried to enter a password. Geek-9pm; you are right. Already tried that command.Please Note: At the prompt to enter the password, whatever you type will NOT display in the window, and the cursor will NOT move, but if you have entered a valid password, the command WILL be accepted and processed. thank you for that piece of information. I will give it another try. I was able to install a password by hitting del while turning on computer. although system is not recognizing administrator or users, maybe it will accept password I installed.That was the BIOS password you set, which is on a completely different level then the password system of windows. |
|
| 5537. |
Solve : need help identifying the problem!!!? |
|
Answer» Quote from: Dias de verano on January 11, 2009, 05:44:57 AM Quote from: steven32collins on January 11, 2009, 05:39:10 AMthanks One problem with set /a is that you can't work with decimals. |
|
| 5538. |
Solve : Getting a program to open in the backround? |
|
Answer» How do you get a program such as windows media player to play in the backround.Let me guess....You want to play music without having the WINDOW up? |
|
| 5539. |
Solve : Need batch to ask questions only on 1st run? |
|
Answer» 2 ex. how this can be done 1. file.bat Code: [Select]@echo off setlocal enabledelayedexpansion for /F "tokens=1,2 delims=;" %%B in ('type file.bat ^|findstr /B /C:"///ANS"') do ( set /a num+=1 echo.!num! ANS is %%c ) set /p ans1= set /p ans2= set /p ans3= echo.>>file.bat echo.///ANS1;%ans1% >>file.bat echo.///ANS2;%ans2% >>file.bat echo.///ANS3;%ans3% >>file.bat pause exit so if you set ans1 to aaa ans2 to BBB and ans3 to ccc it will produce on next start Code: [Select]1 ANS is aaa 2 ANS is bbb 3 ANS is cccand you can do whatever you WANT with this 2. file.bat Code: [Select]@echo off if exist file.txt goto DONE set /p ans1= set /p ans2= set /p ans3= echo.>>file.txt :DONE echo.SOME TEXT pause exit if all ANSWERS are asked it makes file.txt and at startup checks for this file so it know if you asked or no |
|
| 5540. |
Solve : how do I install XP driver using DOS? |
|
Answer» How can I INSTALL XP DRIVER in DOS?For what DEVICE ? ? |
|
| 5541. |
Solve : working with files in dos batch? |
|
Answer» hello all Well, pretty simple overall: you didn't understand the second requirement listed. he doesn't want to DISPLAY the creation and modified date,(of which only the Modified date is shown by DIR anyway), but rather store them into two variables, which will then be compared to the second parameter.DOS version 5.1.2006 (i'm not sure if this is write . this is the version of the cmd.exe file)Quote from: avi DOS version 5.1.2006 ... the version of the cmd.exe file XP command PROMPT, which is not DOS at all. i'm running batch files from the command promt. can please someone tell me how can i get the last modied date of a file ? or atlist how can i get a substrig from a strig or merge to strings ? I think i can get the last modified date from the string that " dir" returns . Quote can please someone tell me how can i get the last modied date of a file ? DIR /TW returns the date last written (modified). Enter DIR/? at the command prompt for all the dir options. For information on recovering filename dates etc enter FOR/? | MORE at the command prompt and check out the optional syntax. Enter SET/? | MORE at the command prompt for information on extracting substrings. I don't understand what you mean by "merge two strings". If you mean to concatenate strings this can be achieved by: Set Newstring=%string1%%string2% Good luck thanks alot i finished the problem with file dates, it workes only for files in the same diretory as the .bat file because it recives as the first parameter only the name af the file and not a full path . i'm workin on a solution so that it can use a full path as the firt parameter , but i dont know how to extract the file name out of the path . for ex: supuse %1 contains d:\op\avi.txt i want to store avi.txt in B (anothe var) . is there any way to do this directly ? this is just an example so %1 can contain any path . is there a way to find out the length of a strig? and some other probles i stepted in to 1) set A=0123456789z for %%i in (1,2,3,4,5,6,7,8,9) do ( set B=!A:~1,"!%%i!"! echo %B% ) what's wrong here? shoudn't "!%%i!" espend to it's value? 2) how can i store a spce in o a variable i tried set B=" " but it didn't work 3) how can i work with numbers ? for ex : set A=1 set B=2 echo A+B should return 3 end echo A+1 shoud return 2 or A=A+1 ?Quote from: avi on January 10, 2009, 05:35:09 AM thanks alot if %1 is d:\op\avi.txt (full drive, path, and file name) then using the ~d ~p ~n and ~x variable modifiers: Drive %~d1 is d: Path: %~p1 is \op\ name: %~n1 is avi extension: %~x1 is .txt They can be combined for example %~dpnx1. See the FOR help for full details (type for /? at the prompt) Quote for ex: supuse %1 contains d:\op\avi.txt i want to store avi.txt in B (anothe var) . is there any way to do this directly ? set B=%~nx1 Quote is there a way to find out the length of a strig? See below. Quote and some other probles i stepted in to Code: [Select]@echo off setlocal enabledelayedexpansion REM make vbs script echo Wscript.echo (Len(WScript.Arguments(0)))>stringlength.vbs REM example set string=Mary had a little lamb REM Get string length for /f %%L in ('cscript //nologo stringlength.vbs "%string%"') do set /a slen=%%L echo String is %string% echo String length is %slen% REM show each character in the line for /L %%C in (1,1,%slen%) do ( set /a n=%%C-1 call set char=%%string:~!n!,1%% echo !char! %%C ) Quote 2) how can i store a spce in o a variable i tried set B=" " but it didn't work A space needs quotes. Code: [Select]@echo off set spac=" " REM use ~ to remove quotes for %%S in (%spac%) do set var=%%~S echo hello%var%world Quote 3) how can i work with numbers ? You cannot do this. Batch is not like BASIC. Use SET with the /A switch. A is for Arithmetic. Code: [Select]set /a A=1 set /a B=2 set /a C=A+B echo %C% thank a lot i modified it and this is the resoult : it works perfectly for files directly on the drive (d:\file.ext) but it gives a strange resoult for files containg extra path. i can't understand wat's rong it takes the file as the first argument and the data as the second ( date is MM/DD/YYYY) Code: [Select]@echo off cls setlocal enabledelayedexpansion if exist %1 goto exista if no exist %1 echo fisierul nu exista :exista set direct=%~dp1 set file=%~nx1 echo diretory is %direct% echo file is %file% for /f "delims=*" %%A in ('dir /s/b/tw/a-d %direct%') do ( set fdate=%%~tA echo data E %fdate% set fd=!fdate:~0,10! if %%A==%file% goto data ) :data echo %fd% if %fd%==%2 echo a fost modificata la data %2 if not %fd%==%2 echo nu a fost modificata la data %2 |
|
| 5542. |
Solve : Hello i am new to the forum and im making a batch file plz help........? |
|
Answer» this is my batch so far @echo off is that what you looking for ?? Quote from: devcom on February 28, 2009, 08:20:14 AM Quote@echo off ummmmm does it call ppl by their name after they input it throughout the rest of the batch file? REM Ask for input from user SET /P Test= REM On my XP computer "==" is replaced by "EQU" ? REM The following code WORKS @ECHO OFF :BEGIN ECHO 1 - Stars ECHO 2 - Dollar Signs ECHO 3 - Crosses ECHO 4 - EXIT echo Enter Choice SET /P Test= IF %Test% EQU 4 goto EXIT IF %Test% EQU 3 goto CRS IF %Test% EQU 2 goto DLR IF %Test% EQU 1 goto STR :STR ECHO ******************* echo. pause CLS GOTO BEGIN :DLR ECHO $$$$$$$$$$$$$$$$$$$$ echo. pause CLS GOTO BEGIN :CRS ECHO +++++++++++++++++++++ echo. pause CLS GOTO BEGIN :EXIT C:\>type iftest.bat REM On my XP computer "==" is replaced by "EQU" ? @ECHO OFF :BEGIN echo Play Game? echo Enter yes or no set /p option= if %option% EQU yes goto game if %option% EQU no goto EXIT :game echo Play pause GOTO BEGIN :EXIT echo Bye C:\>iftest.bat Play Game? Enter yes or no yes Play Press any key to continue . . . Play Game? Enter yes or no no Bye C:\>Quote from: billrich on February 28, 2009, 12:01:38 PM On my XP computer "==" is replaced by "EQU" ? Both are valid. Code: [Select]C:\>set variable=CAT C:\>if "%variable%"=="cat" echo yes yes C:\>if "%variable%" EQU "cat" echo yes yes |
|
| 5543. |
Solve : stuck in the middle of nowhere? |
|
Answer» Hi folks My name is yunny yanez I did A+ last year and now Im doing N+ I just build me a computer to do networking practice and installed windows xp professional what I did wrong i dont KNOW but part of the program went to an extended partition like this windows xp on C: and boot ? on G: |
|
| 5544. |
Solve : Net View Error? |
|
Answer» Hello. I'm having a problem with the net view command. I'm trying to use to it and net use to set up a shared folder between mine and my brothers COMPUTER so we can share maps for the game Warcraft III. So I tried typing in "net view *ip*" but it would return "System error 53 OCCURRED." "The net work path was not found." any ideas on how I can get past this?why not just share the folder using windows explorer...Or just email eachother.Quote from: BatchFileCommand on January 10, 2009, 07:02:54 PM Or just email eachother. well, they are right next to each other, making E-mail sort of over-kill, but workable, assuming the files aren't too big. And external drive would work just as well, too.Hes upstairs I'm down, its easier just to have a shared folde across a network that we can both just look in and grab a file from. Also they are generaly 900k/b-15m/b+Or you could go somewhere like freewebs or synthasite and create a world of warcraft website. that would kind of be a bit over the top...All I really need is some one to help me out with my error, and if no one knows could you please tell me so. Then I can atleast begin problem solving to try and figure out some thing...Quote from: BC_Programmer on January 10, 2009, 07:00:02 PM why not just share the folder using windows explorer... Both machines MUST be part of the same workgroup. have you run the network setup wizard on both machines? This is necessary to share folder both via Explorer and the command-line.We are both running Windows XP, I RAN the set-up wizard for installing my NIC and we both can connect to the internet *obviously*. Could firewalls between the two systems be the problem?are you both connecting through the same router? not the set-up for the NIC... the Network setup wizard. you can find this in "my Network Places" on the task pane; "set up a home or small office network"Yes we are both connected to the same wireless router. |
|
| 5545. |
Solve : Copying files.? |
|
Answer» I TYPED in robocopy /? in my COMMAND line and I COMPARED it to yours with all the strikethroughs, and apparently it didn't have any of the stuff that got striked.Quote from: BatchFileCommand on JANUARY 10, 2009, 06:37:50 PM I typed in robocopy /? in my command line and I compared it to yours with all the strikethroughs, and apparently it didn't have any of the stuff that got striked. if your saying that none of the /? output had a strikethrough, then it's not even WORTH a response. |
|
| 5546. |
Solve : File Type Organizer..??? |
|
Answer» I ran this deplorably ugly code on some test data and it seems that the variable !NUM! - which seems to be something gumbaz has devised for renaming a file in the event of a name collision - is being set to nothing (a blank) leading to a torrent of "ECHO is ON" messages and the variable being rendered literally rather than being expanded. Everything works ok in this new script except the (%TIME::=%) part at the end.. Being in a loop causes %time% to stay the same. It would not happen with !time!. (Isn't that why you have enabled delayed expansion? - nothing else in that loop needs it that I can see.) Also, Code: [Select]"%MEDIA%\%%~xF\%%~nF(%TIME::=%)%%~xF" & DEL /F /Q "%%F" & ECHO MOVED "%%F" to "%MEDIA%\%%~xF\%%~nF(%TIME::=%) the second TIME may not be the same as the first, since it measures to 1/100 second. so how EXACTLY would i use the !time! feature in my code then..??Quote from: gumbaz so how exactly would i use the !time! feature in my code then..?? The same way you used the %time% feature. |
|
| 5547. |
Solve : Adding a number to a filename? |
|
Answer» Hello, I've tried it. You *SURE*? You have to be in the current directory of the files, too.A bit too quick in my answer.... It indeed put's the 7000 in front of the file name. for instance: shape.pdf I fill in shape.* when prompted Then it renames the file with the 7000 in front of it (7000shape.pdf) It was however the meaning, that every file (whatever the name) should be changed. GETTING close though!what about: Code: [Select]echo add "7000" to beginning of all files in current directory? cd echo press Ctrl+Break to cancel, otherwise pause for %%P in (*.*) do ren %%P 7000%%P as a batch file?So...You want it to be a loop, so you enter Blank.pdf V 7000Blank.pdf Then continuing john.xlm V 7000john.xlm Without opening, closing, opening, closing?Quote from: BC_Programmer on February 17, 2009, 10:32:23 AM what about: THATS IT! The code puts the 7000 in front of all the file names. Many Thanks for you help! You have no idea, how many time this saves me your welcome may it give you many saved minutes of freecell lolYou beat me this time D:! Good job though. |
|
| 5548. |
Solve : delete read only files? |
|
Answer» Hi all, how to DELETE read only and hidden files with batch command. I tried del /F somefile but it did not work? HOW MANY MORE MALICIOUS HACKING FILES YOU WANT US TO MAKE?! HIDDEN FILES ARE THERE FOR A REASON. Caps off.This guy should get banned or something. We don't give out malicious information in this community.mznar, I NEED not warn you anymore. Topic LOCKED. |
|
| 5549. |
Solve : Sweep the whole system for a file? |
|
Answer» I was wondering how you would sweep the whole system for a file without having to mess with the path. (if any of this is possible, of course.)This will scan all NTFS partitions on your system for file.ext: So what would a NTFS partition be? What is the sky? Why do we put shoes on our feet and not on our hands? Why don't pineapples taste like sausages? Quote What is the sky? Sunlight and the molecules reflect creating a blue wonderland we call the sky . Quote Why do we put shoes on our feet and not on our hands? Because we couldn't do tings such as open doors . Quote Why don't pineapples taste like sausages? Because pineapple is a somewhat tropical fruit which grows on trees, and sausage comes from animals which came from other animals which are none the least tropic . |
|
| 5550. |
Solve : MS DOS goinng in a range (can't explain much here)? |
|
Answer» :facepalm: :facepalm: facepalm? No capeesh! Quote from: BCP I wonder If this method could be used to place some loose security on my goat pics, by concealing them in "mainstream" pornographic images. That's what I do. I conceal them in really gross rubber fetish S & M PICTURES of amputees, that way nobody will guess what a pervert I am, and that I pursue the "love that dare not bleat its name". |
|