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.
| 6801. |
Solve : xcopy and rd command limitation? |
|
Answer» XCOPY in folder C:\test I have 50 folders from Folder1 to Folder50 I want to copy few folders with same name in C:\test2 Code: [Select]xcopy C:\test\Folder3 C:\test2 /y /s /e xcopy C:\test\Folder8 C:\test2 /y /s /e xcopy C:\test\Folder12 C:\test2 /y /s /e it is copying EVERYTHING from Folder3, Folder8 & Folder12 to C:\test2 instead Copying each folder itself. I want to copy those folders with everything inside these to C:\test2 how to do it? is there any other command should be used ? RD Same case (vise versa) with RD command Code: [Select]RD /S /Q C:\test\Folder4 RD /S /Q C:\test\Folder6 RD /S /Q C:\test\Folder15 I want to delete all files and folders inside above folders but don't want to delete folders. I have searched for these answers so much, but no solution found.Testing the issue there are two problems. The target folders NEED a \ at the end, and those same folders have to be specified. I tested this on drive d: Code: [Select]@echo off set drv=d: xcopy %drv%\test\Folder3 %drv%\test2\Folder3\ /y /s /e xcopy %drv%\test\Folder8 %drv%\test2\Folder8\ /y /s /e xcopy %drv%\test\Folder12 %drv%\test2\Folder12\ /y /s /e pause Here is one way to solve the RD folder issue. There are other ways. Code: [Select]@echo off for %%a in (Folder4 Folder6 Folder15) do ( RD /S /Q C:\test\%%a MD C:\test\%%a ) thanks foxidrive xcopy method you told is more than perfect. for single or perticular folders it's ok I want to mix with FOR command say if we have to find a folder(s) named "tobecopied" to destnation folder we can make list as you told in previous post how it will pick folder name itself. Quote from: foxidrive on July 13, 2013, 04:01:43 AM
regading above method, it removing and creating it again, not the perfect solution, but anyway it will serve purpose very well. same case as xcopy, to get list from FOR command and removing those folders having "Check" name in it. I was WONDERING to get 2 things done with one shot. I hope I have EXPLAINED very well, if it's not clear, please reply, I will explain with example. thanksQuote from: novice84 on July 13, 2013, 06:55:45 PM for single or perticular folders it's ok That would depend if the folder to be copied is in the current folder, or if it is somewhere in a folder tree. The simplest code is different for the two cases. Quote from: regading above method, it removing and creating it again, Do you want to copy a set of folders with "Check" in the name, and then remove all files/folders from them but leave the Check folders? Are they in one folder or are they in a directory tree? Where are they being copied to? Please explain the task a little more clearly.Quote from: foxidrive on July 13, 2013, 08:17:23 PM That would depend if the folder to be copied is in the current folder, or if it is somewhere in a folder tree. Please forgive my lack of knowledge, I thought it would be simple with just PUSHD command to change path in any case. well, I have both cases, one to copy from same drive from one location to other, and another case to copy from different drive to C:\somewhere. I prefer to do this now from one drive to another e.g. find folder having name(s) "*ToBeCopied" from C:\reports to D:\archieve\test difficult part could be to find it under directory tree in subfolders keeping the same name Quote from: foxidrive on July 13, 2013, 08:17:23 PM Do you want to copy a set of folders with "Check" in the name, and then remove all files/folders from them but leave the Check folders? Are they in one folder or are they in a directory tree? Where are they being copied to? yes you understood correctly. I prefer to leave original folder tree as it is. Just copy folders to Archieve folder on different drive (in case I need to trace back past history), and delete contents from inside of source folders, leaving folders behind. what I am doing at the moment, I am getting list of folder with For command, which I need to copy/remove inside content. Then copying each folder manually DELETING contents from source folders after that.My question was: are there folders in a tree that have to be copied? and I think from previous posts and your comments that the answer is yes. Try this: Code: [Select]@echo off set "target=D:\archieve\test" set "source=C:\results" set "text=ToBeCopied" setlocal enabledelayedexpansion pushd "%source%" for /f "delims=" %%a in ('dir /b /s /a:d ') do ( set "folder=%%~nxa" if not "!folder:%text%=!"=="!folder!" ( xcopy "%%a\*.*" "%target%%%~pnxa\" /s/h/e/k/f/c pushd "%%a" rd /s /q "%%a" 2>nul popd ) ) popd |
|
| 6802. |
Solve : help with how to make cdrom on windows 3.1? |
|
Answer» hi every ONE, I need some help, I have a an old computer and its runing windows 3.1, what I need help with making the cdrom work on windows3.1 oe make it on dosYou need a cdrom driver for MSDOS and some cdroms require a certain driver, instead of a generic drive. hi every one, I need some help, I have a an old computer and its runing windows 3.1, what I need help with making the cdrom work on windows3.1 oe make it on dos With an IDE drive, you can use various generic drivers. One of the more common is OAKCDROM.SYS. in config.sys, you need to load the driver: Code: [Select]DEVICE=C:\DOS\OAKCDROM.SYS /D:OAKCD (You can use DEVICEHIGH as well). Then you need to use MSCDEX.EXE to associate and 'mount' the driver as a DISK drive: Code: [Select]mscdex /D:OAKCD /L:E Yes, that's good advice there, BC. |
|
| 6803. |
Solve : Problems with command line starting up? |
|
Answer» I recently got infected with a virus and since my antivirus failed, I had to manually clean up the entire thing. I've managed to restore everything except for a reference to the executable file that seems to pop up as soon as I run "cmd.exe". As soon as the COMMAND line is launched, I get an error message indicating that the file I had CLEANED up could not be found for running. I've tried going through the "cmd.exe" structure USING a hex editor but have failed to discover where these instructions have been appended. Could someone please help me here? |
|
| 6804. |
Solve : New DOS user need help with copy command? |
|
Answer» How would you view only the .com files in the C:\windows\system32 directory? |
|
| 6805. |
Solve : Need Batch file assistance? |
|
Answer» I am requesting ASSISTANCE with a batch file I can't SEEM to get working on XP or Windows 7. Below is the contents of the batch file. The main goal of the batch file is to delete some items from several different locations whether it be on Windows 7 or XP Pro. |
|
| 6806. |
Solve : search and get the values into new text file? |
|
Answer» I'm trying to CAPTURE specfic strings from a text file and place them in an excel workbook. I NEED the payment and the chk number side by side so payment in column A and chk num that corresponds to the payment in column B if possbile if not a txt file will be ok. The code i m using now which is below just puts them in a new text file and its not excactly how i want to the file to output. This is what i need from the file. thank again for the tip . Sorry but i realize im going to need a few more things from the file.That has been a common theme on most of the forums i belong to lately. Please explain in more detail what you all need. Please show me an example of a few transactions of input and what you want the output to look like.attached is a new sample. the output need to look like below but does not need all the spaces i placed bewteen each field. i just did that so it would be eaiser to read. i need PAYMENT TOTAL: CHECK/EFT NUMBER: PAYMENT DATE: RUN DATE: PAYERS: located underneath payment date PAYER: located in the smae line as the GPO BOX PAY: located underneath payment date the last two letters after the payer name ex. EMPIRS CC = CC Code: [Select]PAYMENT TOTAL: CHECK/EFT NUMBER: PAYMENT DATE: RUN DATE: PAYERS: PAYER: PAY: 21115.36 0000011331111 06/19/13 06/20/13 EMPIRS CC EMPIR CC 11189.01 0000011221111 06/19/13 06/20/13 HPPPPP HP HPPPP HP 16.18 0000011341111 06/18/13 06/20/13 APPPPA AP APPPP AP 1188.00 0000011441111 06/19/13 06/20/13 EMPIRS CC EMPIR CC 12130.17 0000011541111 06/17/13 06/20/13 EMPIRS CC EMPIR CC 2102.22 0000016411111 06/16/13 06/20/13 APPPPA AP APPPP AP [recovering disk space, attachment deleted by admin]EDITED: This works with your sample text: Code: [Select]@echo off >"newfile.txt" echo PAYMENT TOTAL: CHECK/EFT NUMBER: PAYMENT DATE: RUN DATE: PAYERS: PAYER: PAY: setlocal enabledelayedexpansion for /f "tokens=1,2,3,4,12" %%a in (pcplus.txt) do ( if defined check_eft_number ( >>"newfile.txt" echo !payment_total! !check_eft_number! !payment_date! !run_date! !payers! !payer! !pay! set payment_total= set check_eft_number= set payment_date= set run_date= set payers= set payer= set pay= ) if "%%b"=="DATE:" set payment_date=%%c& set run_date=%%e if "%%c"=="ELECTRONIC" set pay=%%b& set payers=%%a %%b if "%%a"=="GPO" set payer=%%d if "%%b"=="TOTAL:" set payment_total=%%c if "%%b"=="NUMBER:" set check_eft_number=%%c ) PAYMENT TOTAL: CHECK/EFT NUMBER: PAYMENT DATE: RUN DATE: PAYERS: PAYER: PAY: 21115.36 0000011331111 06/19/13 06/20/13 EMPIRS CC EMPIR CC 11189.01 0000011221111 06/19/13 06/20/13 HPPPPP HP HPPPP HP 16.18 0000011341111 06/18/13 06/20/13 APPPPA AP APPPP AP 1188.00 0000011441111 06/19/13 06/20/13 EMPIRS CC EMPIR CC 12130.17 0000011541111 06/17/13 06/20/13 EMPIRS CC EMPIR CC 2102.22 0000016411111 06/16/13 06/20/13 APPPPP AP APPPP AP this works perfect foxidrive thank you so much. btw If you have any free time i would like to understand what occuring in the script if you can write notes to what each line is doing i would REALLY appericate it im just curious how it know where to grab certain string for example the string in the GPO line. thank you all again i really do appericate all the help i recieve in this forum.When you parse a file in a forINdo loop the default delimiter is tab and space. So for each line the spaces and tabs are removed and the remaining 'words' are attached to tokens. You will see that I SPECIFIED tokens 1 to 4 and 12. If you COUNT the words in each line, which are each associated with %%a %%b %%c %%d %%e you can see that the if conditions are checking for a specific word on a specific spot on the line, and if that word is found then it sets a variable to the desired word. When the last item in the set is found check_eft_number it echos all the stored variables on the next loop, and then resets them all to prepare for the next record. So like very many batch files, it is tailored to the format of the text file.Quote from: daillest319 on June 26, 2013, 09:38:41 AM this works perfect foxidrive thank you so much. btw If you have any free time i would like to understand what occuring in the script if you can write notes to what each line is doing i would really appericate it im just curious how it know where to grab certain string for example the string in the GPO line. thank you all again i really do appericate all the help i recieve in this forum.If you turn ECHO ON and watch each line execute it will also help you understand what is going on. And remember in the future to explain everything you need upfront otherwise the code has a tendency to change drastically when you change the parameters. That wastes everyone's time and remember the help is free around here. |
|
| 6807. |
Solve : copy and rename file with path name? |
|
Answer» Hi Foxidrive another problem that I noticed was that you can't change drives with 'cd' You can use the cd command to change to a folder on another drive if you use the /d switch. I always use that switch after cd, it has no effect if the new folder is on the same drive. you are in c:\test, you want to go to D:\pictures\holidays you do this: cd /d D:\pictures\holidays, it is the same as doing first D: and then cd pictures/holidays. Quote from: Salmon Trout on June 29, 2013, 09:01:33 AM I always use that switch after cd, it has no effect if the new folder is on the same drive. That means, more clearly, the /d switch does no harm if the new folder is on the same drive. Quote from: Lemonilla on June 29, 2013, 08:34:25 AM another problem that I noticed was that you can't change drives with 'cd'That was the point of my previous post and told you to read the help for that command. You were not using the correct syntax.Quote from: Squashman on June 29, 2013, 12:53:47 PM That was the point of my previous post and told you to read the help for that command. You were not using the correct syntax.My APOLOGIES, I missed your earlier post. Thank you for pointing it out, could come in handy. |
|
| 6808. |
Solve : DOS batch question on variable addition? |
|
Answer» Hi, is anyone here good at DOS scripts? I am new in dos script and having this simple script that adds the date but it doesn't work as I expected. Any help WOULD be greatly appreciated. |
|
| 6809. |
Solve : Move program files folder in Windows 7 batch file? |
|
Answer» I am looking to create a batch file that can move the program files and program files (x86) folders to another LOCATION. I only intend on using this right after a fresh installation of win 7, so no programs are effected by the move. I know the basic process of doing this in command prompt, but I need to turn this into a batch. Move program files? Yes, I have it done manually on my Win 7 machine. Yes, I think I might have seen a tutorial on making directory symlinks before. I don't think most people use it for program files though, but it works great. There are several reasons why I want to: 1. I like to keep my C: drive containing only the OS because I use it to boot from an SSD and want to conserve space on that drive. 2. If I EVER need to wipe my OS, I can just backup the software reg hive and then reload my OS and copy it back and not have to reinstall my programs (I've not needed to yet, but I think it should work.) 3. I like to keep my files organized on different partitions (mainly just for ease of access and asthetic reasons) The reason I want to make a batch for it is just in case I build more systems for myself or other people. Whenever I build a system, I tend to put a small fast SSD as the OS drive and the data on a slow cheap normal hard drive with more capacity per $.Quote from: Linux711 on June 30, 2013, 07:26:11 PM 2. If I ever need to wipe my OS, I can just backup the software reg hive and then reload my OS and copy it back and not have to reinstall my programs (I've not needed to yet, but I think it should work.) It only works if the programs don't load support DLLs and other files in system32 etc. I've done it and many programs do work, some don't.Quote from: foxidrive on July 01, 2013, 04:08:36 PM It only works if the programs don't load support DLLs and other files in system32 etc. I've done it and many programs do work, some don't.Yeah. Isn't that the point of the WINSXS folder.Quote from: Squashman on July 01, 2013, 07:04:06 PM Yeah. Isn't that the point of the WINSXS folder. I think you are right. |
|
| 6810. |
Solve : Copy the last modified file using batch File? |
|
Answer» Hi any one can help me on my problem?? |
|
| 6811. |
Solve : Solved: How to create a new file out of .bat :Solved? |
|
Answer» Dear Everyone. echo command(s)>hello.bat Thanks that is really works.Just pointing out that MSG doesn't exist on all computers. So if what I'm fairly sure your trying to do is right, it won't work on all computers, and it won't look like a "critical message", etc. Isn't MSG that Carp found in oriental food ? ?Quote from: patio on January 12, 2010, 07:11:22 PM Isn't MSG that Carp found in oriental food ? ?Yep. it had been solved? i though i can solve it. |
|
| 6812. |
Solve : path variable saving? |
|
Answer» Hello, how to save the path variable ? Change it in the control panel area for ALTERING the environment variables. |
|
| 6813. |
Solve : Parsing through a .doc file? |
|
Answer» I was wondering if there is a way to parse a .doc file and capture certain key elements and output them to a file? This is what I ATTEMPTED: |
|
| 6814. |
Solve : Windows Start Up Bat File? |
|
Answer» Hello, |
|
| 6815. |
Solve : split output of commands? |
|
Answer» So I want to write all my input and output from cmd to both the screen and a file. Is this POSSIBLE? |
|
| 6816. |
Solve : Batch not finding file when it should [Fixed]? |
|
Answer» Hi everyone. First post here, so I guess a quick introduction is in order. I'm Vincent, and I'm starting off learning how to make some (basic) .BAT files. I already know some C++ and Java and ActionScript etc., but I still haven't started DOS, heh. Am I correct in assuming that this situation indicates something's very wrong or, more probably, I'm making some really stupid mistake? No, what is stupid is using Batch as a programming tool.. when you don't have too! Quote from: Helpmeh on January 14, 2010, 03:20:14 PM For DIR-ing folders, add a \ at the end to make sure it goes IN the desired folder. For example: Whoops, duh. When I DIR the folder with a backslash I do get its contents in the output. It says that my "first.txt" file is actually "first.txt.txt", which I guess is because I saved the file as "first.txt". I wasn't aware that the batch file would automatically add on the file extension that's usually hidden from view. I think that's the problem all along; lol. Thank you! Problem solved, I'm silly. Thanks for the quick response everyone. Quote I wasn't aware that the batch file would automatically add on the file extension that's usually hidden from view. The command line sees everything. In my opinion only newbies and grandmas hide file extensions. You can fix it in Explorer folder options. I think I'll do that now, heh. Next time though speak up, my HEARING aid's busted. Also, your cookies are ready. Quote from: Vincenator on January 14, 2010, 04:12:21 PM I think I'll do that now, heh. Next time though speak up, my hearing aid's busted. Also, your cookies are ready.Chocolate chip?Of course, with love in every bite.Quote from: Vincenator on January 14, 2010, 10:45:30 PM Of course, with love in every bite.GRANDMA! lol, I'm glad you figured it out. P |
|
| 6817. |
Solve : compact does not work? |
|
Answer» Thanks for taking the time to ready my question. The only thing that happens is that the above line repeats over and over endlessly until I do a Ctrl + c. You called the batch file compact. The batch file ran, looked for a filename called compact and found it in the current folder, so ran your bat again, and again, and again... It's a trap we all fall into at some time. |
|
| 6818. |
Solve : skip specific folder in FOR Command? |
|
Answer» Quote from: Lemonilla on July 04, 2013, 09:20:14 AM Quick question of my own (more addressed to others on the board), why would you not write it all in one place. I wonder if some people prefer doing it the CALL way because they don't like DELAYED expansion for some reason. Quote from: Lemonilla on July 04, 2013, 09:20:14 AM Quick question of my own (more addressed to others on the board), why would you not write it all in one place. You lose the ! characters from the names. It matters for common things like movie names and music titles.Quote from: novice84 on July 04, 2013, 07:30:54 AM 1. but still question remains what if I put any other FOR command or any other command under this code for some different purpose, will it work ? & how it will work ? how separate next code from this. This is a for loop and it calls a subroutine. You can add commands to it but placement is important. try it with the commands below and it might be clearer @echo off :: start here pushd "C:\test\folder" :: this for loop sends each filename to the subroutine for /f "delims=" %%a in ('dir /b /a-d * ') do call :next "%%a" popd :: this is the end of the batch file on the goto :eof echo Done pause goto :eof :next :: for each filename this subroutine is executed echo The file being processed is "%~nx1" set "name=%~nx1" set "name=%name:old=old01%" echo The file is being renamed from "%~1" to "%name%" ren "%~1" "%name%" :: you can add commands to change what it does or to do extra things pause Quote from: 3. another question what is It stops the subroutine being executed one final time, after all the filenames have been sent through the subroutine. Thanks for your comments.questions related to original topic : I am trying to make a list of folders having words in folder name "NEEDtoCheck" It could be complete name of folder or part of folder name. Code: [Select]dir /b /s /a:d | find /I "NEEDtoCheck" > list2.txt above code works fine. But it also includes sub folders. e.g. list look like this : C:\TEST FOLDER\old\this NEEDtoCheck C:\TEST FOLDER\old\this NEEDtoCheck\too second line is unwanted. how not to GET this ? In another batch for some reason I could not get this code working. Code: [Select]pushd "C:\TEST FOLDER" for /D "delims=" %%B in ('dir /b /s /a:d ^| find /I "NEEDtoCheck" ') do echo Check %%~fB>> list2.txt popd pause Thanks all in advanceQuote from: novice84 on July 06, 2013, 03:47:31 AM
Study FOR documentation - type FOR /? at the prompt or else Google for Windows command line & batch syntax guides. You need to start doing this. You are mixing FOR /D and FOR /F syntax. No "options" block allowed with /D switch. It will repeat the options block in an ERROR message, for example like this: "delims=" was unexpected at this time. (Didn't you see this?) FOR /D %variable IN (set) DO command [command-parameters] 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] Quote from: novice84 on July 06, 2013, 03:47:31 AM Code: [Select]dir /b /s /a:d | find /I "NEEDtoCheck" > list2.txt If you study the DIR documentation, (type DIR /? at the prompt) and then look at the switches you are using, (/b /s /a:d) you will understand why sub directories are being listed, and what you need to change or remove. Don't be afraid of experimenting. with all due respect Salmon Trout For command I have not understood yet, as I have just started learning. But I have done experiment with DIR command. Please see complete code (as it is in batch file) below again : Code: [Select]pushd "C:\TEST FOLDER" dir /b /s /a:d | find /I "NEEDtoCheck" > list2.txt popd and results example as below : C:\TEST FOLDER\old\this NEEDtoCheck C:\TEST FOLDER\old\this NEEDtoCheck\too C:\TEST FOLDER\old\this NEEDtoCheckalso C:\TEST FOLDER\old\this also NEEDtoCheck C:\TEST FOLDER\old\this also NEEDtoCheck\too there are no words "NEEDtoCheck" in "too" folder. I put /S to search in subdirectories, if don't put it just search in C:\TEST FOLDER and no result as folder list I need exist in deep down in directories. /a:d I have added to list only folders I hope you will understand my QUESTIONI think there was some misunderstanding with your aim - your descriptions were a little unclear. This seems to be what you are after and it should exclude all the folders that do not have NEEDtoCheck in them. Code: [Select]@echo off pushd "C:\TEST FOLDER" for /f "delims=" %%a in ('dir /b /s /a:d') do ( echo "%%~nxa" | find /I "NEEDtoCheck" >> list2.txt ) popd THANKS FOXIDRIVE & Salmon Trout FOR YOUR HELP IT'S NOT ONLY HELPED TO SAVE TIME BUT ALSO HELPED TO UNDERSTAND NEW THINGS. Quote from: foxidrive on July 06, 2013, 10:38:56 PM I think there was some misunderstanding with your aim - your descriptions were a little unclear. You are right. Sometimes for a NOVICE it's not easy to explain and mix up & mess things. sorry for confusion. Quote from: Salmon Trout on July 06, 2013, 04:22:48 AM It will repeat the options block in an error message, for example like this: "delims=" was unexpected at this time. (Didn't you see this?) I tried to look what's happening but even without @echo off and putting pause at the end of code, screen just blink and I could not see what is error.Quote from: novice84 on July 07, 2013, 05:41:28 AM I tried to look what's happening but even without @echo off and putting pause at the end of code, screen just blink and I could not see what is error. If you start batch scripts from Windows Explorer by double clicking, if the script bombs out you may see nothing. To see error messages etc you can open a command prompt in the folder and start the batch script manually (by typing its name and then hitting ENTER) |
|
| 6819. |
Solve : Copying Files into a Unix enviroment with login? |
|
Answer» I am trying to figure out how to read a list of files to COPY and go through the directory and move those files into a Unix environment which has a login. @bill, the telnet protocol is not meant for "transfer" or "copy" of files automatically. Also, Windows telnet client isn't capable for scripting either.[/color] @ghostdog74: The was no automatic condition by the Original Poster(OP),Grimbear13: Grimbear13 wrote: "I know how to read the list and know how to copy files. I also do know the login information but would like it to prompt you to input the password for security reasons." Grimbear13 would like a prompt for the password. When we prompt a user and wait for a response, there is no automatic transfer at 3AM. Ghostdog74 information might not work? @OP, if you want to do basic file transfer, then it should be alright to use the windows FTP client. Turn on FTP daemon on your Unix machine and then transfer your files from windows. Of course you have to set your FTP configuration properly for security. Also, nowadays, SCP/SSH is used instead of FTP because its more secure. Set up passwordless SSH/SCP using key authentication. Then you WONT have to key in password everytime. Read the SCP/SSH documentation on how to set up key authentication. The last method, using samba, is another alternative. Its sort of like sharing Unix folders to the Windows world. (File sharing.) See the samba documentation for more. Its fairly easy to set up and once set up, you can use normal windows copy to copy your files to Unix. These are 3 methods i can think of, definitely not Telnet. |
|
| 6820. |
Solve : Is there a way to detect a carriage return from user input?? |
|
Answer» Hello, If you hit another letter like G, it handles the error correctly, but it can't handle a carriage return.Both are handled that same way. Why do you say it does not handle the CR correctly? G is not Y or y or N or n. And neither is CR. Anything other than Y y N n loops in INPUT2. Quote from: Geek-9pm on January 14, 2010, 12:46:32 PM Your program looks alright.EDIT: I stand corrected. CR retains the last value.If you have set /p answer=Prompt? and the user hits ENTER, the test "%answer%"=="" returns true No, teh CR does not git a null. gpl got it right. You have to set the thing to a null before you make the test. Only then CR will give null, because it already was null.Quote from: Geek-9pm on January 14, 2010, 03:23:34 PM You have to set the thing to a null before you make the test. You mean like this? Code: [Select]@echo off set answer=&set /p answer=Your input? if "%answer%"=="" ( echo String: ENTER ) else ( echo String: %answer% ) But we need a loop to verify it. set answer=&set /p does clear it to null, otherwise it would retain its prior value when the user hits return Code: [Select]@ECHO QUIT or PARTY @ECHO OFF :PARTY1 set answer=&set /p answer=Your input ? IF "%answer%"=="" ( echo ENTER ) ELSE ( echo %answer% ) if "%answer%"=="PARTY" ( goto PARTY1 ) Thank You!@OP, don't have to make things so complicated. Use an infinity loop. something like this. Code: [Select]:LOOP 1) ask for input 2) if input not "Y", "y","N","n" blah -- goto LOOP 3) else breakHey guys, Thanks for all of the replies and suggestions. gpl's suggestion seemed the simplest to implement. I added the line below exactly where he said to, and the program works perfectly now, thanks to all of you, but special thanks to gpl. Quote from: gpl on January 14, 2010, 12:40:50 PM For anybody who is interested in creating a program to view website address information here is my final version. You'll need to download the WHOIS utility from here http://technet.microsoft.com/en-us/sysinternals/bb897435.aspx Place the WHOIS.exe in the C:\WINDOWS\system32 folder Create a new .txt file on the desktop Paste the code below into the .txt file echo off title WHOIS LOOKUP ::INPUT 1 SCREEN :INPUT1 cls echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. set/p "input1=> ENTER THE WEBSITE ADDRESS > " ::LOOKUP SCREEN :LOOKUP cls WHOIS %input1% pause ::INPUT 2 SCREEN :INPUT2 cls echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. set input2=error set/p "input2=> WOULD YOU LIKE TO LOOK UP ANOTHER ADDRESS? (Y/N?) > " if %input2%==Y goto YES if %input2%==y goto YES if %input2%==N goto END if %input2%==n goto END goto INPUT2 :YES goto INPUT1 :END exit Change the .txt extention to .bat Once you run it, you might want to change the command prompt properties to view it fullscreen. Right-click on the blue title-bar at the top of the command prompt window, select Properties, then the Options tab. Select the Window radial button. Select the Layout tab. Set the Screen Buffer Size: Width to 100, Height to 100. Set the Window Size: Width to 125, Height to 54 Set the Window Position: Width to 0, Height to 0 Those settings seem to fit a 1024 x 768 screen well. Here is an example of what is displayed if you look up www.yahoo.com Whois v1.01 - Domain information lookup utility Sysinternals - www.sysinternals.com Copyright (C) 2005 Mark Russinovich Connecting to COM.whois-servers.net... Connecting to COM.whois-servers.net... Connecting to whois.markmonitor.com... MarkMonitor is the Global Leader in Enterprise Brand Protection. Domain Management MarkMonitor Brand ProtectionΓäó AntiFraud Solutions Corporate Consulting Services Visit MarkMonitor at www.markmonitor.com Contact us at 1 800 745 9229 In Europe, at +44 (0) 20 7840 1300 The Data in MarkMonitor.com's WHOIS database is provided by MarkMonitor.com for information purposes, and to assist persons in obtaining information about or related to a domain name registration record. MarkMonitor.com does not guarantee its accuracy. By submitting a WHOIS query, you agree that you will use this Data only for lawful purposes and that, under no circumstances will you use this Data to: (1) allow, enable, or otherwise support the transmission of mass unsolicited, commercial advertising or solicitations via e-mail (spam); or (2) enable high volume, automated, electronic processes that apply to MarkMonitor.com (or its systems). MarkMonitor.com reserves the right to modify these terms at any time. By submitting this query, you agree to abide by this policy. Registrant: Domain Administrator Yahoo! Inc. 701 First Avenue Sunnyvale CA 94089 US [emailprotected] +1.4083493300 Fax: +1.4083493301 Domain Name: yahoo.com Registrar Name: Markmonitor.com Registrar Whois: whois.markmonitor.com Registrar Homepage: http://www.markmonitor.com Administrative Contact: Domain Administrator Yahoo! Inc. 701 First Avenue Sunnyvale CA 94089 US [emailprotected] +1.4083493300 Fax: +1.4083493301 Technical Contact, Zone Contact: Domain Administrator Yahoo! Inc. 701 First Avenue Sunnyvale CA 94089 US [emailprotected] +1.4083493300 Fax: +1.4083493301 Created on..............: 1995-01-18. Expires on..............: 2012-01-18. Record last updated on..: 2009-12-02. Domain servers in listed order: ns5.yahoo.com ns3.yahoo.com ns2.yahoo.com ns1.yahoo.com ns4.yahoo.com MarkMonitor is the Global Leader in Enterprise Brand Protection. Domain Management MarkMonitor Brand ProtectionΓäó AntiFraud Solutions Corporate Consulting Services Visit MarkMonitor at www.markmonitor.com Contact us at 1 800 745 9229 In Europe, at +44 (0) 20 7840 1300 -- Press any key to continue . . . Pretty cool huh? Well thanks to everybody for the help, and I hope that my little program simplifies looking up website information with the WHOIS utility for somebody out there. |
|
| 6821. |
Solve : autoterminate bat file (FIXED)? |
|
Answer» Hello, I'm new here, I edited the following .bat file to opening bluray films as ISO FILES: |
|
| 6822. |
Solve : Using ms-dos batch file to run programs in a window? |
|
Answer» Does anyone know how to use a MS-DOS batch file to run a GAME that is usually full screen in a window? I've SEEN it done with halo before so I know it's possible. easy,Not always that simple. (and that code won't WORK by the way) Try start /MAX Path_To_Program\Program.exe Quote from: Helpmeh on January 15, 2010, 01:20:11 PM
Ah!! I forgot the /max!!! or /min......Quote from: Helpmeh on January 15, 2010, 01:20:11 PMdo you know why the old topic i had reply will be DIG up front every time? I mean it suppost to be at it original place... example, topic a topic b topic c (i reply the topic c...... and it will be dig up front) topic c topic a topic b Quote from: louis123 on January 17, 2010, 05:56:30 PM do you know why the old topic i had reply will be dig up front every time?The threads are in order of most recent reply (except the stickied threads). |
|
| 6823. |
Solve : Want To Create Shortcut with batch? |
|
Answer» hey guys... hey guys... You are right. The command line is the testing ground for batch. Did the xcopy command work at the command line?: xcopy r11.exe %AllUsersProfile%\desktop\ Place in batch file , mycopy.bat C:\batch>type mycopy.bat xcopy r11.exe %AllUsersProfile%\desktop\ C:\batch> mycopy.bat Quote from: billrich on December 11, 2009, 09:00:40 AM You are right. The command line is the testing ground for batch. No it didnt work it just creates a blank shortcut on desktop without any effect or iconIf the xcopy command does not work from the command line, the xcopy command will not work inside a batch file. The shortcut is an icon for the batch file. ___________ http://www.tnd.com/camosun/elex130/dosbatchtutor1.html Making Batch Files -------------------------------------------------------------------------------- "A batch file is a normal text file, no programming involved. You type DOS commands into a text file, each one on a seperate line. Then, you give the text file a .bat EXTENSION instead of a .txt extension. Now, when you DOUBLE click the batch file(In Windows Explorer) or type its name at the DOS prompt, it will execute the commands. First, we need to know some DOS commands. If you're a regular DOS user, you can skip this section and go to CREATING A BATCH PROGRAM. The main DOS commands we will use are copy, move, del, cls, and echo. The COPY command has this syntax: " copy [source] [destination] . . . a shortcut is a LNK file, and is a completely separate file from it's target. Xcopy, copy, or any such command at the command line will copy the file, not create a shortcut to it.Quote from: billrich on December 11, 2009, 09:45:10 AM If the xcopy command does not work from the command line, theThere was no issue with that, only an issue with the end-result.Quote from: Helpmeh on December 11, 2009, 04:59:10 PM There was no issue with that, only an issue with the end-result. I believe BC gave the perfect explanation of why The_Game_Bane 's method of creating a shortcut did not work. The_Game_Bane was given detailed instructions of how to create shortcut for the batch file. The following command did not work for The_Game_Bane from the command line or from a Batch file: xcopy r11.exe %AllUsersProfile%\desktop\r11.lnk What did work? I don't know. No feedback. Quote from: billrich on December 11, 2009, 05:40:37 PM xcopy r11.exe %AllUsersProfile%\desktop\r11.lnk this command copies r11.exe to the desktop and name it as r11.lnk, which is NOT a shortcut . Its the ORIGINAL file with a new name. That's how it "can't work" if what OP wants is a shortcut, with a LNK extension. http://www.msfn.org/board/creating-shortcuts-installation-time-t29964.html&hl=creat+shortcut Quote from: billrich on December 11, 2009, 06:49:46 PM
From the linked page: Code: [Select][Version] Signature=$CHICAGO$ $CHICAGO$ refers to Win95. The OP has WinXP. If it absolutely has to be batch, there is a batch program in the Windows NT Resource Kit which you can use. Look for Shortcut.exe. Use shortcut /? from the command line for an explanaton of the switches needed. Good luck. there is a software name as XXMKLINK which gurantees to make shortcuts but i dont understand its switches i cud also use that if i cud understoodhave you even tried the various solutions mentioned here? Quote from: ghostdog74 on December 11, 2009, 11:18:46 PM have you even tried the various solutions mentioned here? yes ive tried but smthing or the other goes wrong with me [I think ther solutions r correct, but im not able to apply them] |
|
| 6824. |
Solve : Hide .bat from User on Login? |
Answer» QUOTE from: Helpmeh on January 17, 2010, 06:47:59 AMThat doesn't MEAN you DIG up DEAD topics. so just put back the dead topic. Just IGNORE the topic and it will slip back down again. |
|
| 6825. |
Solve : Handling ! in filenames with SETLOCAL ENABLEDELAYEDEXPANSION? |
|
Answer» Hi there |
|
| 6826. |
Solve : Moving files based on their created date? |
|
Answer» Hi, What happens if the script is not run until 1 Feb, will it not also move files created in Feb? dir /TC *.bat | findstr "01/" (not tested yet. I'm not on my computer.)But 01/ could be the date day as in mm/dd/yyyy 02/01/2010. Also what happens if the users date format is not mm/dd/yyyy but is in some other permissable format, say dd-mm-yyyy? Quote from: Dusty on January 18, 2010, 06:10:18 PM But 01/ could be the date day as in mm/dd/yyyy 02/01/2010. I'm not Thiru, the Original Poster. I cannot answer your questions. Thiru, the Original Poster needs a new design and new solution. Dusty please provide your solution.BillRichardson : I'm not Thiru, the Original Poster. I cannot answer your questions. Thiru, the Original Poster needs a new design and new solution. Dusty please provide your solution. ------------------------------------------------------------------------------------------------------------- Hi all, Thanks to all for your reply. I have "MM/DD/YYYY" date format in my system. And as discussed below, we have confusion between MM and DD... "01" can be month and it can be also date in february month.. So I do not know how to filter... can we use "/01/" as finding string. If it has "/" at both the ends (begining and end), it should be DD only... If it has "/" on the right side end ONLY, it should be MONTH.. Am I making sense? Please correct if it is wrong!! Thanks again. Quote from: thiru can we use "/01/" as finding string. If it has "/" at both the ends (begining and end), it should be DD only... If it has "/" on the right side end ONLY, it should be MONTH.. Think about the actual dates 01/01/2010 and 02/01/2010 in the format mm/dd/yyyy. If /01/ is used as the search argument the day will be found but that's not what you want, if the search argument 01/ is used the month will be found in the first date but again the day will be found in the second date because 01/ exists in that date too as 02/01/2010. What has to happen is that the month part of the date must be identified. I think this is achieved this in the following reply. Fingers crossed.Quote from: Billrich Dusty please provide your solution.Aw darnit, do I have to?? Bit of a rush on this one.. In the following script no allowance is made for paths/filenames containing spaces. The permitted date formats require the month component to be numeric, if the month is expressed as Jan Feb etc the script will fail. The script is not fully tested. If/when the user is satisfied with the script's performance the 4th and 5th lines should be Rem'd and Copy in the ultimate For loop CHANGED to Move. Code: [Select]@echo off cls setlocal enabledelayedexpansion if exist c:\dest\*.* echo y | del dest\*.* > nul if exist c:\dest\ rd c:\dest\ :: Establish date format.. for /f "skip=1 tokens=1-4 delims=(/.-)" %%1 in ('echo. ^| date') do ( set first=%%2 set secnd=%%3 set third=%%4 ) :: Set month position in date format.. if /i %first% equ mm set month=1 if /i %secnd% equ mm set month=2 if /i %third% equ mm set month=3 :: Create output directory if not exist.. if not exist c:\dest\ md c:\dest\ :: Examine file date & copy/move those which fit criteria specified.. pushd c:\new_folder\ for /f %%A in ('dir /b /tc') do ( set datime=%%~tA for /f "tokens=1-3* delims=/.- " %%1 in ("!datime!") do ( if %%%month% equ 1 copy %%A c:\dest\ > nul ) ) popd echo.&echo. :: Display output files for checking purposes.. dir c:\dest\*.* exit /b Hope this helps. Hi Dusty, Yep. You are correct!! 01/01/2010 and 02/01/2010 are the dates that we took for example here. Shall we use IF statement using "AND".... Like this find "01/" but NOT "/01/".. Is this correct? Thanks, Thiru Hi Thiru. Go ahead and try what you suggest if you prefer to use Find which is not one of my FAVORITE tools. Quote from: Dusty on January 19, 2010, 03:30:36 AM Hi Thiru. Dusty, I'm a beginner for Batch Script. However I have used the code which you posted here. Is it working fine? I did not GET any output from it. Please help me. Thanks, Thirulearn how to use vbscript, which is better at date processing and many other stuff. Code: [Select]Set objFS=CreateObject("Scripting.FileSystemObject") Set objArgs = WScript.Arguments strFolder = objArgs(0) strDestination = objArgs(1) Set objFolder =objFS.GetFolder(strFolder) For Each strFile In objFolder.Files strFileName = strFile.Name strDate = strFile.DateLastModified mth=Month(strDate) ' move files in January If mth = 1 Then WScript.Echo "copying .."&strFileName & " " & strDate objFS.MoveFile strFileName , strDestination & "\" & strFileName End If Next save as mymove.vbs and on command line Code: [Select]c:\test> cscript //nologo mymove.vbs c:\test c:\destination Thiru - yes, it's working for me. Hate to ask you, did you set up the input directory with files created in Jan? Found a bug, the dir command in my original script is failing and defaulting to C:\ - code amended. |
|
| 6827. |
Solve : Visual Basic, convert number value to decimal? |
|
Answer» Quote from: BC_Programmer on JANUARY 19, 2010, 02:18:44 PM yeah, SILLY me, since the POST title said "Visual Basic" I foolishly ASSUMED you were using "Visual Basic"Of COURSE! |
|
| 6828. |
Solve : Batch File to open PDF9.0 Copy the content to clipborad open in mspaint n save? |
|
Answer» Hi all, |
|
| 6829. |
Solve : batch file to run with the program only opening once? |
|
Answer» Hello All, my name is todd and this is my first post besides my introduction. great resource here. My issue is that I have a .bat file that RUNS with a .lsp and a .scr file that I run with autocad to purge multiple drawings. It works great but the problem is that it opens autocad runs the routine and closes and then opens again on the next drawing. Is there a way that I can write it to only open autocad once and perform the tasks? An additional question #2 does the .bat , .scr, .lsp files need to be in the same folder that I am performing the processes on? I have TRIED calling to it from another folder location and it doesnt seem to be able to find the file? If it would be helpful I will attach the files that I have so that you can look at them. I appreciate all of your assistance in advance.The files don't have to be in the same location to work correctly. An additional question #2 does the .bat , .scr, .lsp files need to be in the same folder that I am performing the processes on? I have tried calling to it from another folder location and it doesnt seem to be able to find the file? If possible show the complete path to all .exe and data files in the batch files and other files. If that does not work show all paths in the system search path: Path. If that does not work reinstall the main programs. ( some of the paths to .exe and data files might be corrupt. ) good luck.Quote from: macdad- on January 08, 2010, 09:11:12 AM No It shouldn't have a problem going thru the sub-folders but seems that you can open multiple drawings in one window, from here it seems that the multiple file opening is different from previous versions.are you familiar with autocad at all? you want me to post the batch, script, and lisp files that I am using?Yes I am familiar with it. And yes please post atleast the batch scriptQuote from: macdad- on January 13, 2010, 06:07:09 PM Yes I am familiar with it.this is the batch file: MD C:\TEST\DWG\NEWBORDER For %%f in (C:\TEST\DWG\*.dwg) do start /wait C:\"Program Files"\Autodesk\"Acade 2008"\acad.exe "%%f" /b C:\TEST\tsi-D_borderrev.scrYour batch file looks right. But it seems that you can't open a new drawing in ACad from command line(batch script). Please post the Acad Script, from the Acad Script it seems that you can open up another drawing without closing the current Acad window all together.Quote from: macdad- on January 16, 2010, 11:10:38 AM Your batch file looks right.The script is pretty extensive since it updates all the attributes in a title block but here it is: Script: ;THIS SCRIPT WILL ZOOM TO EXTENTS AND CYCLE THROUGH THE ATTRIBUTES ONE AT A TIME WITH THE ABILITY TO CHANGE THEM BY THEIR LOCATION REGARDLESS OF ;WHAT IS THERE FOR TEXT AND MAKE THE REPLACEMENT AS TO WHAT IS PUT INTO THIS SCRIPT ;IT WILL THEN LOAD THE LISP AND SAVE THE UPDATED DRAWING INTO THE NEWBORDER FOLDER AND LEAVE THE ORIGINAL UNCHANGED ;WHEN RUN BY THE BATCH FILE AND INCLUDING THE LISP IT WILL UPDATE THE ATTRIBUTES AND SAVE THE UPDATED DRAWING INTO THE NEWBORDER FOLDER AND LEAVE ;THE ORIGINAL AS IT WAS ;THIS SCRIPT CAN BE MODIFIED TO ADD IN THE X FOR PRELIMINARY OR APPROVED FOR CONSTRUCTION AS WELL ;CREATED BY TODD PERKINS 2009 zoom e ;THE FOLLOWING IS THE SEQUENCE OF EDITING THE ATTRIBUTES ONE AT A TIME THE COMMENTS ARE THE PROMPTS THAT COINCIDE WITH THE COMMAND -attedit ;Edit attributes one at a time y ;Enter block name specification TSI-D ;Enter attribute TAG specification TITLE1 ;Enter attribute value specification THIS USES THE WILDCARD * TO MAKE IT VARIABLE TO WHAT IS THERE FOR TEXT AS THE ATTRIBUTE TO BE CHANGED * ;Expects a point or Window/Last/Crossing/BOX/Fence/WPolygon/CPolygon w ;0,0 SPECIFIES FIRST CORNER 0,0 ;GETVAR SPECIFIES THE OPPOSITE CORNER (getvar "limmax") ;Enter an option [Value/Position/Height/Angle/Style/Layer/Color/Next] v ;Enter type of value modification [Change/Replace] r ;Enter new attribute value FIRST LINE OF TITLE ;AN ENTER IS PLACED HERE AND THEN REPEATS THE PROCESS TO EDIT THE REST OF THE ATTRIBUTES ONE AT A TIME -attedit y TSI-D TITLE2 * w 0,0 (getvar "limmax") v r SECOND LINE OF TITLE -attedit y TSI-D TITLE3 * w 0,0 (getvar "limmax") v r THIRD LINE OF TITLE -attedit y TSI-D SCALE * w 0,0 (getvar "limmax") v r 1:1 -attedit y TSI-D DRAWN * w 0,0 (getvar "limmax") v r TJP -attedit y TSI-D DRAWDATE * w 0,0 (getvar "limmax") v r 00/00/00 -attedit y TSI-D DESIGNED * w 0,0 (getvar "limmax") v r TJP -attedit y TSI-D DESDATE * w 0,0 (getvar "limmax") v r 00/00/00 -attedit y TSI-D ENG1 * w 0,0 (getvar "limmax") v r TJP -attedit y TSI-D ENG1DATE * w 0,0 (getvar "limmax") v r 00/00/00 -attedit y TSI-D ENG2 * w 0,0 (getvar "limmax") v r TJP -attedit y TSI-D ENG2DATE * w 0,0 (getvar "limmax") v r 00/00/00 -attedit y TSI-D MGR * w 0,0 (getvar "limmax") v r TJP -attedit y TSI-D MGRDATE * w 0,0 (getvar "limmax") v r 00/00/00 -attedit y TSI-D DWGNO * w 0,0 (getvar "limmax") v r 10000 -attedit y TSI-D REVNO * w 0,0 (getvar "limmax") v r A -attedit y TSI-D TSIJOB * w 0,0 (getvar "limmax") v r 10000 -attedit y TSI-D TSICADD * w 0,0 (getvar "limmax") v r 10000 -attedit y TSI-D REVNO1 * w 0,0 (getvar "limmax") v r 1 -attedit y TSI-D REVDATE * w 0,0 (getvar "limmax") v r 00/00/00 -attedit y TSI-D REVDESC * w 0,0 (getvar "limmax") v r FOR REVIEW -attedit y TSI-D REVBY * w 0,0 (getvar "limmax") v r TJP -attedit y TSI-D REVAPP * w 0,0 (getvar "limmax") v r TJP -attedit y TSI-D REVNO2 * w 0,0 (getvar "limmax") v r A -attedit y TSI-D ISSUETO * w 0,0 (getvar "limmax") v r CLIENT -attedit y TSI-D ISSUEFOR * w 0,0 (getvar "limmax") v r REVIEW ;THIS IS TO PURGE AND REGENERATE THE DRAWING -purge a * n regen (load "C:\\TEST\\TBUPDATE.LSP") TBUPDATE QUIT Y ** I think I can change the quit here to close but it hasnt worked in the past. As you can see the script file calls the lisp which saves the drawing to a new folder with the same drawing name. but here is the lisp file also. l;THIS LISP IS CREATED TO UPDATE THE DRAWING IN THE SELECTED FILES IN THE SCRIPT AND SAVE THEM INTO THE NEWBORDER FOLDER WITH THE SAME NAME AND ;LEAVE THE ORIGINAL UNCHANGED ;CREATED BY TODD PERKINS 2009 (defun C:TBUPDATE(/ dn pa panbdn) ;THIS LINE DEFINES THE COMMAND TBUPDATE (setq dn (getvar "dwgname")) ;THIS LINE GETS THE NAME OF THE CURRENT DRAWING FILE AND SAVES IT TO A VARIABLE NAMED dn (setq pa (getvar "dwgprefix")) ;THIS LINE GETS THE PATH OF THE CURRENT DRAWING FILE AND SAVES IT TO THE VARIABLE NAMED pa (setq panbdn (strcat pa "NEWBORDER\\" dn)) ;THIS LINE CREATES A NEW PATH BY ADDING NEWBORDER\\ TO THE EXISTING PATHS WHERE DRAWINGS ARE SAVED (command "SAVE" panbdn) ;THIS LINE SAVES THE DRAWING IN THE NEWBORDER FOLDER USING THE SAME DRAWING NAME ) ;THIS LINE CLOSES THE OPENING PARENTHESIS IN THE FILEisp: Alright here we go. Now when you tried the Close command what did it do? |
|
| 6830. |
Solve : Batch or script to rename directories - Please help? |
|
Answer» Hi, directories are like this What is the PATH to the directories you want to rename?this is not important I can map it as I want for example D:\1.2.09\ Try this - not fully tested. Code: [Select]@echo off setlocal enabledelayedexpansion cls :: Syntax: Enter batch script filename followed by the year :: e.g. script 09 :: script 10 for /F "tokens=1-3 delims=." %%1 in ('dir /ad /b d:\*.%1') do ( set mm=%%1 set dd=%%2 set yy=%%3 set infil=d:\!mm!.!dd!.!yy! if !mm! lss 10 set mm=0!mm! if !dd! lss 10 set dd=0!dd! echo.&echo !infil! will be renamed to !yy!.!mm!.!dd! rem ren !infil! !yy!.!mm!.!dd! ) Thank you it works very well. |
|
| 6831. |
Solve : AT command to run task at every 4hrs? |
|
Answer» Dear Experts, i want this task to be run every 4hrs. There are actually two task schedulers on your Win2003 machine. One is the AT command which runs at the NT command line. The other is a Windows version with a GUI. The AT version doesn't SEEMS to have a parameter for a 4 hour interval between job executions , but the GUI does: Accessories==>SYSTEM Tools==>Scheduled Tasks==>Schedule==>Advanced==>Repeat Task where you can set the interval between runs in both minutes and hours. Good luck. |
|
| 6832. |
Solve : Email through DOS prompt.? |
|
Answer» Hi, Hi, Are you really running DOS? If you have a Windows machine you can use VBScript or JSCRIPT. There is a 3rd party product called blat which is similar to the unix sendmail command. There is no native DOS support for email. Hi Sidewinder, Thanks for the info. btw do you have the code in vbscript for sending mail? Thanks, -BobQuote btw do you have the code in vbscript for sending mail Are you kidding? The snippet closet is bottomless. (hmmm, that wording may be a BIT awkward) This is a basic shell to send email with VBScript. Check with your ISP for the actual value of the smtpserver, port and whether you need to use authentication (most of this information is available online). There are other PARAMETERS for attachments, etc. Code: [Select]Set CDO = CreateObject("CDO.Message") CDO.From = CDO.To = CDO.Subject = "Test Email" CDO.Textbody = "Whassup?" CDO.Configuration.Fields.Item("HTTP://schemas.microsoft.com/cdo/configuration/sendusing") = CDO.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = CDO.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = CDO.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = CDO.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = CDO.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = CDO.Configuration.Fields.Update CDO.Send Save the file with a vbs extension and run from the command line as cscript scriptname.vbs PS. There is a special PLACE in *censored* for spammers. |
|
| 6833. |
Solve : Batch file to execute a command in the most recent folder at a specific place? |
|
Answer» Hi All I really really hope this makes sense to someone other then me Not so much. I figure your folder structure looks something like this: Quote workspace Now please explain the source and target of this copy you want to do. Quote I want to create a batch file that will determine which build is most recent (either by build number or date) This is where I get lost. If it's TRUE that build number 2.8_test_4 is more recent than 2.6_test_4, you could sort the folders descending by date, take the first folder in the list and sort the build files descending by date. The file at the top of the list would be the most recent build. Hi Sidewinder The folder structure does indeed look like that with possibly 4 or 5 builds added to each folder daily. What i would like to be able to do is at any point in the day run a batch file that will go and pick up the 'newest' build from each folder and copy these to ANOTHER location, The copy part of the batch file isn't a problem but i need a way for the batch file to determine what the 'newest' build is in each folder regardless of what number that build might be. I understand that this is quite TRICKY due to the way microsoft set there dates but I'm hoping there is a way i can get it to pick up the 'hightest' build number from each folder. does that help any? thanks again aj Quote I understand that this is quite tricky due to the way microsoft set there dates Actually not. The display dates are locally formated by the user. The dates are stored internally in Universal Time Coordinate (UTC) format. Quote What i would like to be able to do is at any point in the day run a batch file that will go and pick up the 'newest' build from each folder and copy these to another location This may help: Code: [Select]@echo off setlocal enabledelayedexpansion for /f "tokens=* delims=" %%v in ('dir e:\workspace /b /a:d') do ( set first=Y for /f "tokens=* delims=" %%x in ('dir e:\workspace\%%v /a:-d /b /o:-d') do ( if !first!==Y copy e:\workspace\%%v\%%x ..... set first=N ) ) Based on your naming convention, be sure not to overwrite any files. The copy statement is incomplete, used for demo purposes. |
|
| 6834. |
Solve : would like to run program source inline? |
|
Answer» HELLO, i WOULD like to create a .bat file that would copy my source into a temporary file and then run that file. for example: right now if have C# program in a file called form.cs and if i run these commands in a .bat file it works fine: csc form.cs form but what i would like to do is run the program the way i currently do it on UNIX, ie something like this: cat > form.cs <<EOF using System; using System.Drawing; using System.Windows.Forms; using System.Data; namespace BindingSourceMultipleForms { public class MainForm : Form { public MainForm() { this.Load += new EventHandler(MainForm_Load); } private BindingSource bindingSource1; private Button button1; private void MainForm_Load(object sender, EventArgs e) { InitializeData(); } EOF form ------------------------------------------- So i'm looking for the DOS command that will encapsulate the source and copy the inline source into a temporary file in essence, ie similar to the UNIX-EOF utility Thanks very much for any pointers or ideas! BobKYou could try this technique 1. delete form.cs if it exists 2. now can use the >> append redirection operator for each source line (simplifies things.) 3. if cannot do above, use > create file redirection operator for first line and >> thereafter BUT - any source line with a & CHARACTER in will cause the command interpreter to bork!! (non-negotiable) e.g. batch code Code: [Select]if exist form.cs del form.cs echo using System;>> form.cs echo using System.drawing;>>form.cs [...] echo {>> form.cs echo InitializeData();>>form.cs echo } >> form.cs csc form.cs form.cs Code: [Select]BUT - any source line with a & character in will cause the command interpreter to bork!! (non-negotiable) so you say that we cant do echo & ?What do you think? (HINT: open a command window and try it.) Quote so you say that we cant do echo & That's correct, but you can use the notation echo ^&. Any character that has meaning in a different context within the shell needs to be escaped with the caret (^). You can even escape the caret itself (^^). Should there be a lot of these characters, your code will look like chicken scratch by the time you're finished! I asked this question in another post but never got a response. Why the batch wrapper? Why not just create form.cs in notepad and use as needed? Adding needless complexities only leads to ERRORS. Sidewinder, you beat me to it regarding escaping the & with a caret. The ampersand (&) has been called the 'poison character' of NT scripting. I believe there are a few situations where escaping is not possible.Yeah, it get really weird with the percent symbol. Using the caret with the % yields nothing, but if you double up with %%, then the results are a single %. Perhaps a KISS certificate should be required of everyone before getting close to a PC. Quote from: Dias de verano on July 22, 2008, 09:54:18 AM What do you think? (Hint: open a command window and try it.) No, i know that i can echo it using ^ char but i was thinking you dont know that Sorry bout that |
|
| 6835. |
Solve : how decrement my var %day%? |
|
Answer» hello |
|
| 6836. |
Solve : incremental backup? |
|
Answer» I want to write a batch file that will create incremental backups of any file i want and which will not delete the originaal file.Does anyone know the process for this please?You can USE either BACKUP or XCOPY. |
|
| 6837. |
Solve : COPY does not support wildcards or directory copies? |
|
Answer» Hi I have this issue which is making me pull my hair out! Can someone please save me from going bald!!! Oh and i cannot defragment my drives even though i have over 15% free space! That's not very muchQuote from: Dias de verano on July 16, 2008, 06:15:34 AM QuoteOh and i cannot defragment my drives even though i have over 15% free space! Thats a sure sign you need to do something about the space. You should get another drive or delete and clean off old files you don't want or need anymore. Quoted: "Try running SFC /SCANNOW (have your system cd to hand) and reloading mobo drivers" How do i do this please? Start>Run type sfc /scannow in the dialog box and hit ok. See here.. As for the motherboard drivers, I'm assuming you have your mobo driver cd available.Ok firstly i located my motherboard CD rom and installed the relevant drivers. The only one that didn't work was the USB 2.0 driver! Here's what happened: i clicked on the install USB 2.0 option and a message box CAME up saying: This program will install "SiS USB Enhanced Host Controller driver" Do you want to continue? Yes or No I selected yes and then i get another box saying: Sis USB 2.0 Host Controller uses the inbox driver in Service Pack 1. Please upgrade to Windows XP Service Pack 1 and rescan for hardware changes in Device Manager I thought had service Pack 2 before all this "bad luck" happened? Secondly, i also tried the RUN solution you advised: sfc /scannow but a command box came up for a fraction of a millisecond then disappeared and nothing happened I know you must be thinking why doesn't this guy just wipe his computer and start from fresh but the truth is, i cant. Not that i dont know how to but a case of most programs installed on my PC i can never get back again. Thanks for your patients Quote I thought had service Pack 2 before all this "bad luck" happened? Well, we don't know what happened, so check what you have got by holding down the Win key and hitting Break to display your System Properties window, it will be shown in the General tab. Quote Secondly, i also tried the RUN solution you advised: sfc /scannow but a command box came up for a fraction of a millisecond then disappeared and nothing happened That should happen, then a notification box should display as shown on the attached file. If that doesn't appear then SFC cannot be run and it LOOKS like you will have to do a Repair install. But first you must try to backup your essential data/program files to cd/dvd/floppy/external drive, whatever you can access. [recovering disk space -- attachment deleted by admin]Ok, i downloaded service pack 2 intalled it and everything went smootly. installed anitvirus and wiped all possible bugs and viruses. i managed to run disk fragmenter. no problem. reseted my computer and now i cannot go inside my C: drive or partitioned D: !!! I get a error box saying "C:/ Access Denied"Please do not double post. |
|
| 6838. |
Solve : Perform action on find? |
|
Answer» Ok, I need a bat file to do the following thing; he must find a certain string in a file (a *.CFG file) and perform an action (SET a var), how can I do that? |
|
| 6839. |
Solve : Copy with bach file help? |
|
Answer» Hello, |
|
| 6840. |
Solve : how to know free space on HD? |
|
Answer» Hi, I make a zip file of 1,5 Gb with a batch file but i need to know before if I have 1,5 Gb free space on HD. |
|
| 6841. |
Solve : Search for files using command prompt? |
|
Answer» 1. Is the batch file in the same folder as the smc file? COMP %smc% valid.c1 /d COMP %smc% valid.c1 /d || goto notsame But why not use fc>nul (no messages or need to PRESS a key) FC %smc% valid.c1 /d>nul || goto notsame |
|
| 6842. |
Solve : Need help with a batch job.? |
|
Answer» HI, Find out the date of job.txt. If the date is yesterdays or TODAY’s date then it needs to tell the file is up to date. if it is lesser than the yesterdays date it should send a mail to the user that it is not up to date. for /F %a in ('dir /b job.txt') do echo %~ta gives the date of the file. How to write the above conditions? Thanks, -BobHow do your file dates show up? Using your code I see file dates like this (non-US date format, non-US (24 hour) time format. 30/07/2008 20:37C:\>echo 07/11/2008 04:16 PM 07/11/2008 04:16 PM I was just trying with that , you can ignore that.OK so you use US date format. The idea is to get yesterday's date, and the filedate, into YYYYMMDD format, i.e. numbers where a later date is ALWAYS greater than an earlier one, then see if the filedate number is less than the yesterday's date number. Code: [Select]@echo off setlocal REM Get yesterday's date into yyyymmdd format call :get_date REM Strip leading zeros from possible octals and decrement the day set /a mm=1%mm%-100, dd=1%dd%-101 if %dd% NEQ 0 goto :add_zeros REM Today is the 1st of the month - decREMent the month REM and set leap year check (ignoring centuries) set /a mm-=1,ly=yy%%4 REM If today is 1 Jan, set date to 31st Dec if %mm% EQU 0 (set /a dd=31, mm=12, yy-=1) else ( REM Calculate days in last month (by Frank Westlake) set /a "dd=5546>>mm&1,dd+=30" REM Special case for February if %mm% EQU 2 if %ly% EQU 0 (set dd=29) else (set dd=28) ) :add_zeros if %dd% LSS 10 set dd=0%dd% if %mm% LSS 10 set mm=0%mm% set /a yestdate=%yy%%mm%%dd% for /f %%a in ('dir /b job.txt') do set fd=%%~ta REM get filedate into yyyymmdd format REM This is for US date format i.e. mm/dd/yyyy set mm=%fd:~0,2% set dd=%fd:~3,2% set yy=%fd:~6,4% set /a filedate=%yy%%mm%%dd% IF %filedate% LSS %yestdate% del jobs.txt goto next REM ------------------------------------------------------------------ :Get_Date REM ------------------------------------------------------------------ REM Generic date parser REM Sets %dd% (01-31), %mm% (01-12) & %yy% (4 digit) if "%date%A" LSS "A" (set toks=1-3) else (set toks=2-4) for /f "skip=1 tokens=2-4 delims=(-)" %%a in ('echo:^|date') do ( for /f "tokens=%toks% delims=.-/ " %%d in ('date/t') do ( set %%a=%%d set %%b=%%e set %%c=%%f set toks= ) ) if %yy% LSS 100 set yy=20%yy% goto :eof :next Thanks for the script. Will check that and update you. Looks like the script deletes the file, if its older than y'day ? But INSTEAD i need to send an email to a person saying its an older file than y'day. can this be done ? Appreciate your help.Substitute the command you would use to send the email for 'del jobs.txt' Quote IF %filedate% LSS %yestdate% del jobs.txt |
|
| 6843. |
Solve : The GNU MS-DOS???? |
|
Answer» Quote This is governed by statutory section 17 USC 302. According to this section, a work that is created (fixed in tangible FORM for the first time) on or after January 1, 1978 is ordinarily given a term enduring for the author's life, plus an additional 70 years after the author's death. In the case of "a joint work" prepared by two or more AUTHORS that was not a "work made for hire," the term lasts for 70 years after the last surviving author's death. For works made for hire, and for anonymous and pseudonymous works (unless the author's identity is revealed in Copyright Office RECORDS), the duration of copyright will be 95 years from publication or 120 years from creation, whichever is shorter. Basically, the copyright still exists, and will exist long after most of us have died. Since laws do change from time to time, different copyrights will expire at different times. Here's a good chart which explains: http://www.copyright.cornell.edu/public_domain/thanks quaxoHelper hasn't been back.maybe another hit n run poster.Quaxo cited US law, and I want to point out that US law does not, and thankfully will not, apply outside the United States. HOWEVER, most countries have copyright laws of some sort. Canada's for example, is nice and verbose. http://www.cb-cda.gc.ca/info/act-e.html#rid-33810Quote from: macdad- on July 29, 2008, 06:16:32 AM maybe another hit n run poster. Sorry I've been gone for 3 days, but as i said in my first post, but the computer at home doesn't have internet connection, and so I'm USING a public computer at the local library.sorry for the false accusation |
|
| 6844. |
Solve : Copy files without copying directories?? |
|
Answer» Here's what I want to do: |
|
| 6845. |
Solve : blinking screen? |
|
Answer» I USE Maxthink a DOS outliner for my writing. It WORKS just fine, EXCEPT on my new Lenovo, when I set the colors in the outliner to the combination I want, the screen blinks when I CHANGE to a FULL screen. I tried resetting the colors in the DOS prompt to see if that would improve things, but it did not. Any help would be appreciated. |
|
| 6846. |
Solve : cant set values inside a for loop?? |
|
Answer» I make a script like this: |
|
| 6847. |
Solve : dos bat file? |
|
Answer» someone is shuting down my win xp pc with the remote shutdown program. |
|
| 6848. |
Solve : Batch file to search for file and execute commands depending on outcome?? |
|
Answer» Right, let me explain. |
|
| 6849. |
Solve : 486 bad com port? |
|
Answer» This ought to tax the memory for you old guys!! This ought to tax the memory for you old guys!! I'd stay up, but it's after supper and I really need some sleep. |
|
| 6850. |
Solve : can't really explain it in the title... plz help? |
|
Answer» how can do do something like this, EX. |
|