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.
| 801. |
Solve : printing your hardware and drivers in a report? |
|
Answer» I seem to remember a Dos comand that would print a list of all hardware and I think it even listed the drivers. I can't remeber the command. Can anybody help me? :-/Not a DOS command but a program that M$ included with some versions of DOS. It is MSD.exe. The info it gives may or may not be accurate. It should be run from a DOS PROMPT outside Windows to get the DOS information. From a DOS prompt inside windows it will display the info that is passed to it by windows. Do not use it on 2k or XP systems unless you KNOW they are FAT32 FORMAT. If it is not on your HD and you are using W98x, you can find it on the windows CD in a directory named olddos.All you ever wanted to know about your system. |
|
| 802. |
Solve : Any way to run a batch file with NOUI?? |
|
Answer» I am trying to run a batch file remotely. Is there anyway to have it run without bringing up the DOS screen? I wan't users to not know it is even running. |
|
| 803. |
Solve : Delete everything? |
|
Answer» Hi. I am in a TIGHT jam right now, and any help is appreciated. I TRIED to install Windows, but after it INSTALLED, it wasn't ABLE to use the boot disk because it is not having a driver that works with my CD ROM drive. I have my own driver on a floppy disk. Any way. |
|
| 804. |
Solve : How do I boot up in dos w/o windows access?? |
|
Answer» I want to retrieve some information in a text file from a hard drive that decided it didn't want to load up windows anymore. I know the necesary dos commands to get to my document (i have been researching) however, being [unfortunately] raised on windows, i don't know how to boot in Dos without windows access.I can think of 3 ways: Thanks much, SKy. #1 sounds like it will be best for me. This will work for Win98, Win95, but not WinXP or Win2k. See: http://www.bootdisk.com/ |
|
| 805. |
Solve : Urgent Help : Batch File Terminate Program? |
|
Answer» DEAR all, I'm newbie in Batch File, I would like to seek assistance here. The problem is, how to TERMINATE a program(e.g Calc.exe) in batch file and after terminate it, I would like to restart the program again. How to do it in batch file? please help Thanks in advance Cheers, yymaeAutoIt http://www.autoitscript.com/autoit3/ can solve this problem for you.Besides AutoIt, do you have another solutions?I don't have another solution, but I never needed another solution. Depends on the OS you're using.. if you're using winXP, you can USE taskkill to kill any PROCESS.... for example, to kill calc.exe, "taskkill /F /IM calc.exe" "taskkill /?" - if you need more infor on what the F and IM stand for if you're using an older OS like windows98, you'll have to download a resource from the microsoft website that includes "kill.exe" which will do the same thing as taskkill |
|
| 806. |
Solve : Log results of bat file with timestamp name.? |
|
Answer» I have done a search on the front page, and in the forums, and I couldn't find out how to do this. |
|
| 807. |
Solve : Best method to offload files from failing SATA drive?? |
|
Answer» I have a 2TB storage drive in my W7 64bit system that has suddenly developed errors (see attached image) C:\>xcopy/? The OP may want to search the internet for: Forensic Data Recovery Some offer special software. But others require you to ship the drive to them. Prices vary. Watch out! Here's an article from one such company that explains what might be done. https://westerndatarecovery.com/services/forensic-data-recovery/ Quote “Forensic techniques and expert knowledge are used to explain the current state of a digital artifact, such as a computer system, storage medium (e.g. hard disk or CD-ROM), or an electronic document (e.g. an email message or JPEG image).[3] The scope of a forensic ANALYSIS can vary from simple information retrieval to reconstructing a series of events.”The process is often used in legal issues and can also be used to recover data from a bad drive.Hi When working with a drive with bad sectors or slow access it is better to make a raw copy to a known good drive of the same size or larger capacity. This drive needs to be blank. Also it is better to have both the failing drive and the known good drive attached direct to sata ports in the computer. Then do the copy from the good drive. To make the raw copy : A program which is easy to use is https://hddguru.com/software/HDD-Raw-Copy-Tool/ This will skip bad sectors and allows you to restart the drive if windows decides to shut the drive down. Or there is the linux tool DDrescue . Also there is the option of using a linux live disk which would allow you to copy and paste the files you wanted from the drive using file manager. Because of the way Linux accesses the drive it copes better with bad sectors . Parted magic, although not free boots on most systems. It also includes DDrescue and file explorer. https://partedmagic.com/ |
|
| 808. |
Solve : edit a text file in numerous folders? |
|
Answer» Hello, |
|
| 809. |
Solve : Run JOB in cmd? |
|
Answer» HI I have to list of the job id to run by manual , so I write the operation menu to let operator run the job in sequence, but this option is banned by supervisor. Alternative, I have to create the text file contain the jobid number , then run the batch file to read this text file to run the job according the dependent and individual job. I create the text file which contain. To auto run P107C then P105C after running completed P107C, run P110C until P105C completed. Can you please assist me how to write the script to read this jobid text file to auto run the job by dependent. P107C;IND=Y;;0 P105C;;P107C;0 P110C;;P107C;0 D101C;;P110C,P105C;0 P106C;IND=Y;;0 P118C;P106C;0 D102C;P118C;P106C;0 P111C;IND=Y;;0 P112C;P111C;0 P113C;P112C;0 D103C;P113C;P112C;0 Quote but this option is banned by supervisor. Is this supervisor going to allow a different METHOD of achieving the same goal? Such as at my work place I can not bring in any media form of code because a virus etc can travel in on media. The systems I work with are isolated from the outside world in tightly controlled government networks and so for myself I got approval from my boss that while a USB stick, CD or DVD, or any other form of media with a program/script etc is on is strictly not allowed, they did allow me to manually type up the code in notepad and run it against QBasic which was on NT4 as well as batch scripting was allowed too because I myself typed everything that was to run on the server. And because I am not a rogue employee who would put anything bad in it, I was allowed to do this. I'd highly advise you get written permission from supervisor before running any programs or SCRIPTS on their systems or you can be easily fired and then some. Once you have written CONFIRMATION that it is allowed, then MOVE forward and do just as was approved to protect yourself. Hi , I run these a couple of batch file in our UAT first then it will roll out to production box. Supervisor allow me to to do copy those batch file on the production. |
|
| 810. |
Solve : deleting space from result? |
|
Answer» I have tested a little script to take a number from TXT FILE and use it in batch, but problem is I get that litle square and script doesnt work. Simple answer: Just do not take a number from a file. I know that. Thing is I want to learn how to do itBlisk, how is the file number.txt made? What is that leading character before the '4'? It is not just a simple space; the timeout command doesn't mind spaces before the number. Why is the number being got from a file? You can get exactly this problem if number.txt has Unicode encoding. If you are creating the text in Notepad or some other editor, save with ANSI encoding. If you doing it that way (with an editor), why? Alternative: Do 1 and 2 and maybe also 3 1. Save text with UTF-8 encoding. 2. Add this line at the top of your batch file underneath echo off chcp 65001 >nul 3. As well as these things, also try a Unicode font for console such as Lucida Console. I have created file with batch copy /y nul d:\number.txt echo 5 >> d:\number.txt This also didn't help echo off chcp 65001 >nul also if I save number.txt with UTF8 or ANSI, I get the same result. What is than right way to do that? So this is whole script now. and doesn't work echo off chcp 65001 >nul echo 5 > d:\number.txt set /p out=TIMEOUT /T %out%Try chcp 850 instead. Did you change font to Lucida Console? When I edit with notepad and add chcp 850 in batch it works but when I generate number.txt with powershell it doesn't work Is there more celan way to do this like ignore first charter?Not to *censored* in but: I suspect it sees the 5 as a stream number as in 2>nul. Try escaping the 5, echo ^5 > d:\number.txt Just a thought. To avoid the stream number thing, you need a space after the number, before the > symbol. See here, the first try leaves number.txt blank C:\>echo 5> number.txt ECHO is on. C:\>type number.txt C:\>dir number.txt 07/04/2019 18:20 0 number.txt C:\>echo 5 > number.txt C:\>type number.txt 5 Quote from: Blisk when I generate number.txt with powershell it doesn't work Why Powershell? Quote from: Blisk copy /y nul d:\number.txt Why are you doing this?? This works every time for me.... C:\>echo 5 > d:\number.txt C:\>set /p out=<d:\number.txt C:\>timeout /T %out% Waiting for 0 seconds, press a key to continue ... C:\>chcp Active code page: 850 Timeout waits correctly for 5 seconds, no CHCP change needed. I am trying to learn some stuff which doesn't work. Can you please try with my file, which doesn't work with me. When I put in quotes I see there are tvo charters before number! Somehov I should skip thatYour file says 148, and it is encoded as Unicode. How did you make it? Anyhow, convert Unicode to ANSI with the TYPE command: TYPE number.txt > number.txt It works, I just tried it. Yes this works now, thank you. TYPE number.txt > number1.txt set /p out=timeout /T %out% I created number file with this powershell 1| % {Get-Random -Minimum 2 -Maximum 222 } | Out-File -FilePath D:\number.txt |
|
| 811. |
Solve : Each Command in Batch Suddenly Requires a Response - No longer runs on it's own? |
|
Answer» I'm having an unusual problem that's happening on only one computer where I have the same BATCH program running on 200 systems or more. What is happening is that the DOS console is opening when the batch is initialized but I don't see the commands displayed like would they would normally. The cursor is just sitting there. I decided to HIT the Enter key and the first command in the batch executed. Then, each time I hit the Enter key, another command executes until it runs through the whole batch file. |
|
| 812. |
Solve : Appending Files and Combining File names? |
|
Answer» Hi, |
|
| 813. |
Solve : writing a dos command, would like advice please? |
|
Answer» Hello all, How many cats do we have to skin? Here's another way:I SAW a POOR DEAD kitty on the side of the road on my bike ride yesterday. Aww.. poor kitty! Code: [Select] //Z/Z// |\ //Z/Z// _,,,--,,_ /x`. //Z/Z//-'`' ._ \-;;,_ |x4- //Z/Z// ) )_ .;.( `'-' '---'//Z/Z//'(_/._)-'(_\_) //Z/Z// //Z/Z// Here's my kitty when he was younger. Code: [Select] (`. ) ) ( ( \ \ \ \ .-' `-. / `. ( ) `-._ , _ ) ,' (.\--'( \ ( ) / \ \ \_( / ( <6 (6 \_)))\ ( `._ .:Y)__ ''' \ `-._.'`---^_))) `-._ ))) ``` ``` In a futile attempt to remain on-topic... Code: [Select]dir /b mouse.drv >"cat mouth.txt" |
|
| 814. |
Solve : help ? Can a file created with the Windows EDIT command have a file header? |
| Answer» HEY everyone can a file CREATED with the WINDOWS EDIT COMMAND have a file header? thanks in returnWhat sort of header did you WANT to create?file headerHomework request locked. | |
| 815. |
Solve : looks like impossible for me may be nothing for you??? |
|
Answer» I wanted to allow people to view my files only once. A brillant guy suggested me to to this I wanted to allow people to view my files only once. What stops them from saving the document again? Thank you strollin but still does not work you can see it https://www.dropbox.com/s/u1hddm1liwr99h1/did%20not%20work.avi?dl=0It may help if the Original Poster can clarify some details. 1. Is in desirable to prevent users from seeing video again? Why? 2. Does the video loose value over a period of time? 3. How many users are involved? Do they have used Windows based machines? 4. Is you service to be used over the world wide wide or just a local campus? 5. Have your tried using media players to help control your presentations? 6. Are you familiar with he concept of a Podcast? The link below is about Apple podcast. Apple - iTunes - Podcasts - FAQs: For Podcast Makers Just a suggestion. It looked like in the video you renamed the video file to myvideo.mp4.mp4 instead of myvideo.mp4.Strollin, thank you but it still does not work https://www.dropbox.com/s/18g9fjyo0yb898j/still%20does%20not%20work.avi?dl=0Thank you geek, 1. I want my students to view my lecture note only once . 2. yes video loses value over the period of time. 3. Students may be around 100 and all of them have only windows based or android approach. 4.Service now is just over the campus locally . Hopefully in future in broader arena. 5.using media players to control presentation would be great but I have no idea on using it. 6. I am not familiar with the concept of a Podcast. I think it is only for IOS if i am not wrong. All of us dont have IOS based device. Thanking you so much for the time. Great day.Allow me to INTRODUCE thou to WordPress. WordPress is one of a number of high level presentation platforms used in the Internet. In is platform for Text, Audio, Video and an y mix. It is a structure that holds together lectures and documents that can be related or not. It can have categorizes, archives and feature pages. Or it can be very plain. It supports RSS feeds. I mentioned earlier, RSS is a type of podcast the uses e-mail to notify clients of new materiel. It is server base and requires no specific OS. Users can have Windows, Mac or Android systems. For campus use, your own computer could be the server. However, from my own experience, it is easier to just rent chap web space and use the automatic install features of the web site. Most, almost all, web hosting cervices give WordPress personal for no extra cost. This is my WordPress Blog. As you can see, it is rather plain. http://geek9pm.com/wp_k9/ More about using WordPress with RSS can be found at: https://en.support.wordpress.com/feeds/ Here is a nice lecture series done with WordPress and video clips. https://flippedemclassroom.wordpress.com/ http://WordPress.com gives commercial help for professionals. http://WordPress.org is non-profit for personal users. That is my best recommendation. Quote from: Geek-9pm on March 22, 2015, 09:40:38 PM RSS is a type of podcast the uses e-mail to notify clients of new materiel. RSS doesn't use E-mail. Quote from: docdipesh on March 22, 2015, 08:44:12 PM 6. I am not familiar with the concept of a Podcast. I think it is only for IOS if i am not wrong. All of us dont have IOS based device.Well my Zune must be using MAGIC these PAST 9 years to listen to podcasts. I swear this question has been asked before on the forums. It is not really something you would do with a batch file. Quote from: BC_Programmer on March 23, 2015, 03:04:16 PM RSS doesn't use E-mail.I have been corrected. Notifications are sent to the browser. http://rss-tutorial.com/rss-how-does-it-work.htm Quote SummaryRSS is definitely useful though. I'm not sure it would do exactly what the OP wants. However if they want to tightly control their content they would be better served to do so via a website. Even just preventing any single IP from viewing the video more than once would likely be better than trying to rely on some obfuscation trickery using hidden files and batch scripts. Just copying the folder it is in would workaround the trickery in this case. Realistically this takes us back to Geek-9pm's question- Quote 1. Is in desirable to prevent users from seeing video again? Why?The first part was answered- effectively a yes- but the second part- why- was never addressed. What is the purpose of preventing this content from being viewed multiple times? "I don't want them to" isn't really enough.Thank you all but I was looking forward to strollin |
|
| 816. |
Solve : Batch script syntax help?? |
|
Answer» I am currently trying to make a game in windows batch script, just a LITTLE TEXT based thing for fun. At one part of the game, the player has to be above a certain level to enter an area, and if they are below they are given a message and redirected. Problem is, it keeps telling me there is a syntax error even though I cant TELL what it is. Here, I'll let you look at the code and see if I can get any suggestions on how to improve this. |
|
| 817. |
Solve : Anyone help? i was wondering could there be valuable data in unallocated space?? |
|
Answer» is there any VALUABLE data in UNALLOCATED space? and how do I examine unallocated spaceNo NEED to double-post... |
|
| 818. |
Solve : can anyone solve this?? |
|
Answer» If you decompressed a single PKZIP archived file that had 9 separate files CONTAINED in the archive how would you examine the file slack for each of the 9 files The design of data compression schemes involves trade-offs AMONG various factors, including the degree of compression, the amount of distortion introduced (when using lossy data compression), and the COMPUTATIONAL resources required to compress and uncompress the data.[5] |
|
| 819. |
Solve : Creating Folders from List of Files? |
|
Answer» Hello. |
|
| 820. |
Solve : help ?Name three normal file extensions for graphical image files and? |
|
Answer» Name three normal file EXTENSIONS for graphical image FILES and What are the file headers for these files? |
|
| 821. |
Solve : Run a batch file to produce results in cmd? |
|
Answer» i am new to MS dos and SQL and i was wondering if you can help me |
|
| 822. |
Solve : Auto execute the Batch file? |
|
Answer» HI All, I am creating a BATCH FILE on server by program running on client (Use of .bat file is to set environments). I want to execute the .bat file automaticaly once it is GET created on server, is there any command I need to add in batch file while creating it through programm or I need to run new programm on server to execute the .bat file on server. if YES , please help me with the same? Please assist. Please let me know if you want more details. Thanks in advance. Quote from: hopes on May 14, 2014, 09:20:44 PM I want to execute the .bat file automaticaly once it is get created on server Yes please. |
|
| 823. |
Solve : Copy specific list of folders with files from one location to anather? |
|
Answer» HELLO all, I need help in copying a list of directories / folders from one location to another (let say from D: to E: or D:\ToCopy to e:\Copied). * I have list of folders. * I need the folders copied to be in same structure as in source. look into xcopy or robocopy. If you format your list on lines in a text file, you will also want to fermiliarize yourself with 'for /f'. You will use this to loop through each LINE of your file. Code: (psudo-code) [Select]for /f "DELIMS=" %%A in (list.txt) do xcopy "D:\ToCopy\%%A" "E:\Copied\%%A" %%A WOULD be %A if you are running outside of a BATCH file. |
|
| 824. |
Solve : Use of for and findstr to copy lines where text string is present? |
|
Answer» I coded this in a bat file. This may be enough for what you need to do - the double quotes allow long path and filenames with spaces also.That should run quicker as well. |
|
| 825. |
Solve : Report of file names? |
|
Answer» I'm looking for the command to list files in a file structure with sub folders that will not show duplicate names. I'm looking for the command to list files in a file structure with sub folders that will not show duplicate names. There is no single command to remove the duplicates. You'll have to write code to do that.I THINK this would be very difficult to do without using temporary files to store the list of files in. You could basically have to keep checking if the file NAME is found in the temporary file and if it isn't then add it to the temporary file. Quote from: Squashman on April 22, 2014, 11:42:40 PM You basically have to keep checking if the file name is found in the temporary file and if it isn't then add it to the temporary file. That's an effective method, though will be slower for thousands of files due to the file reading. The OP will have to say if speed is a necessary FACTOR. |
|
| 826. |
Solve : Assigning value to variable from another variable? |
|
Answer» Hi, am trying to assign the value to the variable by passing it from another variable. its not WORKING. Below is what am trying to do |
|
| 827. |
Solve : Archive files that haven't been accessed in 18 months? |
|
Answer» Hello, I have to create a script that will : |
|
| 828. |
Solve : DOS Exact String Matching? |
|
Answer» I have a FILE containing lines: |
|
| 829. |
Solve : Launch a program by Batch file? |
|
Answer» Dear all, |
|
| 830. |
Solve : findstr to validate successful run and copy selected lines to archive? |
|
Answer» At the bottom of this post is my input file (sarweekly.log) to findstr. When you post code, use code tags around it - highlight the code and click on the # icon above in the editor.Or you can actually type out the BB CODE tags. [code]Batch code goes here[/code]How do any of your FINDSTR commands make you think it is not searching the file from the beginning of the file? Every time you execute the FINDSTR command it is searching the file from the beginning and looking for your search parameter. Quote from: tommyb on April 18, 2014, 10:26:57 AM 2nd findstr. The 2nd findstr I thought would start over at the beginning How do you know this? Salmon Trout, I say it because I turn set echo on. The first findstr listed every line it searched. The second findstr only listed the on line (which is the next line in the log file). I thought the 2nd findstr was telling me it started where the 1st findstr ended. So please educate me.Golly gee. Considering your first FINDSTR command basically finds most of the lines in your file I guess I can see how that would be confusing. It is going to output what you are searching for. What did you expect FINDSTR to do? Quote from: tommyb on April 18, 2014, 02:27:56 PM The first findstr listed every line it searched. findstr searches the entire file for the text you provide. It can show various things depending on which switches you use, such as The text you provide Lines that do not contain the text you provide Lines of text with the line number at the beginning etc |
|
| 831. |
Solve : Batch File to get Strings? |
|
Answer» Hello All Your example contradicts your description.It's a text file not csv... Quote from: Squashman on April 18, 2014, 08:40:31 PM Your example contradicts your description.He wants the one before the Y and the Y for each Y. EDIT: Try this, it will write to new.txt Code: [Select]echo off if exist new.txt del new.txt setlocal EnableDelayedExpansion for /f "tokens=1-3 delims=," %%A in (test.txt) do ( if "%%C"=="Y" ( if not "!working!"=="" echo "!working!","!a!" >>new.txt set working=%%A ) set a=%%A ) echo "!working!","!a!" >>new.txt pause >nul EDIT 2: Just saw you wanted it in a file, so I edited my code to accommodate.That works fine, Lemonilla Quote from: mtank on April 18, 2014, 08:42:53 PM It's a text file not csv... A CSV file is a text file with Comma SEPARATED Values, with lines like this: v1, v2, v3, v4 This is what you posted as an example: Quote from: mtank I have a big text file like this: Those are comma separated values. That is a csv file, although it may not have a ".csv" extension. Quote from: Geek-9pm on April 18, 2014, 08:04:03 PM Is this a CSV file? If so, why not use a spreadsheet to parse it? Because you would have to click around in the spreadsheet program to get anything done (unless you were so good at scripting you wouldn't be asking here) Powershell has very good csv support, and that is not quite "retro" yet. The last echo doesn't need delayed expansion. You are already out of the code block. Quote from: Squashman on April 19, 2014, 06:35:51 AM The last echo doesn't need delayed expansion. You are already out of the code block.True, ' echo "%working%","%a%" ' would work too, though I don't think there is a difference in performance between the two.Lemonilla you save my life. This code did exactly what i need, THANK YOU! Thanks all the help guys! Quote from: mtank on April 19, 2014, 09:27:56 AM Lemonilla you save my life. This code did exactly what i need, THANK YOU! Thanks all the help guys!Thank you for giving me something to do. I've exhausted all my ideas for scripts awhile AGO. Its good to have a new challenge. |
|
| 832. |
Solve : FOR COMMAND IN DOS BAT FILE? |
|
Answer» I am trying to use MULTIPLE FOR Commands to parse text in 2 text file. Keep all the variables active. Then do a move USING the variables to change the name by combining variables from both parse text file variables. move /y "d:\efiling\acknowledgements\%%L_%%M.%%N" "d:\efiling\acknowledgements\%%A_%%B_%%C_%%D-%%E-%%F %%G-%%H_%%I.%%N" ) since its contained within the nested FOR by the start of the ( from.... Quote for /f "tokens=1-3 delims=_.-: " %%L in (d:\efiling\inprocess\ackfilename.txt) do ( Note: This is untested... also be sure your using enable delayed expansion at the start of your batch. Someone else here might pick up on something else that is a problem as well with this. But unable to test this on work computer = uncertainty with what I gave you for corrections. I think what you really want is a one to one relationship with the two files. I am just assuming this. Otherwise if there is 9 files in your SAR File Name and 9 in your Ack File name you are really only getting 9 output files that are exactly the same as the last file name listed in your Ack File. Really need to see what is in your SAR and ACK Files.HERE IS A SAMPLE EXECUTION WITH ECHO ON. Maybe someone can see why I am getting this error. I parse two text files that each a a unique filename in them. Set each parsed field value to a unique local variable. Build a move to rename a file with parts of the two text files variable values now set to local variable. The problem come on the complex filename (It uses _ - and blank) in it filename. It parses OK. However, when I build the new filename I get added spaces, a missing hour field right after where a REAL space exists in the complex filename. For a rookie my eyes hurt and my brain know it has not enough experience. ANYONE I thank you in advance for the education on command language processing and solving this problem. -----------------------THE EXAMPLE FOLLOWS -------------------------------------------------- D:\EFILING\BIN>rem -- begin archive function -- D:\EFILING\BIN>dir /b d:\efiling\acknowledgements\FINCEN*.* 1>d:\efiling\inprocess\ackfilename.txt D:\EFILING\BIN>for /F "tokens=1-3 delims=_.-: " %L in (d:\efiling\inprocess\ackfilename.txt) do (copy /y "d:\efiling\acknowledgements\%L_%M.%N" d:\efiling\archive\%L_%M.%N ) D:\EFILING\BIN>(copy /y "d:\efiling\acknowledgements\FINCEN_20140130.ACKED" d:\efiling\archive\FINCEN_20140130.ACKED ) 1 file(s) copied. D:\EFILING\BIN>rem -- end archive function -- D:\EFILING\BIN>rem -- begin rename function -- D:\EFILING\BIN>for /F "tokens=1-3 delims=_." %L in (d:\efiling\inprocess\ackfilename.txt) do ( set FI=%L set DT=%M set TY=%N ) D:\EFILING\BIN>( set FI=FINCEN set DT=20140130 set TY=ACKED ) D:\EFILING\BIN>for /F "tokens=1-9 delims=_-: " %A in (d:\efiling\inprocess\sarfilename.txt) do ( set RCM=%A set SAR=%B set FRM=%C set MO=%D set DA=%E set YR=%F set HH=%G set MN=%H set ID=%I ) D:\EFILING\BIN>( set RCM=RCM set SAR=SAR set FRM=Form set MO=01 set DA=23 set YR=2014 set HH=15 set MN=08 set ID=TBSATEST ) D:\EFILING\BIN>move /y "d:\efiling\acknowledgements\FINCEN_20140130.ACKED" "d:\efiling\acknowledgements\RCM _SAR _Form _01 -23 -2014 -08 _TBSATEST.ACKED" 1 file(s) moved. D:\EFILING\BIN>rem -- end rename function -- * * * Quote from: tommyb on April 17, 2014, 11:15:36 AM For a rookie my eyes hurt and my brain know it has not enough experience. It might help to know that to assist the people reading here, it helps to give accurate and full information about what you want to do and also provide the text files (which you can attach to a post). Posting code that doesn't work is seldom helpful, when you don't also include the text being parsed and a full description of the task.Thank you foxidrive for your post. I apologize for not realizing the need for all information. Here are the filename I am parsing and the one line enter they each contain. ackfilename.txt contents: FINCEN_20140130.ACKED sarfilename.txt contents: RCM_SAR_Form_01-23-2014 15-08_TBSATEST I goal is a move command combining the parsed values of each filename. IF I KNOW THE FILENAMES THE FIX POSITION CODE WOULD BE: move /y "FINCEN_20140130.ACKED" "RCM_SAR_Form_01-23-2014 15-08_TBSATEST" Hope this provides reviewer with enough info. I do appreciate anyones opinion. Thank you, The DOS Rookie Test this: it will simply show you the command on the screen - so remove the echo keyword to make it work. Code: [Select]echo off for /f "usebackq delims=" %%a in ("ackfilename.txt") do ( for /f "usebackq delims=" %%b in ("sarfilename.txt") do ( echo move /y "%%a" "%%b" ) ) pause foxidrive, Thank you for that example. It was almost prefect. One little MOD and all is well. Now on to testing my nesting of FIND or FINDSTR. When I get frustrated again, as I expect will HAPPEN, I post. But your experience and advice was a big help. A BIG THANK YOU From, TommyBTalk about over complicating the initial problem.Squashman, What can you expect from a DOS Command language rookie. I am sorry you are . Wait until my next post. |
|
| 833. |
Solve : Batch for comparing values? |
|
Answer» Hi people. I need some help if someone can help me? Need just one more thing here if you are willing to help. I'm glad it helps. When you ask for free help then you should write the whole task out with as much information that you can provide. Asking for more changes once you get some tested code that works means even more work for the people helping you, as they have to change the code that is already written and tested, and then test it again. sorry about that you are right. But that crossed my mind after I tested this. I didn't think about the whole process. Sorry againCan I still hope for help for that?This runs myapp 3 times, then runs mynextapp 3 times, then relaunches the batch file. It only launches the apps if the average figure is less than the figure in compare.txt Code: [Select]echo off :: initialise the app counter files if not exist "app1.txt" type nul >"app1.txt" if not exist "app2.txt" type nul >"app2.txt" if not exist "compare.txt" echo compare.txt is missing&pause&goto :EOF :: If app1 has run 3 times then set the variable to app2 (otherwise set it to app1) find /c "run" <"app1.txt" | find "3" >nul && (set app=app2) || (set app=app1) :: If app2 has run 3 times then remove the counter files and relaunch the batch file find /c "run" <"app2.txt" | find "3" >nul && ( del "app1.txt" "app2.txt" %0 ) :: get the average figure from the last line in the file for /f "usebackq tokens=5 delims=:. " %%a in ("myfile.log") do set avg=%%a echo avg="%avg%" :: get the compare number from the file and if avg is lower, :: increment the counter file and run the app - using the app as defined above. for /f "usebackq delims=" %%a in ("compare.txt") do if %avg% LSS %%a ( if "%app%"=="app1" >>"app1.txt" echo run& start "" "c:\program files\folder\myapp.exe" if "%app%"=="app2" >>"app2.txt" echo run& start "" "c:\program files\folder\mynextapp.exe" ) Thank you, you really made my day today, finally works all like I wanted. Thank you If I can ask for more help here not to opening new topic? I need one mora batch file for copying the newest file from folder login to folder test\new is it possible to have just a PART of path in batch not full path? because I need to make bach fule for each user if it is not possible just part of path. because full path is c:\users\mike\software\screener\database\database2014\office\login c:\users\mike\software\screener\database\database2014\office\test\newOpen a new topic for different questions. They are free. If this is run from the login folder then it will copy the newest file to the new folder SHOWN in your path. Code: [Select]echo off for /f "delims=" %%a in ('dir /b /od /a-d') do set "lastest_file=%%a" copy "%lastest_file%" "..\test\new" Didn't know about opening new topic because on some forums doesn't like to have every question new topic. This batch not working it copy only itself to folder test\new that also is not ok because there must be only one file I runned this from \login folder where batch file should be |
|
| 834. |
Solve : batch for run all bat files? |
|
Answer» I have to try to run all batch files under folder subfolder wih one batch This will launch each batch file in that folder: here nothing happendsAre your batch files in this folder: D:\myfloder\Drivers\conf Quote from: Squashman on April 25, 2014, 01:26:26 PM Are your batch files in this folder: D:\myfloder\Drivers\conf no there must be batch which runs all batch files batch files are under D:\myfloder\Drivers\conf\MIKE\archive\bat but all folders are diferend because are from differend usernames, this one is for MIKE. and there is 30 users and 30 folders which have 30 batch files which needs to be runned Quote from: Blisk on April 25, 2014, 01:36:28 PM no there must be batch which runs all batch filesThen you got your first code example COMPLETELY BACKWARDS as your code is looking for all the batch files in that folder. D:\myfloder\Drivers\conf\)Hmm, If there are 30 users how are we doing to know which one is logged in for the correct directory path? Quote from: Squashman on April 25, 2014, 01:51:27 PM Hmm, this is runned on server and I need to run this batch files Code: [Select]echo off pushd "..\logfiles" for /f "delims=" %%a in ('dir /b /od /a-d ') do set "lastest_file=%%a" copy "%lastest_file%" "..\test\new" popd"Runned is not a word." Does your browser not have spell check. Nor does your reply answer my question. Quote from: Squashman on April 25, 2014, 01:56:30 PM "Runned is not a word." Don't know what you mean with user logged on? Because it is not relevant for this batch files. We need to search copy.bat files in subfolders D:\myfloder\Drivers\conf and after that script will find copy.bat under D:\myfloder\Drivers\conf\MIKE\archive\bat D:\myfloder\Drivers\conf\JOE\archive\bat D:\myfloder\Drivers\conf\NIKE\archive\bat and it will run that copy.bat files So you SAID 30 folders with 30 batch files. That is 900 batch files. You really want to execute 900 batch files?I have no idea what you are trying to accomplish. But this is my take on it. Code: [Select]for /d %%G in (D:\myfloder\Drivers\conf\*) do ( FOR %%H in ("%%G\archive\bat\*.bat") do call "%%H" ) |
|
| 835. |
Solve : Batch file to use list of files and perform an action for each of the files? |
|
Answer» Hello. I have to run a COMMAND line to process one file at a time in Irfanview. My command line looks like this: |
|
| 836. |
Solve : what is meant by this? |
|
Answer» can any one tell me the meaning of this line in detail plz explain each character in detail actually i m new in SCRIPT writing. thx |
|
| 837. |
Solve : Help with creating script that anyone can run in Domain for locked down users.? |
|
Answer» Hi all, |
|
| 838. |
Solve : Listing log file in dd_mm_yy.txt format? |
|
Answer» HI everyone, I want to list log files whose names are changing daily. Like that; C:\log\dd_mm_yy.txt "dd_mm_yy.txt" is changing daily. What kind of a definition I must use in Windows command prompt to list the log file ? Could you PLEASE help me about how can I solve that problem? Best Regards Murat Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved. Quote C:\Users\Dave>dir/? Dir /o *.txt Will list the log files that are saved as text files in numeric/alpha order. You can use sort order to list differently. Code: [Select]C:\log>dir /a-d /b | findstr /R /C:"[0-9][0-9]_[0-9][0-9]_[0-9][0-9].txt" 07_05_14.txt 08_05_14.txt 09_05_14.txt |
|
| 839. |
Solve : files archive with drag and drop? |
|
Answer» Hello, You don't need a loop: The loop allows for no input to be specified until the program runs, otherwise you will run it with %1 equal to nul. Quote from: Lemonilla on May 10, 2014, 11:21:53 PM The loop allows for no input to be specified until the program runs, otherwise you will run it with %1 equal to nul. Yes Lemonilla, the code doesn't allow for input but the thread is all about drag and drop on a batch file. Hi , Thanks all for your help. Both scripts are use-able for me. Only files with spaces in the filename are not archived. How can this be DONE? thanks in advance jromWhich solution did you try? Both Lemonilla's and mine preserve spaces - Lemonilla's code needs a %~1 so that the IF compare doesn't FAIL but the rar terms are quoted. Are you using a modern version of RAR?Both scriptsRAR 5.10 beta 4Try this code and copy/paste the result on the SCREEN here in a reply. Use a filename with spaces. Code: [Select]echo off echo %1 echo rar a -ag[dd-mm-yyyy] "%~n1.rar" "%~dpn1.*" pauseHi foxidrive. This is working correct, now i can also archive files with a space in the filename. Thanks a lot. jromSo what did you change? The only difference in Foxidrive's code was he put an echo statement so we could see the command it would execute without it executing. |
|
| 840. |
Solve : create a batch file? |
|
Answer» Hello, how can i do that with vbscript? If you want exact details then more details about the task are needed. |
|
| 841. |
Solve : .exe versions help? |
|
Answer» Ok i have been tasked with having a swift free antivirus solution for our company. Im using wget to download 3 PROGRAMS to a known folder then using start /wait to RUN through them silently one at a time. One thing i cannot FIGURE out is how can i launch a program when the .exe changes names for each version? Basically the folders will be blank except for a .bat and wget.exe. We upload to CLIENTS computer from out FTP then run the .bat which downloads the programs and executes automatically with no input. |
|
| 842. |
Solve : How do you run a command on a list of files?? |
|
Answer» Hi folks, I'm trying to merge a bunch of geotifs together using FWTools (gdalwarp specifically) but I'd like to first do a "dir /b *.tif > list.txt" on the directory to come up with a file list of the source .tifs. If I paste all the filenames into the command manually the command I need looks like this spread out on a single LINE: |
|
| 843. |
Solve : Filename backup with YYMMDD in filename? |
|
Answer» Hi there, I am trying to create a script to backup a few FILES - I have the backup script written, and it works - but I can't FIGURE out how to put YYMMDD date format into the filename. I've SCOURED Google and I can't find any help. Am I just retarded? Every sript I tried from Google gives me the same thing "MMYYYY". Which isn't what I want, nor what they say should happen. |
|
| 844. |
Solve : Remove lines from text files in a directory (keeping original file name)? |
|
Answer» Can someone help me? I have a directory full of html files, in the html files, I want to remove all LINES that have "xxx This is untested: THANK you... This was right... I was running it in command prompt - so i changed %%a to %a. I didn't want to get prompted on the moving of files, so I added a /Y to the move command... THank you so MUCH. Final command: Code: [Select]echo off for /f "delims=" %a in ('dir *.htm /b /a-d ') do findstr /v /i /c:"<li" "%a" > "%a.tmp" & move /Y "%a.tmp" "%a" |
|
| 845. |
Solve : Copy text from a website, then rename files with it? |
|
Answer» Howdy all |
|
| 846. |
Solve : Batch code help!? |
|
Answer» HELLO, I am trying to create a script which read from a file for example composition.gcode and I want to extract values that starts with X, Y and Z. For example in this file there is a structure like this: Code: [Select]G21 ; set units to millimeters M104 S200 ; set temperature G28 ; home all axes G1 Z5 F5000 ; lift nozzle M109 S200 ; wait for temperature to be reached G90 ; use absolute coordinates G92 E0 M82 ; use absolute distances for extrusion G1 F1800.000 E-1.00000 G92 E0 G1 Z15.350 F7800.000 G1 X152.500 Y152.500 F7800.000 G1 E1.00000 F1800.000 G1 X347.500 Y152.500 E18.37972 F378.000 G1 X347.500 Y347.500 E35.75944 ... G1 X343.831 Y156.169 E733.08114 G1 F1800.000 E732.08114 G92 E0 G1 Z20.350 F7800.000 G1 X347.500 Y152.500 F7800.000 G1 E1.00000 F1800.000 G1 X347.500 Y347.500 E249.28171 F1260 G1 X152.500 Y347.500 E497.56342 ... I want to delete or avoid the lines with ";" and replace in sequence the values for each X, Y and Z like this: Code: [Select]CONST robtarget P1:=[[15.350,152.500,15.350],..... CONST robtarget P2:=[[347.500,152.500,15.350],..... CONST robtarget P3:=[[347.500,347.500,15.350],..... ... CONST robtarget PM:=[[347.500,152.500,20.350],...... ... CONST robtarget Pn:=[[X,Y,Z],..... ... but I tried a LOT of attempts, but no result made... Can someone help me? I also have to generate 2 files (robtarget.txt and movel.txt) that will be included in Mod_%modnum%.mod to generate ABB rapid instructions...! Like this: Code: [Select]MODULE Mod_1234 CONST robtarget P1:=[[x,y,z],.....; ... PROC Routine() ConfL\Off; MoveL P1,v60,z5,mytool\Wobj:=mywobj; ... ENDPROC PROC MainMove() Routine; ENDPROC ENDMODULE The portion of the code I used is: Code: [Select]ECHO off set nomefile=composition.gcode set /a x=0 set /a riga=0 set modnum=1234 set wobj=mywobj set tool=mytool set vel=v60 IF EXIST Mod_%modnum%.mod DEL /f Mod_%modnum%.mod IF EXIST movel.txt DEL /f movel.txt IF EXIST robtarget.txt DEL /f robtarget.txt IF EXIST xresult.txt DEL /f xresult.txt IF EXIST yresult.txt DEL /f yresult.txt IF EXIST zresult.txt DEL /f zresult.txt findstr /n "Z" "%nomefile%" >> zresult.txt findstr /n "X" "%nomefile%" >> xresult.txt findstr /n "Y" "%nomefile%" >> yresult.txt set xval=%xvalnew% set yval=%yvalnew% set zval=%zvalnew% :while if %x% lss 20 ( set /a riga+=1 echo CONST robtarget P%x%:=[[%xval%,%yval%,%zval%],[0.00223,-0.994008,-0.109258,-0.002251],[1,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]; >> robtarget.txt echo MoveL P%x%,%vel%,z5,%tool%\Wobj:=%wobj%; >> movel.txt :: pause>nul set /a x+=1 set /a riga+=1 goto :while ) echo MODULE Mod_%modnum% >> Mod_%modnum%.mod echo. >> Mod_%modnum%.mod copy robtarget.txt >> Mod_%modnum%.mod :: del robtarget.txt echo PROC Routine() >> Mod_%modnum%.mod echo ConfL\Off; >> Mod_%modnum%.mod echo ENDPROC>> Mod_%modnum%.mod echo.>> Mod_%modnum%.mod echo PROC MainMove()>> Mod_%modnum%.mod echo Routine;>> Mod_%modnum%.mod echo ENDPROC>> Mod_%modnum%.mod echo.>> Mod_%modnum%.mod echo ENDMODULE>> Mod_%modnum%.mod Thanks and have a good time! Multi posted - http://www.dostips.com/forum/viewtopic.php?f=3&t=5577 |
|
| 847. |
Solve : File organizing problem? |
|
Answer» Hey everyone. So the example in your first post was incorrect regarding file C and we can in theory just look for files ending in _Part*.txt?Hehe yes but the files that isent in parts, still needs to go into its own folder as well.Clear as mud...Untested as I am POSTING from my phone. Code: [Select]for /f "tokens=1* delims=_" %%G in ('dir /a-d /b *_part*.txt') do ( mkdir "%%~G" 2>nul move "%%~G_%%~H" "%%~G" )That was beautiful it worked PERFECTLY, i had over 20.000 files that needed sorting. All the part files are now grouped perfectly, and the folder names are all correct. You saved me Alot of WORK, thank you very much |
|
| 848. |
Solve : FOR skipping blank iterations? |
|
Answer» I am trying to write some code to edit a single cell of a .csv file. I have it to where it will change the cell, but it will skip writing the empty cells. Any ideas how I can fix this? I believe it has to do with the WAY the FOR loop operates. |
|
| 849. |
Solve : Redirect result from FINDST (or FIND) to COPY, to copy certain files? |
|
Answer» Hello, have a folder with hundreds of text files, but only a hand full have the keyword "glossary"in them. I need to find these files and copy them to another folder.You don't need a batch file to copy a few files. Instead of fretting about tough details, do what you can do. You can make the results into a list. Right? Then edit the list with Notepad and turn it into a batch file list instead of a loop. Suppose I had some files with 'man' in the name. The I might get a list for text files like this: Code: [Select]pacman.txt rayman.txt mandate.txt fatmanhop.txtUsing Notepad, I would put a # at the stat of each line and a $ at the end of the line. Code: [Select]#pacman.txt$ #rayman.txt$ #mandate.txt$ #fatmanhop.txt$Even on a list of up to one hundred items, you can do this rather fast. Humans are like that. I am a human. Next, I would tell notepad to replace every # with the word 'copy' with a space after it. Then back to top, replace every $ with a space and the target path. When the above is done, I save may 'list.txt' files as 'list.bat' and run it as a bat file. The time from concept to finish can be under half an hour. Or, you can spend another day on loops and debugging. The METHOD I use is easier to visualize. Because you see it. And you can do exceptions very easily. one line of code... Code: [Select]for /f "delims=" %%A in ('findstr /i /M "glossary" *.txt') do copy "%%A" "\newfolder\" Code: [Select]for /F "delims=" %%G in ('findstr /i /M "glossary:" *.txt') do copy "%%G" C:\NewFolder Salmon beat me! Quote from: Squashman on July 31, 2012, 11:26:39 AM Salmon beat me! But you gave the more faithful reproduction of the OP's wishes; I overlooked the colon after "glossary". Still, I expect the OP would have figured it out. I want a batch code to search a string exactly like "Interpretation (Interpret) Passed" from a set of HTML files locatind in folders and subfolders and send the files which contain that string to another folder. similarly i wanna even search "Interpretation (Interpret) Failed" and "Interpretation (Interpret) Incomplete" from html files and send to specified folder. i tried with the code mentioned below: echo OFF for /f "delims=" %%f in ('findstr /S/M /C:"Interpretation (Interpret) Failed" *.html') do copy "%%f" C:\\failedreports for /f "delims=" %%f in ('findstr /S/M /C:"Interpretation (Interpret) Incomplete" *.html') do copy "%%f" C:\incompletereports for /f "delims=" %%f in ('findstr /S/M "Interpretation (Interpret) Passed" *.html') do copy "%%f" C:\Passed But this code doesn't work .... Any Help Pls?? Its very urgent Pls help me out Thanks in advance.... The Topic is almost 2 years old... Please start a new Topic if you need a solution...Hi patio, i already created a new post named-''To search and send "Interpretation (Interpret) Passed" Exactly from Html files'' SINCE no one responded there posted here to see if some GURU replies,..... If some1 knows the solution pls reply in that post mentioned above .... Thank u in advance:)***sigh*** |
|
| 850. |
Solve : Batch file - Add subfolders into file names? |
|
Answer» Hi, I have a FOLDER called "Classical Piano MIDIS", which consists of 1-level subfolders and midi files. |
|