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.
| 5401. |
Solve : If not running? |
|
Answer» HELLO, I would like to create a batch that checks a a file is RUNNING let say abc.exe and if it is goto :ab. Thank You AlmnQuote If not running Quote let say abc.exe and if it is Confusion reigns; I went with if NOT running. Change to errorlevel 0 if I GOT it wrong. CODE: [Select]for /f %a in ('tasklist ^| findstr /i "abc.exe"') do if errorlevel 1 goto ab 8-) Posted code is for XP Pro. |
|
| 5402. |
Solve : What version?? |
|
Answer» There are soooooo many VERSIONS of DOS that I dont even know. I would like to know which on is the newest or which one I should USE for a compuer that only uses DOS. (Or USEING VPC)The last officially distributed standalone DOS was 6.22 by Microsoft and 7.0 or 2000 by IBM. To see the version running on a machine type in VER and press enter.I just wanted to make sure I had the newest one. Oh thank god my hunt for this thing is finally over. Thank you very much. |
|
| 5403. |
Solve : .bat file wait time? |
|
Answer» HELLO everyone.. i want to create .bat file that executes shortcuts in time intervals of 20 seconds, and i have no idea how to set wait time. i've tried -t: 20 ; sleep 20 ;.. nothing works. example start 1.lnk <--- ??! start 2.lnk many thanks for your help stojko Depending on what OS you have, you can use the CHOICE command in some versions of DOS and Windows 9x. Other versions of Windows can use the SLEEP command which may have come with the OS or can be downloaded in the appropriate RESOURCE Kit. In a pinch you can ALSO use the PING command. Good luck. 8-) SIDEWINDER has good suggestions. PING should already be in whatever OS you are using, so that can be used without having to download anything else. To use PING, your code would look like: Code: [Select]start 1.lnk ping -n 21 LOCALHOST >NUL start 2.lnk You use 21 instead of 20 because the first reply should be almost immediate, and then about 1 second between each of the rest. |
|
| 5404. |
Solve : passing special characters from a txt file? |
|
Answer» Hi |
|
| 5405. |
Solve : Developing BAT file? |
|
Answer» Hello. I am trying to develop a BAT file to speed things up every morning when I log in to my client's network. This is what I have to do every day when I start up my laptop: |
|
| 5406. |
Solve : telnet batch file? |
|
Answer» Hi Thankx ghost 1) don't get you. A batch file's purpose is for automation. If you want to do it interactively, just open a command prompt and type telnet will do. And, by doing interactive, your eyes will do the error checking WHETHER its succesful...right? 2) it is BEYOND simple batch to catch keyboard characters, AFAIK. Maybe some assembly code and feeding these code into debug can do the trick..but it's out of scope for me.. |
|
| 5407. |
Solve : Can only run DOS commands from \system32\? |
|
Answer» Running Winxp SP2 with all the new updates. Went into DOS using cmd to run ipconfig. Received this message 'ipconfig |
|
| 5408. |
Solve : need a batch file to convert multiple sound? |
|
Answer» I need some help please. I am just learning to make batch files. I am using win xp sp2. I have a bunch of wav files on a cd that I need to convert to u-law. I am using sox to convert them but at this time, I can only convert one at a time. What I need it to do is convert all of them to seperate files. Not sure if you have a typo, but this may help:Please EXPLAIN where or what the error was. I am not familiar with your SOX program but I can find no error in the batch portion of the file. 8-)I open a text editor and copy cd c:\sox12181 for /f "tokens=1-2 delims=." %%i in ('dir /b *.wav') do ( sox.exe -V d:\%%i.wav -r 8000 -c 1 c:\ulfiles\%%i.ul ) and make it converter.bat when I run it, you see a command line blink real fast but there is not output into the directory If I run c:\sox12181> for /f "tokens=1-2 delims=." %%i in ('dir /b *.wav') do (sox.exe -V d:\%%i.wav -r 8000 -c 1 c:\ulfiles\%%i.ul) at the command line, I get "%%i was unexpected at this time" sox can be found here http://sox.sourceforge.net/ I really do thank you for your suggestions. Quote Please explain where or what the error was. I am not familiar with your SOX program but I can find no error in the batch portion of the file.Yeah, when running a FOR statement at the command line, you only need the single %. The PROBLEM is with the path or lack of it for the DIR command: Code: [Select]cd c:\sox12181 for /f "tokens=1-2 delims=." %%i in ('dir /b d:\*.wav') do ( sox.exe -V d:\%%i.wav -r 8000 -c 1 c:\ulfiles\%%i.ul ) 8-)Thank you very much!!! this worked cd c:\sox12181 for /f "tokens=1-2 delims=." %%i in ('dir /b d:\*.wav') do ( sox.exe -V d:\%%i.wav -r 8000 -c 1 c:\ulfiles\%%i.ul) |
|
| 5409. |
Solve : Append to DOS File Name? |
|
Answer» Is there a way to append portions of an existing DOS file name to a new DOS file name? For example, the original file name is RHD_GOK_0001_YP.pdf. I would like to CREATE a new DOS file name called 012345_00009_YP_000_00001.pdf, where the BOLDED YP and 00001 were from the original file name. |
|
| 5410. |
Solve : copy files from csv list? |
|
Answer» HOLA, All I need to do is copy files with one or another extension, from many many different sub- directories in a root directory, to an OUTPUT directory. The list will be of the sub-directories to look in (I don't want files from all of the sub-directories) Any help appreciated. XP sp2 TimI'm not exactly sure what you mean, but this should GET you started I'll assume your "files with one or another extension" are GIVEN in a batch file variable I'll assume your "output directory" is given in a batch file variable I'll assume your CSV file list is named dirs.csv Code: [Select]@echo off setlocal set fileExtensions=.doc .xls set outputDir=D:\output for /f "delims=," %%a in (dirs.csv) do call :CopyFiles %%a goto :EOF :CopyFiles for %%b in (%fileExtensions%) do xcopy "%*\*.%%b" "%outputDir%\" goto :EOF |
|
| 5411. |
Solve : Copy folder? |
|
Answer» How may i copy a folder from one path to another path? the xcopy is the tool to use. what exact syntax did you use.?"xcopy C:\abc c:\def" this is what i use...check the xcopy help again (type xcopy /? )... look for /S and /E switch options..Try Code: [Select]xcopy c:\abc c:\def\ /s |
|
| 5412. |
Solve : batch file needed to pass in user name? |
|
Answer» HEY guys, I need a batch FILE to pass in a username to a program after it starts it. So I have start mike.exe and I want it to pass in monty as the user name to this program. Any thoughts on how to do this? ThanksCan your program mike.exe take in any arguments?I don't actual know. Is there anyway to find out? The name of the program is KEA! Though when I start it up it asks for my usernamewhere did you get this program...maybe they have an instruction manual or something. another "BLIND" way to find out, you can TRY typing: kea -h or kea /? to see if it gives you any command line help. lets say the kea can take in arguments. What commands would you be using? How would you pass in the user name?if kea can take in commands, eg kea -u john -p password in your batch, just type in "kea -u john -p password" will doIf it takes arguments for the username and password, that would be the best way to do it, as suggested by ghostdog. If it does take arguments, they will be specific to each program. It could be what ghostdog suggested: kea -u john -p password or it could be like kea /user:john /pass:password or almost anything else. If you know it FIRST asks for a username, then a password, you could automate it like echo john >in.txt echo password >>in.txt kea <in.txtgreat guys thanks a lot |
|
| 5413. |
Solve : Need help with DOS? |
|
Answer» I am trying to create a batch file to compare 2 file names from different directories. |
|
| 5414. |
Solve : Silent Uninstall for installshield app? |
|
Answer» Hello I am trying to do a silent uninstall for my Cisco VPN CLIENT. I went through the steps that I found online and i made a ISS file and everything. Here is my command |
|
| 5415. |
Solve : batch or script to remove ALL user folders in XP? |
|
Answer» I have 200 students logging into around 30 PC's and every time one logs in XP creates a copy of the users folder in documents and settings, after a week or so the older machines are full up so I need a small batch file or script to SILENTLY remove ALL folders in the D&S folder EXCEPT admin and "all users" |
|
| 5416. |
Solve : Microsoft Paint. HELP NEEDED pleaseee? |
|
Answer» hi=) i was just wondering how do you type on microsoft paint? for example you drew pictures for a comic and want people in your pictures to be talking. how BOUT u type the THINGS u want them to say? thank you for you HELP! What version of Windows / MS Paint are you using? |
|
| 5417. |
Solve : shutdown.bat to shutdown pc after a set time? |
|
Answer» shutdown -l -s -f -m \\computername -t 5 -c "Pc shutting down in 5 seconds" -d up:125:1 |
|
| 5418. |
Solve : string parsing (with batch)? |
|
Answer» Hello, Hello, The for loop help explains that %~nI expand %I to file name. For more info, type for /?. Maybe its want you want.I think ghostdog is right. You probably want %%~na%%~xa (assuming your variable is %%a in a FOR loop) You will have to give more details or POST your code if you NEED more help.thats it. I should learn to work with qualifiers. Many thanks :-) uli |
|
| 5419. |
Solve : drive listing? |
|
Answer» With a DOS "DIR" command one can get a listing of files and directories of a specified drive. Which DOS command allows to get a listing of drives (drive letters)? With a DOS "DIR" command one can get a listing of files and directories of a specified drive. Which DOS command allows to get a listing of drives (drive letters)?if you are on XP, can use FSUTIL. Check out fsutil /? . eg fsutil fsinfo drives... I am on WIN 2000 Professional ...A simple one would be. for %%a in (a c d e f g h i j k L m n o p q r s t u v x y z) do ( if exist %%a echo %%a exist ) |
|
| 5420. |
Solve : connection? |
|
Answer» Hello, |
|
| 5421. |
Solve : pause: press any key to continue (timer on that)? |
|
Answer» Sidewinders CODE should work. It sounds like you are running it from a shortcut or an icon or the Start -> Run box. Since it sounds like you are NOT running it from the COMMAND prompt (which would MAKE it a lot easier for you to troubleshoot), try turning ECHO on, and add a pause at the end so you can see what it is doing. Like this: |
|
| 5422. |
Solve : Pulling DOS from system? |
|
Answer» Is there any way I can make DOS disks from my system INCASE I need to reformat my hard drive. I have system disks but not the DOS disk.What OS is your comptuer running? Is it running Windows, or just DOS only? Please post DOS VERSION, and Windows version, if any.Quote Is there any way I can make DOS disks from my system incase I need to reformat my hard drive. I have system disks but not the DOS disk.you can GO to http://www.bootdisk.com/. There are various kind of dos disk you can BUILD. |
|
| 5423. |
Solve : Varible Drives Unknown? |
|
Answer» Normally a pc should have a drive C: Normally a pc should have a drive C: For the network drive, you can do an IF test first. For example, if your network drive is Z:, you could do: Code: [Select]if not exist z:\ echo Network drive not found&goto :EOF echo Network drive found, running rest of batch fileI am good at confusing people today. This batch file will be put on different pc's, and I KNOW from WORKING on pc's that sometimes someone might set a local drive on a pc to E:\ instead of C:\. I have installed SCSI drives before and sometimes you cannot change the drive path of E:\ to C:\. Only 1 hard drive with an only 1 unkown directory (unknown being in your code) C:\ maybe D:\ maybe E:\ maybe etc. I am wanting to make 1 batch file to use on all of the pc's here and I would like not have to modify it because of a pc not having a drive C:\. When you have a lot of pc's to tend to sometimes you forget whos got what. What I am getting to is is there a WAY to specify an unknown local drive. If your code refers to drive C:\ and there ISNT one, only a drive E:\ I wonder if you could use an if statement to check for drive letters, or is there a better way? Hope this helpsUse the %systemdrive% variable. Try this in a batch file (or the command prompt): Code: [Select]@echo My computer is running Windows from the %systemdrive% drive.That will do the trick Your the Man!Thanks! |
|
| 5424. |
Solve : Cacls and a batch file...? |
|
Answer» For the original question, you only need the second line. Change: Thanx for the links. I'll be sure to work my way through them. There were a couple things I was wondering for now though. What does the '2>NUL' do and also, what's with the "delims="?2>Nul means redirecting standard error to nul. meaning to suppress errors. For more info, check out http://www.robvanderwoude.com/index.html. This site also a lot of great resources and examples on batch. delims= means delimiters. for more infor, check the for /?Cool, thanx again for all the help guys. I think I'm all set now. Hopefully I'll be able to help some people on here once I figure out what the *censored* I'm doing. |
|
| 5425. |
Solve : Help with batch file to delete documents needed!? |
|
Answer» This should be an easy thing for someone that actually knows a little something about BATCH files! I just want to delete some MS Word documents from a folder. The files are named according to date, i.e., 0616, 0617, 0618, so this is how I would like to identify the files to be DELETED (delete all files in a specific folder that begin with 0616). Of course, I would like to not have to respond "y" for every file deletion! |
|
| 5426. |
Solve : errorlevels in xp? |
|
Answer» hey all, |
|
| 5427. |
Solve : Set Size of Command Prompt Window - Batch File? |
|
Answer» Are there parameters (like color) that I can use to set the size of the command prompt window (Windows XP) that shows when a batch file is running? |
|
| 5428. |
Solve : Change modified by?? |
|
Answer» Hey I was wondering if there was a way, using a batch file to change who a file reports as last modifying it? Why do you want to do this?Well at school I have this chat program and it writes this log file to the drive with hidden and system attributes. YET the last person that added to it has their NAME added as modified by, which can be viewed by 'dir /s /q drive:' among other means. I need to make it so that it is anonymous. Also for when I put the chat file on there it would be better if they couldn't trace it to my login. I don't want to do anything too bad, I just want to know if its possible, and don't say its not just because you think im a rebel... ThanksI apologise in advance if I am second guessing the moderators here, but it is not (I believe) the policy of this board to encourage or facilitate misuse of a school's or employer's IT facilities, and what you are asking definitely falls into that category. "Vandal" would be a better term than "rebel" in my opinion. Almost anything is "possible", whether it is DESIRABLE is another matter. Quote from: contrex on June 07, 2007, 01:34:03 AM I apologise in advance if I am second guessing the moderators here, but it is not (I believe) the policy of this board to encourage or facilitate misuse of a school's or employer's IT facilities, and what you are asking definitely falls into that category. "Vandal" would be a better term than "rebel" in my opinion.Would you say you had sufficient knowledge to be able to accomplish the task or not?Quote from: DeltaSlaya on June 07, 2007, 01:42:13 AM Quote from: contrex on June 07, 2007, 01:34:03 AMI apologise in advance if I am second guessing the moderators here, but it is not (I believe) the policy of this board to encourage or facilitate misuse of a school's or employer's IT facilities, and what you are asking definitely falls into that category. "Vandal" would be a better term than "rebel" in my opinion.Would you say you had sufficient knowledge to be able to accomplish the task or not? I don't see how my knowledge or lack of it is relevant; your tone begins to annoy. Quote from: contrex on June 07, 2007, 01:49:09 AM Quote from: DeltaSlaya on June 07, 2007, 01:42:13 AMSorry if it came out like that, it's just that I really wouldn't mind being able to achieve this.Quote from: contrex on June 07, 2007, 01:34:03 AMI apologise in advance if I am second guessing the moderators here, but it is not (I believe) the policy of this board to encourage or facilitate misuse of a school's or employer's IT facilities, and what you are asking definitely falls into that category. "Vandal" would be a better term than "rebel" in my opinion.Would you say you had sufficient knowledge to be able to accomplish the task or not? Thanks.I will go as far as to say this. In general, changing file attributes, ownerships and permissions on a multi user system requires administrator privileges. If you ain't the administrator, it's because the computer owner doesn't want you to be able to do these things. If you seek to gain those privileges without permission, that makes you a hacker, and we don't like them on here. I might well know how to jemmy open a door or bypass a burglar alarm, but I would be very irresponsible to post a how-to on a web forum. And yes, I do know how to do what you describe. Part of my job involves protecting a system against such threats, so I am aware of steps that misusers might take. Quote from: contrex on June 07, 2007, 02:07:12 AM I will go as far as to say this. In general, changing file attributes, ownerships and permissions on a multi user system requires administrator privileges. If you ain't the administrator, it's because the computer owner doesn't want you to be able to do these things. If you seek to gain those privileges without permission, that makes you a hacker, and we don't like them on here.I'm trying to change neither ownerships or permissions. Also I'm definitely not trying to HACK anything . Just change person X to person Y, and I want to know how ... Thanks lolQuote I'm trying to change neither ownerships or permissions. Your own words:- Quote Say, person XYZ had modified the file when you go: "dir /s /q" is there a way to manually change that to anything you want, even if it would be nonexistant? the "name" revealed by dir /q is the owner of the file Quote C:\>dir /? Quote Also I'm definitely not trying to hack anything I say you are. if you don't even know how to find out about file ownership, what it is, and who can change it, which is hardly secret knowledge, how can you be so sure what is or is not hacking? |
|
| 5429. |
Solve : Need help with batch file to backup user data? |
|
Answer» Hi All, I'm new to scripting and writing batch file. I would really appreciated if someone can help me with this batch file i'm working on. The purpose of this file is to backup the user data to a network location. As of now, it'll do it job of backing up. I NEED some minor tune up with the batch file. Here's are some question i have.For question 1, try launching the "hidedesk.exe" program again. If that doesn't work, then try something like this (you may have to change the title depending on the actual title of the window): Code: [Select]echo set WshShell = CREATEOBJECT("Wscrip.Shell") >ActHideDesk.vbs echo WshShell.AppActivate "HideDesk" >>ActHideDesk.vbs cscript ActHideDesk.vbsFor question 2, is there a reason you don't want to use XCOPY? The ZIP programs all work a little bit different, so WITHOUT knowing your brand and version there isn't an easy way to help you fix it. But it seems to me like the xcopy method should work well. If not, let us know why, or post the details of your zip program.Thank you for the reply. My solution for the first question is by inserting a delay in the batch file that i use to open up the hidedesk.exe. For the 2nd question, i guess i'll just have to use xcopy to do the incremental backup. Btw, the winzip version i'm using is WinZip 10.0. |
|
| 5430. |
Solve : Replacing a String of text with something else with a BAT file? |
|
Answer» Alright, so I'm trying to make a batch file that finds a string in a .INI file and replaces it with another. The string in the .INI file looks like this: @echo off |
|
| 5431. |
Solve : Read a .txt file and delete line feed from the end of the file? |
|
Answer» Hello, Or am I being unfair? Not at all. That rule EXISTS for a reason. |
|
| 5432. |
Solve : Help with a bat file? |
|
Answer» I need to move a bunch of xml files from one dir to another then select about 500 of them and copy them back to the original directory. Here is what I have so far: |
|
| 5433. |
Solve : BIOS upgrade? |
|
Answer» I am trying to upgrade the BIOS on an old Emachines 633 before loading WINXP and I get an error that says the flash routine can't proceed with a memory manager present. I've booted the system with the WinME startup disk to a command prompt only. I've looked at the AUTOEXEC.BAT file and CONFIG.SYS and don't see where it is loading HIMEM.SYS but it must be. Any thoughts on how to stop it loading a hi memory manager ??Do you have a link to the info on the BIOS flash ? ?
Quote eMachines eTower 633irx Thanks to all who replied. Your help is greatly appreciated. I only wanted to upgrade the BIOS to the latest stuff even though the only thing I've done to this machine is increase the original 32 Meg RAM to 256MB. Loaded WinXP Pro. last night with no problems. Yeah, it's a little slow with a 633 MHz Celron processor but I only use this machine in the summer at my camper in PA for surfing the net, reading E-mail and playing online chess. I also run Knoppix Linux from a bootable CD on this machine to play around with. Eventually I'll go fulltime to Linux once I've learned mmore about it.Quote from: oldrunner55 on June 05, 2007, 01:12:39 PM Yeah, it's a little slow with a 633 MHz Celron processor I first used XP with a 750 MHz AMD Duron and it RAN just fine it seemed to me. I went from 256 to 512 MB of RAM but it was certainly useable with 256. People today are so spoiled with all that power... Edit the CONFIG.SYS on your boot disk. You really PROBABLY don't need anything in your config.sys for flashing your BIOS, but at least take out any lines referencing "himem" or "emm386". Quote from: GuruGary on June 05, 2007, 03:00:27 PM Edit the CONFIG.SYS on your boot disk. He already told us it's a CD-ROM |
|
| 5434. |
Solve : Loging the Constance of a bat file? |
|
Answer» i NEED some CODE that can log a BATCH files text You need some English LESSONS! Please explain clearly what you WANT to do. The word "please" is useful as well. |
|
| 5435. |
Solve : Kill the previous step - Batch File? |
|
Answer» I have a small batch file that is designed to let the user know that the email client is going to close and then starts the program that gracefully kills the email client. The problem with this program, Close Goldmine.exe is that if the user doesn't have GoldMine open on their desktop, Close Goldmine.exe doesn't terminate.Does that mean that the GoldMine program isn't running at all on their computer, or it just isn't one of the open Windows on their Desktop? Assuming the former, run a test for it, and if it is not running, then you can skip that section of the batch file. Something LIKE: Code: [Select]tasklist /fi "imagename eq goldmine.exe" | findstr /i goldmine if errorlevel 1 goto :Next echo Your email client is going to close closegoldmine.exe :Next rem the rest of your scriptGary, thanks for keeping pace with me here. I know I've got a lot of threads going. What I meant by Quote The problem with this program, Close Goldmine.exe is that if the user doesn't have GoldMine open on their desktop, Close Goldmine.exe doesn't terminate.is . . . Before everyone logs out to go home for the night they are supposed to shut down the programs they are using. On of them is GoldMine. A lot of them don't. This screws up the backup process. Someone created the Close GoldMine program to quickly and gracefully sever any open connections to the dBase database AND close the program window. So if the user doesn't terminate their session, this little program will. The idea is for GoldMine to not be running at all on the local machine. Close GoldMine.exe is an awesome little program with one big fault - if the user DOES PROPERLY close (end, X-out-of, terminate) all of their open programs (like GoldMine) when Close GoldMine.exe goes to run it finds that GoldMine is not there and it . . . hangs out. It does nothing. It stays open. So on a computer that was properly logged off once the batch file reaches the part where Close GoldMine.exe is called - it hangs. I guess what I NEED is an "IF" statement. Can you help me with that? If GoldMine (gmw6.exe) is open then run Close GoldMine.exe If GoldMine (gmw6.exe) is not open then don't run Close GoldMine.exe, just go to the next line in the batch file. Can you translate that into DOS for me? Thanks, Matt Quote from: powlaz on June 04, 2007, 11:07:24 AM So on a computer that was properly logged off once the batch file reaches the part where Close GoldMine.exe is called - it hangs. I guess what I need is an "IF" statement. Can you help me with that? This one line should do it. Is "Close GoldMine.exe" the name of the program? If it has a space in the name you'll need the quotes I think, and maybe the full path to the executable would be advisable, unless it's in the same folder as the batch file. tasklist | findstr "gmw6.exe" && run "Close GoldMine.exe" If gmw6.exe is in the list of running tasks generated by Tasklist, then, the line will execute whatever is to the right of the &&. If it doesn't find it, it'll do nothing. Findstr is case sensitive, so check in Task MANAGER that it it spelled correctly. Contrex - this looks perfect. I tried it last night and it did exactly what I wanted. Now I don't need to fret about scheduling Close Goldmine.exe. . . . of course I will need to WORRY about scheduling the batch file. Thanks for getting me over the hump!! Matt |
|
| 5436. |
Solve : MS DOS in Win XP? |
|
Answer» Hello, all. Obviously this is my first post but I have used the faq's quite a bit before today. |
|
| 5437. |
Solve : how to proceed with app without killing the process??? |
|
Answer» ive got a problem. i wrote a script that allows to execute many programs from one APP, but it stops when it executes first app. how can i skip to the next line without shutting this first program down? |
|
| 5438. |
Solve : Batch file opens more dos prompts? |
|
Answer» I am RUNNING a BATCH file which executes an install in silent mode. However it opens up a SECONDARY dos prompt window which i need to close by hand in order to keep going. |
|
| 5439. |
Solve : Can I trigger MS Access to open from a batch file?? |
|
Answer» If so...how? I am USING windows XP and I want to open MS Access from my BATCH file. Can't figure out how....THANKS.Nevermind...I figured it out....thanks! |
|
| 5440. |
Solve : question on xcopy to perform incremental backup? |
|
Answer» HI, I was wondering if i could get some help here. I have data folder which contains all the emails messages my mail-server has received on a daily basis. What i'd like to do is to be able to back them up with xcopy i created in a batch file. However, i don't know how to back them up in an incremental fashion meaning that i want only what's been changed or NEW messages be backed up. I don't want to back up what's already been backed up as it would waste too much space in memory. So, this is what i've come up with in a batch file xcopy C:\Program Files\qmail\data C:\backup_emails /M/E/H Just wanna check whether the above xcopy command will perform incremental backup for my email messages. Thank you in advancelook here http://www.icpug.org.uk/national/features/041107fe.htm Thank you Contrex for your reply. I tried it out but got stuck on SUBST x: c:\BLAH blah. What happens if my computer doesn't have virtual drive? Is it something i can create? Thank you in advanceQuote xcopy C:\Program Files\qmail\data C:\backup_emails /M/E/H I wouldn't worry about all that c:\>xcopy /? Copies files and directory trees. XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/V] [/W] [/C] [/I] [/Q] [/F] [/L] [/G] [/H] [/R] [/T] [/U] [/K] [/N] [/O] [/X] [/Y] [/-Y] [/Z] [/EXCLUDE:file1[+FILE2][+file3]...] source Specifies the file(s) to copy. destination Specifies the location and/or name of new files. [snip] /M Copies only files with the archive attribute set, turns off the archive attribute. [snip] /E Copies directories and subdirectories, including empty ones. Same as /S /E. May be used to modify /T. [snip] /H Copies hidden and system files also. [snip] The first time you run your batch, The /M switch ensures that Xcopy will copy everything that has the archive bit "set", (a bit which is "set" has a value of binary 1). After it has copied each file, it will "unset" (ie change to binary 0) the archive bit for that file. The next and subsequent times that the batch is run, the /M switch ensures that Xcopy only copies those files which have arrived since the last run, again, marking them as copied. Thus the incremental backup is achieved. The /E switch makes Xcopy dig down into subfolders, and the /H switch makes it copy hidden and system files (if it finds any) So, YES, that looks as if it will do what you want. |
|
| 5441. |
Solve : how do you make a file that opens a file from any area in the computer.? |
|
Answer» You need to |
|
| 5442. |
Solve : Need help !!!? |
|
Answer» echo |
|
| 5443. |
Solve : Help, I have a Thinkpad brick/paper-weight!? |
|
Answer» I have a 1999 IBM Thinkpad that originally had Windows 98 on it. I reloaded it with Windows 2000 but did not like it due to how slow it make it run. I'm attempting to go back to Win98 by using my IBM Recovery CD that came with the computer. I know it works, because I used it once before with no problem before I loaded Win2000. A recovery or recover CD is one designed to restore your PC to default "factory condition". There is usually a (mirror) "image" stored on a partition on the hard disk. When you insert the recover CD it reads that image and resets your PC, Windows, drivers and everything else to how it was on the day it shipped to you. It is a low cost option to providing you with a proper Windows CD. Quote Recovery CDs are the bane of the industry. Fight them. MOST computer manufacturers [in the UK] provide you with only a recovery CD when you buy a PC. Don't settle for that. Always insist on a full Windows CD with all the necessary drivers; you've paid for it! Top 10 Reasons to not have a Recovery CD http://www.bestpricecomputers.ltd.uk/profile/recovery_CD.htm Double post, the other thread has been locked. Not sure if this is the best board for the problem, but let's wait a while to see where the problem is.Quote from: SandW on June 02, 2007, 11:53:21 PM ... If it were me, I'd be looking - on the CD - for a file named setup.exe , and trying to execute that. Contrex is probably right. But just for the heck of it, boot with your floppy again. Did you say that your CD drive becomes E: drive? If so, do dir /a/o/p e:\*.exe How many files are displayed? Too many to list here? If not, please name them for us. If it was too many to list here, then do dir /a/o/p e:\set*.exe What did you find? Name them (it) for us. Quote I also have a Knoppix and Helix boot CD, and they will not start either, they begin to spin-up, but would allow Win2000 to load as usual, or do nothing after I reformatted the drive. Did these ever work? Could you ever boot this machine with them? How about other computers... could you ever boot another computer with them? Can you double check them again - got another computer or a friend that will let you try to boot with these? Just to be sure that they really will/still boot. Quote What can I do? Is there a sequence of DOS commands I can type to have it run every EXE file on the CD until something happens? With the above metioned dir e:\*.exe , you will at least get a list of all the .exe files in the root dir of the CD. Tell us the filenames before you try running them. Quote It appears my Recovery CD and my boot CDs are not starting for some reason, but the CD drive seems perfectly normal/in good working order. If it were me, I'd want to try all those CDs in another computer, and prove that they either will or will not boot, first. Hi. Yes, all the CDs actually work, and work in my other computer. Below is what I did and results thus far, some progress, but still not good-to-go. 1. Went to IBM site and downloaded newest BIOS version and loaded to laptop. Returned all settings to factory settings as website suggested. Apparently when I loaded Win2000, it corrupted my BIOS to some degree but it wasn't evident until trying to revert back to Win98. Strange and scary at the same time isn't it? 2. Also dowloaded the PC Doctor UTILITY and completed complete diagnostic on system, all checked OK. 3. Loaded the Knoppix CD and wiped the drive and repartioned and formatted to FAT32. All sectors TESTED good. 4. Put "Recovery" CD in and reboot, it initialized successfully and seemed to complete the "recovery" process, right down to the last success sign of saying, "your computer has been successfully recovered, please reboot after removing the Recovery CD." 5. Reboot machine w/ all CDs removed and now I get an "I/O error" that prevents Win98 from completing to load. I read on the IBM site that for older laptops that have "recovery" issues with the CD (which I thought I overcame with step 4) that the hard drive may have to be reformatted in FAT16 prior to running the Recovery CD. The note is vague though and seems to apply to hosts that won't start the Recovery process at all, not ones with my "I/O error" after going thru the whole process. The default Recovery settings splits the hard drive into two halves, and loads the OS onto one partion, and leaves the other logical partition for personal files/storage. I tried it twice thus far, allowing it to do that, and making it use the single FAT32 partition I create as well (it gives the option). Both give me the same result with the "I/O error" upon reboot after recovery. I'm game for trying to format my hard drive to FAT16 to see if this is the final fix for the Recovery process, but don't know how to do this. Does anyone know if FAT16 reformatting is available from the 3.5" floppy Win98 boot disk? Any other suggestions I'll do as well, just name them. thanks, AndrewQuote from: SandW on June 03, 2007, 01:13:21 PM I'm game for trying to format my hard drive to FAT16 to see if this is the final fix for the Recovery process, but don't know how to do this. Does anyone know if FAT16 reformatting is available from the 3.5" floppy Win98 boot disk?Yes, you should be able to do this. Boot to your Win98 Boot Disk, and run the FDISK command. The first screen that comes up should say something like "Do you want to enable large disk support". If you choose 'N' at this screen, it runs fdisk in FAT16 mode, while choosing 'Y' runs fdisk in FAT32 mode. So choose 'N', then delete all existing partitions. The new partitions that you create should be FAT16. Also be sure that you set your boot partition to "Active". |
|
| 5444. |
Solve : Hide Command Prompt? |
|
Answer» I am working on a batch file that echos a message to the user (amongst other things). Is there a way to make the command prompt window disappear or minimze and then REAPPEAR later in the script? Is there a way to make the command prompt window disappear or minimze and then reappear later in the script? You could use CMDOW for this Cmdow is a Win32 commandline UTILITY for NT4/2000/XP/2003 that allows windows to be listed, moved, resized, renamed, hidden/unhidden, disabled/enabled, MINIMIZED, maximized, restored, activated/inactivated, closed, killed and more. http://www.commandline.co.uk/cmdow/ unzip & place cmdow.exe on your PATH. Make a batch file minimize its own window: Assumes the title is unique Code: [Select]TITLE MinimizeMePlease FOR /F %%A IN ('CMDOW ˆ¦ FIND "MinimizeMePlease"') DO CMDOW %%A /MIN make it come back as it was before (restore) Assumes the title is still the same Code: [Select]FOR /F %%A IN ('CMDOW ˆ¦ FIND "MinimizeMePlease"') DO CMDOW %%A /RES Quote Also, is there a way for the command prompt window to open up without the Close, Minimze/Maximize buttons? There is a program called Wintopmost that disables the close button, but it COSTS $642 for a site license, I'm checking out if there are any free alternatives I did come across this but I'm not sure why I didn't take it. Any way to do it from within the command prompt? I'll have to try CMDOW. Thanks.Quote from: powlaz on May 31, 2007, 01:30:54 PM Any way to do it from within the command prompt? Code: [Select]TITLE MinimizeMePlease cmdow "MinimizeMePlease" /minIf you mean, without any external or additional programs, it is rather DIFFICULT, hence the profusion of little programs to do the job, such as another free one, Window.exe, available from http://www.steve.org.uk/Software/windowhide/ |
|
| 5445. |
Solve : batch file for finding the file path? |
|
Answer» hey contrex thaks for ur contribution. It is not getting stored anywhere. What you see is the output of DIR.Hi Contrex, That was a great help from you .Thankyou so much. One more doubt.how can i get the file extension after storing the filepath into the variable.i want to just display the file extension after displaying the file path.do i have any option like give only the file name without extension and search for it.if its found then dispaly the path and extension of the file seperately?any help will be HIGHLY appreciated. thanx in advance PrajithQuote do i have any option like give only the file name without extension Use wildcards, as with DOS command line. EG to find files called "example" of whatever extension, supply example.* Quote and search for it.if its found then dispaly the path and extension of the file seperately? see modified code below Code: [Select]@echo off setlocal enabledelayedexpansion REM clear temp file first if exist %temp%\filesearch.txt del %temp%\filesearch.txt REM ask user for filespec to use with dir /b /s set /p FILE="What is the file name (include extension)? " echo. echo searching... echo. REM For each letter of the alphabet for %%D in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do ( REM if a volume of that letter exists, perform DIR (file spec) /b /s on that volume REM drive letter is obtained by expanding loop variable %%D if exist "%%D:\" ( REM inform user of drive being searched echo searching drive %%D:\ for %FILE% REM perform DIR and redirect output to file DIR /a-d %%D:\"%FILE%" /b /s >> %temp%\filesearch.txt echo. ) ) echo. echo search finished. echo search results: echo. REM (1) count number of matching files found REM use set /a to set counter to 0 REM shows how to count in batch set /a count=0 REM for each line in output file for /f "delims==" %%L in (%temp%\filesearch.txt) do ( set /a count+=1 ) REM (2) show results to user REM for each line in output file for /f "delims==" %%L in (%temp%\filesearch.txt) do ( REM make variable equal to found file path set filepath=%%L REM show line to user REM must use ! and not % REM because of delayed expansion REM in loop echo file path: !filepath! echo. REM you will need to edit, this is just to REM show you how to use the file info echo here are the different elements of echo information about the file echo. echo drive: %%~dL path: %%~pL filename: %%~nL extension: %%~xL echo. echo drive: %%~dL echo path: %%~pL echo filename: %%~nL echo extension: %%~xL echo drive, path and name: %%~dpnL echo. ) echo. IF %count% EQU 1 echo %count% result found IF %count% GTR 1 echo %count% results found echo this is the last match that was found echo. echo %filepath% echo. Quote from: contrex on June 01, 2007, 01:30:17 AM QuoteHi Contrex,do i have any option like give only the file name without extension Thanks for your tremendous help.i bothered you because it was a very critical situation . anyways thanx once again for your help. Prajith |
|
| 5446. |
Solve : Stuck with a simple batch file? |
|
Answer» Hi, Can this somehow happen that 2 commands get called in parallel I'm not sure how unless the two commands are started, in which case they would run in separate processes (windows). A call statement CREATES a return mechanism which allows some secondary external code UPON completion to follow an address pointer back to the next sequential instruction after the call Running external code from a process without a call mechanism would simply transfer control to the external code with no pointer back to the original process. if we had fewer emoticons and more information, we might get somewhere. The emotions tell the story that information is over |
|
| 5447. |
Solve : how to get file extension from a file name? |
|
Answer» hi all, Welcome to CH. I want to create a BATCH file for this.My OS is win2000.is this being set for homework somewhere this week? It sure is cropping up all over the place! |
|
| 5448. |
Solve : My first ever batch file, need help? |
|
Answer» HEY everyone i've got to create a batch file that will attempt to telnet through every port on another computer. Sorry if that sounds stupid but this is my school project. I know i need a for statement that runs 65000 times i guess but i don't know how to do it. Sorry if this sounds pointless check out the FOR command, the /L PARAMETER will do incrementing loops now go and do your homework !!! Grahami've tried the for loop but i really don't understand where i would put like the 1-65000 part. My only programming experience is with turing and thats what im used to after i find that i think i can just ECHO "telnet (ip) (variable that is going up from 1-65000)"from the DOS help FOR /L %variable IN (start,step,end) DO command [command-parameters] The set is a sequence of numbers from start to end, by step amount. So (1,1,5) would generate the sequence 1 2 3 4 5 and (5,-1,1) would generate the sequence (5 4 3 2 1) so something like this FOR /L %%a IN (1,1,65000) DO telnet (ip) %%a Let me know if I passednope, when i run it i just get the LINE of code repeated over and over, and the final number is ALWAYS 1ok if i just change it to FOR /L %%a IN (1,1,65000) DO %%a it successfully dispays all the numbers so now i have to figure out how to get the "telnet (ip)" part in theregetting closer, i tried FOR /L %%a IN (1,1,65000) DO TYPE telnet (ip) %%a and that seemed to work except after each port is CHECKED i get the error The system cannot find the file specifed. Error occured while processing: telnet. The system cannot find the file specifed. Error occured while processing: (ip). The system cannot find the file specifed. Error occured while processing: 129. Is this because im running the program at home which isn't connected to the network im telnetting, in other words will this work once i running on a computer that's connected to the server?Take out the word "TYPE". If you just want to test it without actually doing the telnet, then use ECHO instead of TYPE. Code: [Select]FOR /L %%a IN (1,1,65000) DO telnet (ip) %%awhen i take out TYPE the output goes back to only having telnet (ip) 1, it stays at 1 and won't go upok awesome it worked, now once i find a port i have to actually figure out what to do once im in lol thanks for the help guys |
|
| 5449. |
Solve : What is %%a? |
|
Answer» I see it everywhere. What is %%a It is a FOR variable. You can have 52, a to z and A to Z. You see %%a a lot probably because a is the first letter of the alphabet. Quote Also in DOS is the FOR statement always written as FOR /F? No. FOR %variable IN (set) DO command [command-parameters] %variable Specifies a single letter replaceable parameter. (set) Specifies a set of one or more files. Wildcards may be used. command Specifies the command to carry out for each file. command-parameters Specifies parameters or switches for the specified command. To use the FOR command in a batch program, specify %%variable instead of %variable. Variable names are case SENSITIVE, so %i is different from %I. If Command Extensions are enabled, the following additional forms of the FOR command are supported: FOR /D %variable IN (set) DO command [command-parameters] If set contains wildcards, then specifies to match against directory names instead of file names. FOR /R [[drive:]path] %variable IN (set) DO command [command-parameters] Walks the directory tree rooted at [drive:]path, executing the FOR statement in each directory of the tree. If no directory specification is specified after /R then the current directory is assumed. If set is just a single period (.) character then it will just enumerate the directory tree. FOR /L %variable IN (start,step,end) DO command [command-parameters] The set is a sequence of numbers from start to end, by step amount. So (1,1,5) would generate the sequence 1 2 3 4 5 and (5,-1,1) would generate the sequence (5 4 3 2 1) FOR /F ["options"] %variable IN (file-set) DO command [command-parameters] FOR /F ["options"] %variable IN ("string") DO command [command-parameters] FOR /F ["options"] %variable IN ('command') DO command [command-parameters] or, if usebackq option present: FOR /F ["options"] %variable IN (file-set) DO command [command-parameters] FOR /F ["options"] %variable IN ('string') DO command [command-parameters] FOR /F ["options"] %variable IN (`command`) DO command [command-parameters] filenameset is one or more file names. Each file is opened, read and processed before going on to the next file in filenameset. Processing consists of reading in the file, breaking it up into individual lines of TEXT and then parsing each line into zero or more tokens. The BODY of the for loop is then called with the variable value(s) set to the found token string(s). By default, /F passes the first blank separated token from each line of each file. Blank lines are skipped. You can override the default parsing behavior by specifying the optional "options" parameter. This is a quoted string which contains one or more keywords to specify different parsing options. The keywords are: eol=c - specifies an end of line comment character (just one) skip=n - specifies the number of lines to skip at the beginning of the file. delims=xxx - specifies a delimiter set. This replaces the default delimiter set of space and tab. tokens=x,y,m-n - specifies which tokens from each line are to be passed to the for body for each iteration. This will cause additional variable names to be allocated. The m-n form is a range, specifying the mth through the nth tokens. If the last character in the tokens= string is an asterisk, then an additional variable is allocated and receives the remaining text on the line after the last token parsed. usebackq - specifies that the new semantics are in force, where a back quoted string is executed as a command and a single quoted string is a literal string command and allows the use of DOUBLE quotes to quote file names in filenameset. Some examples might help: FOR /F "eol=; tokens=2,3* delims=, " %i in (myfile.txt) do @echo %i %j %k would parse each line in myfile.txt, ignoring lines that begin with a semicolon, passing the 2nd and 3rd token from each line to the for body, with tokens delimited by commas and/or spaces. Notice the for body statements reference %i to get the 2nd token, %j to get the 3rd token, and %k to get all remaining tokens after the 3rd. For file names that contain spaces, you need to quote the filenames with double quotes. In order to use double quotes in this manner, you also need to use the usebackq option, otherwise the double quotes will be interpreted as defining a literal string to parse. %i is explicitly declared in the for statement and the %j and %k are implicitly declared via the tokens= option. You can specify up to 26 tokens via the tokens= line, provided it does not cause an ATTEMPT to declare a variable higher than the letter 'z' or 'Z'. Remember, FOR variables are single-letter, case sensitive, global, and you can't have more than 52 total active at any one time. You can also use the FOR /F parsing logic on an immediate string, by making the filenameset between the parenthesis a quoted string, using single quote characters. It will be treated as a single line of input from a file and parsed. Finally, you can use the FOR /F command to parse the output of a command. You do this by making the filenameset between the parenthesis a back quoted string. It will be treated as a command line, which is passed to a child CMD.EXE and the output is captured into memory and parsed as if it was a file. So the following example: FOR /F "usebackq delims==" %i IN (`set`) DO @echo %i would enumerate the environment variable names in the current environment. I couldn't have said it any better myself. |
|
| 5450. |
Solve : NO COMMANDS WORK EXCEPT CLS? |
|
Answer» i have this late 1980s c.1988 IBM with MS DOS 4.0 and i haven' t turned it on in a long time (not since around 2003) and i am windering how to re-install the required software to run it. any ideas?Boot to your DOS 4 install DISKETTE, and follow the prompts. go to sys32 and check if the files are there but before u do that go to file options and make it show hidden files and system files tell me if u can see any .exe Lordoftheplat: I don't think he is going to have system32 or any file menu under DOS 4.Quote from: GuruGary on May 31, 2007, 07:43:59 AM Lordoftheplat: I don't think he is going to have system32 or any file menu under DOS 4. lol I know (I can tell) that 1988 is like 10 years before most people using this forum were born, but take it from an oldster that MS-DOS version 4 was widely regarded as the crappy version that came between version 3.30 and version 5.00. Version 6.22 is the reference version still. Quote from: contrex on May 31, 2007, 01:55:04 PM I know (I can tell) that 1988 is like 10 years before most people using this forum were born, but take it from an oldster that MS-DOS version 4 was widely regarded as the crappy version that came between version 3.30 and version 5.00. Version 6.22 is the reference version still. Agreed. In fact I still have computers running the following versions of DOS: MS-DOS 3.31 MS-DOS 5.00 MS-DOS 6.00 MS-DOS 6.22 Notice how I skipped MS-DOS 4.x ... since it was pretty worthless. |
|