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.
| 3551. |
Solve : help with color.? |
|
Answer» how do i make it so that instead of changing just one word instead of having to change color of the whole ms-dos box? how do i change the icon picture for the bat file i made alsothere is some software on the net that allows u to do that PLUS allows u to make tones using ur comp's SPEAKER. heres the address |
|
| 3552. |
Solve : Simple Script Help? |
|
Answer» Hi Guys, |
|
| 3553. |
Solve : % % for USB Thumb Drive for correct path? |
|
Answer» Trying to figure out the correct % % so that a batch program will run correct on any mounted drive letter for the thumb device. Currently I am using Autorun to trigger the batch with thumb device, but was wondering the % % call like %root% which will pick up the correct path of the thumb drive when the batch is started from the thumb drive manually, the batch changes its focus on to the C: drive, then runs a routine at the end on the thumb drive where if you dont know the drive letter mapped for the thumb drive, it will not work. Awesome! They are included in the help for FOR so type FOR /? at the prompt but I will copy them here. They work not just on FOR loop variables but the batch variables %0 (own name) and %1 to %9 (passed parameters). note that the variable %I USED is just an example Code: [Select] %~I - expands %I removing any surrounding quotes (") %~fI - expands %I to a fully qualified path name %~dI - expands %I to a drive letter only %~pI - expands %I to a path only %~nI - expands %I to a file name only %~xI - expands %I to a file EXTENSION only %~sI - expanded path contains short names only %~aI - expands %I to file attributes of file %~tI - expands %I to date/time of file %~zI - expands %I to size of file %~$PATH:I - searches the directories listed in the PATH environment variable and expands %I to the fully qualified name of the first one found. If the environment variable name is not defined or the file is not found by the search, then this modifier expands to the empty string The modifiers can be combined to get compound RESULTS: %~dpI - expands %I to a drive letter and path only %~nxI - expands %I to a file name and extension only %~fsI - expands %I to a full path name with short names only %~dp$PATH:I - searches the directories listed in the PATH environment variable for %I and expands to the drive letter and path of the first one found. %~ftzaI - expands %I to a DIR like output line Dias de verano, using the variable modifiers as you demonstrated will no doubt work very handily in most cases. I am anxious to hear from DaveLembke to see if he got his script working. Please let US know Dave! I had a similar problem that requires a bit more complicated approach. I'm not sure from DaveLembke's post whether he needs the straight forward approach you suggested, or if his situation is more like mine. I have a program that I want to run from the usb drive on several different machines. The problem I run into, occurs because the program I am running "remembers" numerous previous settings relating to drive & path locations. Since the lowest available drive letter is different on each machine, the program would get lost every time I switched machines. Then I had to change numerous settings each time. A real pain! It seemed like a good idea to find a way to search for the thumb drive and substitute the drive path with the letter Z: I have resolved the problem with a very long & cumbersome routine. Although my routine works well, it is very long!!! I am hoping that one of you guys would have a simpler approach. I've been waiting for the right opportunity to ask, and right now seems right. Here is a portion of the routine, that I came up with, so you can see what I am doing. (In order for this to work, the folder being searched for must have a very unique name that won't be found accidentally anywhere else.) Code: [Select] :FIND_DRIVE :: Find your drive letter, then ... :: substitute the drive and path with "Z:" :: [Substitute the "User Program Files" folder(and sub-folders) to a virtual drive "Z:"] :IF_Z_DRIVE if not exist "Z:\User Program Files\Unique Folder\." goto IF_Y_DRIVE goto Z_DRV_ERROR :IF_Y_DRIVE if not exist "Y:\User Program Files\Unique Folder\." goto IF_X_DRIVE subst Z: "Y:\User Program Files" goto PROGRAM :IF_X_DRIVE if not exist "X:\User Program Files\Unique Folder\." goto IF_W_DRIVE subst Z: "X:\User Program Files" goto PROGRAM :IF_W_DRIVE ...... ...... ...... :: NOTE: The four lines were repeated 21 more times to repeat the search for every drive letter through C:. :: All sections were similar except that the first and last section returns an error, rather than substituting a drive letter. :: In this example I wanted to see only the "User Program Files" folder in the virtual drive. If you want to see the entire drive, the subst line would be changed to: subst Z: "Y:\." ... subst Z: "X:\." and so on to indicate the root of the usb drive. ...... ...... ...... :IF_D_DRIVE if not exist "D:\User Program Files\Unique Folder\." goto IF_C_DRIVE subst Z: "D:\User Program Files" goto PROGRAM :IF_C_DRIVE if not exist "C:\User Program Files\Unique Folder\." goto NODRV_ERROR subst Z: "C:\User Program Files" goto PROGRAM By the way, this code does not require that the batch file be located on the usb drive to work. It runs the same located there as when run from a copy on the desktop. If you want to see the whole thing, error MESSAGES and all, I could either post it or attach it as a text file. But... what I am hoping instead is that one of you guys will have a simpler approach. Hello... Thanks for the posted fix ( proper way to accomplish this path issue )...This will work very well for my batch. Unfortunately I am at work and my batch is at home, and I will try to remember to post it over the weekend, so I can show what I am doing to help others who need to do similar routines, who can copy/paste and edit my batch to use as well. And in regards to the last post of "I have a program that I want to run from the usb drive on several different machines. The problem I run into, occurs because the program I am running "remembers" numerous previous settings relating to drive & path locations. Since the lowest available drive letter is different on each machine, the program would get lost every time I switched machines. Then I had to change numerous settings each time. A real pain!" This is exactly the problem I was having. With various systems and one system might mount it as G: and the other F: etc, I tried a band aid approach of finding the route back to the thumb drive by IF EXIST routines for D: thru Z: to find the thumb drives contents to pick back up from, but this was extremely hokey, and the fix that was posted by Dias de verano, which is the better way to accomplish getting back to the source thumb drive will work perfect!!! THANKS SO MUCH Dias de verano Dave |
|
| 3554. |
Solve : Need some help with dos please!? |
|
Answer» Hi there. I have a PROBLEM here with a batch file I am trying to get to work. Well it works but I wanted to add a feature and do not have the slightest IDEA how. Basicaly the line i need help with is pipeing an ECHO into a text file. |
|
| 3555. |
Solve : Does '86' Chipset 16bit Debug still work in WIN32?? |
|
Answer» Or have there been many redesigns of the chips since my WORKING in it in 89. |
|
| 3556. |
Solve : DOS Shell or DOSBOX? |
|
Answer» which do U lke more the ORIGINAL DOS Shell or DOS BOX QuickBasic !!!!!!! I believe that is a compiler for making MS-DOS applications. But I like it too. |
|
| 3557. |
Solve : MEM results excludes TaskMgr processes? |
|
Answer» Why does mem/c results exclude the processes that TaskMgr (ctl-halt-del) GIVES.? |
|
| 3558. |
Solve : passing parameters from one batch file to another? |
|
Answer» Hi. I have to do the following in a batch file: |
|
| 3559. |
Solve : Need Help finding Date from Registry + cmd line.? |
|
Answer» Hi |
|
| 3560. |
Solve : How do I create new files in Batch?? |
|
Answer» Sorry, but I didn't know what to title this so I just titled it what I did. |
|
| 3561. |
Solve : Help with Command Line writing? |
|
Answer» I have a symbol PPT 8846 hand held device running on windows mobile. I just recently downloaded a restore program. This program allows be to enter information I want to be estbalished in the HANDHELD even after a cold reset. |
|
| 3562. |
Solve : Echo a blank line into a .txt file ..??? |
|
Answer» how can i echo a BLANK LINE into a .TXT file ..??
that will do it. hope it helps.in case of short sight, that's echo. |
|
| 3563. |
Solve : Have a Batch file create a directory with the systems date? |
|
Answer» My company has a certification AUDIT coming up and I have to show that I can RESTORE files from our BACKUP solution to each server. I am trying to have arcserve restore the same file to every server however I would like each restore to be placed in a directory with the current date. I can run a batch before the restore takes PLACE but I am having problems creating a directory with the systems date. |
|
| 3564. |
Solve : Why won't this add up right???? |
|
Answer» HI guys, Can anyone tell me why I can't get this to add up right?? It should be a simple set /a answer=%num1% - %num2% I've posted the whole batch file n case I've carried somthing over the ball'sed it up.I've also put ***** next to the line to make it clearer. Code: [Select]@echo off title Frozen h**l color 4f cls cd "C:\dos game\missions" set name=%1 :Mines set errm=Make your selection; :Mmenu cls echo. echo. ==== Frozen h**l - The Mine ==== echo. echo. As you desend into the darkness of the well, on the ladder, one of echo. the rungs break so you move a bit quicker. echo. You reach the floor of the well you find a gas lantern. You pull a echo. lighter from inside in your jacket and light the lantern. echo. echo. As the light fills the well you can see two tunnells leading away into echo. the DISTANCE, one to your right and one straight ahead echo. echo. The tunnell to your right has a track on the floor that looks like it was echo. used for a mine train, but there are no carriages that you can see. echo. echo. The tunnell straight ahead is very narrow, as you take a closer look you echo. can see light at the end of it. echo. %errm% echo. echo. a. Return back to the Ice base echo. echo. b. Take the tunnel to the right echo. echo. c. Take the tunnel in front of you echo. set /p ansm="Make your selection: " if /i "%ansm%" == "a" CALL level1.bat %name% if /i "%ansm%" == "b" goto mb if /i "%ansm%" == "c" goto mc if "%ansm%" == "" set errm=Invaild selection. Please try again && goto Mmenu :mb echo. %ammo% - ammo echo. %health% - health echo. %weapon% - weapon echo. %name% - Player name echo. pause rem Set /a Number=(%Random% %%10)+1 set number=6 set /a loss=15 if /i "%number%" GEQ "5" ( set mess=You have tripped on a loose rail track. You have lost 15%% health!! ***** set /a nhealth=%health% - %loss% ***** echo nhealth=%health% - %loss% // should be 100 - 15 echo newh - %newh% // should be 85 set mess2=You currently have %newh%%% left set health=%nhealth% del "C:\dos game\save data\%name%\Playerinfo.ini" echo Frozen h**l - Player Data >>"C:\dos game\save data\%name%\Playerinfo.ini" echo [Player Information] >>"C:\dos game\save data\%name%\Playerinfo.ini" echo %name% >>"C:\dos game\save data\%name%\Playerinfo.ini" echo. >>"C:\dos game\save data\%name%\Playerinfo.ini" echo [Level] >>"C:\dos game\save data\%name%\Playerinfo.ini" echo 1 >>"C:\dos game\save data\%name%\Playerinfo.ini" echo. >>"C:\dos game\save data\%name%\Playerinfo.ini" echo [Health] >>"C:\dos game\save data\%name%\Playerinfo.ini" echo %health% >>"C:\dos game\save data\%name%\Playerinfo.ini" echo. >>"C:\dos game\save data\%name%\Playerinfo.ini" echo [Ammo] >>"C:\dos game\save data\%name%\Playerinfo.ini" echo %ammo% >>"C:\dos game\save data\%name%\Playerinfo.ini" echo. >>"C:\dos game\save data\%name%\Playerinfo.ini" echo [Current Weapon] >>"C:\dos game\save data\%name%\Playerinfo.ini" echo %weapon% >>"C:\dos game\save data\%name%\Playerinfo.ini" echo. >>"C:\dos game\save data\%name%\Playerinfo.ini" ) set newhm=%health:~0,1% if "%newhm%" == "-" call game_over.bat %name% health %health% echo %newhm% - newhm pause set errm=Make your selection :menu2 cls echo. echo. ==== Frozen h**l - The Mine ==== echo. echo. echo. ** turning right, down tunnell with no light ** echo. echo. echo. echo.%number% GEQ 5 = trip echo. echo. echo. echo. %mess% echo. echo. %mess2% echo. echo. %errm% echo. echo. a. Return back to the base of the ladder echo. echo. b. continue down the dark tunnell echo. echo. echo. set /p ansm="Make your selection: " if /i "%ansm%" == "a" goto mines if /i "%ansm%" == "b" goto 2b :mc echo mc pause exit :2b echo 2b pause exit When I run it, it does everything it should but not the caluclation. the nre varaiable newh is blank. cheers in advance!!Quote Code: [Select]set /a nhealth=%health% - %loss% ***** Well, if you are setting the variable %nhealth% to be %health% - %loss%, and %health% equals 100, and %loss% equals 15, I should expect the variable %nhealth% to equal 85, and I would expect the variable %newh%, which seems to have appeared from nowhere, to be equal to nothing at all (blank). Moral: read your code carefully! hi, I see the mistake, I've corrected it but it hasn't helped. I'm stilling getting nothing in the varaible %nhealth% code now in batch file.. Code: [Select] set /a nhealth=%health% - %loss% echo nhealth=%health% - %loss% // should be 100 - 15 echo nhealth - %nhealth% // should be 85 Cheers for your help.Quote from: blastman on June 29, 2008, 06:07:08 AM hi, echo nhealth - %nhealth% // should be 85 that just leaves nothing. This code Code: [Select] @echo off set /a health=100 set /a loss=15 set /a nhealth=%health% - %loss% echo nhealth=%health% - %loss% // should be 100 - 15 echo nhealth - %nhealth% // should be 85 produces this output Code: [Select]nhealth=100 - 15 // should be 100 - 15 nhealth - 85 // should be 85 Are %nhealth% and %loss% both getting values? yeah, in my code, %loss% is set just before the if statement and %health% has been set from a .ini file in the pervious bacth file (this one was "called" so the varaibles carries over) I reakon the problem might be that when I pull the health ammount in I just "set" it and not "set /a" I'll mod my code now and have a look. Back in bit..... [EDIT;] Na, that hasn't made any difference. I'm gonna post the batch file again, see if anyone can spot the problem.... (like a varaible that means nothing!!!)Right, I've taken the sum code out of the if statement and it works!! I'm gonna reorganise this batch file and post back. hopefully with a working solution!!! Code: [Select]if /i "%number%" GEQ "5" ( set /a nhealth=%health% - %loss% echo nhealth=%health% - %loss% // should be 100 - 15 echo newh - %newh% // should be 85 set mess2=You currently have %newh%%% left set health=%nhealth% ) This is your problem. Just like in a FOR loop, inside the brackets of this IF statement you need to use DELAYED expansion, as %nhealth%, %mess2%, %health%, cannot be used inside the brackets otherwise when you say "delayed expansion" what do you mean?? (so i can understand whats happening) I've now moved everything that happens to a label instead of inside the IF's () cheersI was going to suggest ditching the if with brackets structure and using a jump to a label, but you have beat me to it! You can Google for a more complete explanation of delayed expansion but I will attempt a quick run through here. Basically, when you run a batch file, at run time, cmd.exe expands all variables into their values. You can see this happening if you don't use @echo off at the beginning. So if you had Code: [Select]set var=cat echo %var% you would see Code: [Select]set var=cat echo cat cat OK so far? Now, at runtime, cmd.exe does not expand variables that are in Code: [Select]( brackets like this ) which you find in FOR loops or IF multiline structures like the one in your batch file. Until Windows 2000, the NT batch language was thus crippled. Windows 2000 introduced delayed expansion. You enable it with this statement Code: [Select]setlocal enabledelayedexpansion and you use exclamation signs instead of percent signs for variables created in the brackets. You can use percent signs for them again after the brackets. This won't work the way you want. the variable %cry% will be blank. Code: [Select]set animal=cat if "%animal%"=="cat" ( set cry=meow echo The cry of the %animal% is a %cry% ) The result will be Code: [Select]The cry of the cat is a The variable %animal% is expanded OK because it was set before the brackets, but %cry% is blank. However, this will work. Code: [Select]setlocal enabledelayedexpansion set animal=cat if "%animal%"=="cat" ( set cry=meow echo The cry of the %animal% is a !cry! ) Result will be Code: [Select]The cry of the cat is a meow perfect, I understand completely. Thanks for that. you da man!! |
|
| 3565. |
Solve : setting text file into variables? |
|
Answer» im TRYING to remember how to set multiple line TEXT files into variables, any idea why this wont work? |
|
| 3566. |
Solve : Batch file to unzip multiple files...? |
|
Answer» I have a large number of zip files containing historical data that I need to uncompress. Code: [Select] why not: Code: [Select]for %%P in (jan feb mar apr may jun July Sept Oct Nov Dec) do cd %P&start /wait [emailprotected] .. if the only folders are the month folders, it would be even simpler... Code: [Select]for %%P /D (*) do do cd %P&start /wait [emailprotected] .. Quote from: BC_Programmer on June 27, 2008, 08:15:06 PM Code: [Select]for %%P /D (*) do do cd %P&start /wait [emailprotected] .. Show off!!!! I knew that it could be achived like that, but I wa UNSURE how. Could you break it down for me, what part of the syantx is doing what, so I konw for next time?? cheersoops- there is a mistake there- it should be: Code: [Select]for %%P /D (*) do cd %P&start /wait application_name.exe&cd .. I had do twice, and the @ sign instead of the & before cd .. the For /D command will iterate through all folders that match the given criteria. In this case, all of them (*) for each folder, I execute three commands (separated by &'s), first, change to the dir, then execute the program, then change back to the parent folder (cd ..) |
|
| 3567. |
Solve : basic display question? |
|
Answer» I'm new to DOS, can someone give me the command that will display a directory listing that shows the files one page at a time and ordered by the smallest file up to the largest file, please. Ta.Welcome to CH. I am just amazed that anybody can be facing a test involving command line stuff and they don't know to type yeah, that is a little sad well some people dont want to do it themselves they want to slack off and let other people do it for them. I partly meant that the teacher must be rubbish if they didn't mention that most commands have a /? switch. or even tell them that the help was in the Windows Help Program yet what i dont get is if there are studying DOS then why dont the have a referance GUIDE in book form. i still find the old dos guide that i have for MS-DOS 4 very helpful.Christi-j is gone... Quote from: macdad- on June 27, 2008, 06:31:09 AM *sigh* its another one of those hit n run. they ask you the question, you give them an answer, then they leave not giving you a simple Thank you. nice. |
|
| 3568. |
Solve : How to run a program without opening a new window? |
|
Answer» Hi, speed is only an issue with the /wait solution. My goal is to have a batch that runs commands on MATLAB and FLUENT without opening a new MATLAB or FLUENT window! Thank you! My best shot is to have each of the programs feed the solution file to the other once it's ready! You just lost me! I am not familiar with either program, but I would "guess" that you would have to run one program with the start /wait [/b] command, so that the results file(s) would be available for the second program when it runs. (But that is as I said only a guess.) Your best bet, is to post detailed information on this site, so that one of the guru's(not me) can help you out. If you give Dias enough information, you have a shot at a solution. Note to BC_Programmer: Quote from: BC_Programmer on June 25, 2008, 11:37:30 AM Strange- I only use the start command when I want to load up a document from the command prompt. Why? Well, Start internally calls the ShellExecute (or ShellExecuteEx) APIs, which definitely are not the best way to execute a Program. Rather, I use their direct name, since as far as I can tell command prompt starts processes in that case with the CreateProcess API, which is must faster. So Start wins for FLEXIBILITY, but if your going for speed, directly entering the name is the way to go. Hey BC, You may very well be right about the API issue. I don't have a CLUE about that. I was speaking from my own experience. I had a working batch file in Windows XP, that called up a program as you suggest with just the program name. But ... the batch file failed in windows Vista because it simply would not run the program without the start command. It was then that I also learned about the need to always use the "title". I realize that many people are slow about going to Vista, but I figure that sooner or later, most of us will have to make the switch. Anyway, from that experience, I made the suggestion to always use the start command. Ok, what I want is to create a batch that opens and runs a fluent journal file, like start "" /B /wait fluent -g -i journal_file then, I want that after the journal is read and the results are in a file, created by the journal file, the batch runs the open window of MATLAB to read this file and perform another series of calculations, which it should do with start "" /B /wait matlab -nodesktop results_file and this sequence goes on for an x number of times. The problem is that each of these start comands is opening a new window, it's as if /B wasn't being read! Thanks, IsabelOK, let's forget about the start command for a bit. (Maybe Dias has an idea why the /B is being ignored.) I think we are going to need a LOT more details, if there is any hope for a batch file resolution to your problem. Fluent & Matlab must be DOS programs, Right? Are you running Fluent & Matlab in Windows XP in a CMD window, or in some other version of Windows or DOS? I take it that you can get the results you want, if you run the commands from the CMD window, in the proper sequence, and that now you want to automate the process with a batch file. Right? Can you explain exactly what commands you are using at the command LINE and the PROCEDURE for inputting the data from the results file that works for you(from the command line). Also what do you mean by this: Quote from: IMartins on June 25, 2008, 10:26:28 AM My goal is to have MATLAB give an initial set of conditions to FLUENT, trough a file it writes and that is loaded as the journal, and after FLUENT reads the file and executes the commands, it creates another file, that is "fed" into MATLAB, and they keep doing this in sequence for an x number of times. What is the purpose of "feeding" the data from one program to the other repeatedly, as you describe? I hate to say it, but this all sounds very complicated, and may be very difficult to accomplish, especially, considering the fact that the Matlab forum guys are stuck also. Quote from: IMartins on June 25, 2008, 04:41:15 AM I've seen in a matlab forum that maybe tracking the matlab session id, but neither they nor I have any idea how this can be done! Explain everything you do at the command line in extreme detail, & maybe ..... Also, how about a link to the matlab forum discussing this problem. Hi again, the matlab post link goes below, http://www.mathworks.com/matlabcentral/newsreader/view_thread/165823#421971 Maybe you're right about the complication of the process, but the idea seems quite simple and attainable! Both MATLAB and FLUENT are GUI programs tha also run with a built-in command line, not from DOS. The program is supposed to calculate in MATLAB a set of refrigeration temperatures, record it in a file and then that file is read, with FLUENT, that then simulates a short period of time, to gives a new state of refrigeration, i.e. air properties, that are to be read by MATLAB and then used a new calculation. And this process goes on until the time period of the simulation chosen is through. Was I clear? The file that FLUENT is going to read has simple line instructions, something like: file read-case temperatures_file simulate ... This is then saved as a journal file, an extension .jou that is understood by FLUENT. I've come across a solution to force MATLAB to wait until the files with the results from FLUENT are ready to resume its calculations, but I can't do the same with FLUENT, it doesn't offer those capabilities. So, right now, half of the problem is solved, but I still need FLUENT to run from a batch file that MATLAB is going to write without opening a new window, to resume its previous simulation! Thanks, Isabel |
|
| 3569. |
Solve : Public thanks to those who help me? |
|
Answer» THANKS very much to GuruGary and Carlos. Thanks a lot. I think with your HELP I can be TOMORROW at CLASSROOM with the exercise made. Is not a problem if we can´t SOLVE one of them. Thanks a lot. My best wishes to your lifes |
|
| 3570. |
Solve : I need fast help for my school DOS exercises? |
|
Answer» 2º Make a bat file called help.bat, that can receive any number of parameters (9 maximum). Each parameter will be understand that BELONGS to some MS-DOS command that the user WANTS to obtain help. For that, it will have to show this help in paging form of all the parameters introduced. |
|
| 3571. |
Solve : boot from dos from dvd drive? |
|
Answer» I'm trying to install windows xp from a boot dvd. I've used this dvd on a couple of computers and it's worked great. All you have to do is boot from it and it does the rest. |
|
| 3572. |
Solve : slowing down a dos program in winXP? |
|
Answer» I'm having trouble running MAGIC carpet demo under windows XP, it goes way too fast. |
|
| 3573. |
Solve : Editing a file using a batch file.? |
|
Answer» I have encountered a problem with a number of pc's and need to ADD a few lines into a file. I can get my BATCH file to OPEN the file for editing, but after that I am stuck. |
|
| 3574. |
Solve : Batch file that deletes files after a specif time? |
|
Answer» Ok,..I've been lookin all AROUND for a tool or a script that deletes file after a specific time period. Such as I want to delete all .wav's that are older that two weeks old, from the time the batch runs. Any HELP or direction would be appreicated Batch could probably do this, but laziness wins out every time. This little snippet will age the files: Code: [Select]Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.GetFolder("folderspec") <== Change Set colSubFolders = f.SubFolders For Each objFolder in colSubFolders ShowFiles objFolder Next Sub ShowFiles(Fld) Set k = fso.GetFolder(Fld) Set s = k.SubFolders Set kf = k.Files For Each objFile In kf If UCase(fso.GetExtensionName(objFile)) = "AVI" Then If objFile.DateCreated < date - 14 Then Wscript.Echo objFile & " " & objFile.DateCreated End If End If Next For Each SubFolder In s ShowFiles SubFolder Next End Sub The line marked CHANGE needs a quoted fully qualified foldername. Save the script with a VBS extension and run from the command line as cscript scriptname.vbs. As written, the script will list the files to be deleted. If you like what you see, replace Wscript.Echo objFile & " " & objFile.DateCreated with fso.DeleteFile objfile,True Good luck. 8-)If you do want something in DOS, the following code should work: Code: [Select]@echo off setlocal set DayCnt=14 set DelDir="*.wav" REM ** Date format DD/MM/YYYY for /F "tokens=2-4 delims=/ " %%f in ('date /t') do set dd=%%f&set mm=%%g&set yyyy=%%h REM Substract your days here set /A dd=1%dd% - 100 - %DayCnt% set /A mm=1%mm% - 100 :CHKDAY if /I %dd% GTR 0 goto DONE set /A mm=%mm% - 1 if /I %mm% GTR 0 goto ADJUSTDAY set /A mm=12 set /A yyyy=%yyyy% - 1 :ADJUSTDAY if %mm%==1 goto SET31 if %mm%==2 goto LEAPCHK if %mm%==3 goto SET31 if %mm%==4 goto SET30 if %mm%==5 goto SET31 if %mm%==6 goto SET30 if %mm%==7 goto SET31 if %mm%==8 goto SET31 if %mm%==9 goto SET30 if %mm%==10 goto SET31 if %mm%==11 goto SET30 REM ** Month 12 falls through :SET31 set /A dd=31 + %dd% goto CHKDAY :SET30 set /A dd=30 + %dd% goto CHKDAY :LEAPCHK set /A TT=%yyyy% %% 4 if not %tt%==0 goto SET28 set /A tt=%yyyy% %% 100 if not %tt%==0 goto SET29 set /A tt=%yyyy% %% 400 if %tt%==0 goto SET29 :SET28 set /A dd=28 + %dd% goto CHKDAY :SET29 set /A dd=29 + %dd% goto CHKDAY :DONE if /i %dd% LSS 10 set dd=0%dd% if /I %mm% LSS 10 set mm=0%mm% set _CutOff=%yyyy%/%mm%/%dd% for /f "delims=" %%i in ('dir /b /a-d %DelDir%') do call :CHECK "%%i" %%~ti goto :EOF :CHECK set _ChkDate=%2 set /A _Year=1%_ChkDate:~-2% - 100 if /I %_Year% LSS 40 ( set /A _Year+=2000 ) else ( set /A _Year+=1900 ) set _ChkDate=%_Year%/%_ChkDate:~3,2%/%_ChkDate:~0,2% if %_ChkDate% GTR %_CutOff% goto :EOF echo del %1 Note that the script as-is will jsut tell you what files it is GOING to delete. You need to TAKE the "echo" off of the very last line in the script for it to actually delete the files. |
|
| 3575. |
Solve : dos edit help please? |
|
Answer» Hey all :-? |
|
| 3576. |
Solve : Some Help With Some Code? |
|
Answer» Okay, I got a nintendo 64 emulater and a couple roms. I put the files on to a cd and I made it so it auto boots to a MS DOS window. What I want to happen is, I gave 6 choices of games to play. And when i type the number of the game on the list, i want it to start, but thats not happening... so heres my code... If you could help me out that would be great |
|
| 3577. |
Solve : missing operator error ??? |
|
Answer» When I run this file I get a MISSING operator error- in winxp this error will display once while if i run the same file in NT it continually scrolls- Missing operator - any ideas will be appreciated |
|
| 3578. |
Solve : check for data in a folder using a batch file? |
|
Answer» How can I check for data in a folder using a batch if statement. So basically if folder A has data or directories in it, then do these set of commands, one gotcha here is that I don't know what the name of the data or folders will be???Not being specific about your OS, nor being specific about subfolders of folders, I can only give you a pseudo code outline of how you might go about this: For example, say I have a folder called "Websites". Within this folder are two subfolders "Images" and "html". I want to make a batch file that will reside in the "websites" folder that will rename all extensions in the "html" subdirectory to .htm, and all the images in the "images" directory to .tiff. This part is easy: Code: [Select]ren .\images\*.* *.tiff ren .\html\*.* *.htm This is the part where I got completely CONFUSED: Quote This would be applied on a large scale so switching from one directory to the other by typing in CD directory to the batch file would be impossible. Instead I want the batch file to locate, enter and perform operations within all subdirectories by itself. At some point in time, you will need a pointer to the files to be renamed. With WinXP you should use a script. Batch is vastly underpowered for this type of operation. Judging from your post you would need to walk the directory tree and identify HTML and Images directories before doing any rename operation. Good luck. 8-) |
|
| 3579. |
Solve : Putting the date into a file name? |
|
Answer» I am trying to run a batch file (testfile.cmd) in XP Pro. Inside the batch file, I want to rename a file so that it has the current date attached to the end of the file. Something like this: |
|
| 3580. |
Solve : How to have a MENU in the CONFIG.SYS in DOS 5.0? |
|
Answer» Hi, |
|
| 3581. |
Solve : printing to a usb printer? |
|
Answer» My new computer doesn't have LPT or COM ports, only usb for printing. My old DOS ACCOUNTING program will only print to LPT or COM ports. Can I redirect the print to make my USB printer WORK?The only solution I know of is to print to a file then use Notepad to print the file. The old DOS programs WOULD have to be amended. |
|
| 3582. |
Solve : Trip off the last unknown char from a string? |
|
Answer» I can trip off the last 10 characters from a string without a problem, but when I tried to add a NEW string "\LIB" at the end of the tripped off string "C:\My Documents", there's always a special char at the end of the tripped off string, like "C:\My Documents ", it looks like a space, but I think it's a special char, does anybody knows how to get rid of that space or special char? |
|
| 3583. |
Solve : Exit MS-DOS? |
|
Answer» [size=14]How do I EXIT MS-DOS? I've rebooted my COMP a million and one TIMES, but it continues to default to MS-DOS...Can SOMEONE tell me how I can get it to Windows (I USE Windows 98)....[/size] |
|
| 3584. |
Solve : The notorious B.A.T.C.H.? |
|
Answer» Hey, quick QUESTION... I have been trying all sorts of code to make a batch to run multiple batches, and for some reason I just cant get it. |
|
| 3585. |
Solve : How to Delete rd-only directory with space in name? |
|
Answer» I have a read-only directory that I can NOT delete via standard file/folder view. I am running Windows XP Home Edition. The directoryname is 'Backup 05-25-05'. Can SOMEONE please tell me how to delete this directory with DOS commands? I am having trouble with the directory name being recognized as a SINGLE directory. I have no other directory that BEGINS with Backup, so if allowed, wild card could be used. Thanks in advance!!always PUT quotes AROUND files/directories that might contain spaces, eg |
|
| 3586. |
Solve : finding password? |
|
Answer» Someone told me that there was a way to FIND out the administrator password using COMMAND Prompt. I have found ways to change the password, but I would RATHER not do that. Please tell me if there is a way to do this. |
|
| 3587. |
Solve : OS installation? |
|
Answer» hi guys....can i get some help please? TRYING to re install XP VIA diskette---need help!!!!Tell us the details please. You can load directly from CD. You do not need diskettes. |
|
| 3588. |
Solve : DPMS DOS Protected Mode Services??? |
|
Answer» how do I get out of there or what teh fuk MUST I do to SOMEHOW get out of there?? :-?PERHAPS if you asked your question in a gentler and kinder language and left the lockeroom language where is belongs....in the lockeroom, someone might happen by that would be willing to help you. As far as I'm CONCERNED, I just don't need to deal with this. |
|
| 3589. |
Solve : writing ECHO to a file? |
|
Answer» HI How do I WRITE ECHO to a file from a .BAT file echo on CMD /C e:\Warehousemanager\bin\cron echo >> E:\WarehouseManager\bin\test.txt echo off all I get in the test.txt is ECHO is on. What I want is everything that is echo to screen to be echoed to filetry this echo on >> E:\WarehouseManager\bin\test.txt cmd /c e:\Warehousemanager\bin\cron echo off Graham |
|
| 3590. |
Solve : DOS Command help needed? |
|
Answer» I thought I knew DOS fairly well but I am having trouble with a batch file that was written by someone else and passed to me to run. (That someone is no LONGER with the company) What does the following parameters mean in this line: |
|
| 3591. |
Solve : looking for DOS help..? |
|
Answer» if you are looking for DOS help and your potential towards this...visit www.skillsheaven.com/trouble.php Reseat chips and cables:- You can solve some of the strangest problems(RANDOM hang-ups or errors)by OPENING the case and pressing down on each socketed chip.you should also reseat any cables to make sure that they are MAKING good contact.Right, so you're telling people with virtually no knowledge of PCs to "reseat their chips"?! Are you mad?!www.computerdestroy.com sounds more like itWho was that guy? amit_kumar_ipec...... Please refrain from posting advertisments It could result in you being BANNED from this site. dl65 |
|
| 3592. |
Solve : Make a new batch file(to shutdowncomp)? |
|
Answer» Hi. I am extremely new to batch making. Infact I havn't made one thing YET. Anyway I was wondering if it is possible to make a batch file that will SHUT Down my computer at 12:00 at night. Is this a homework questtion? why do you keep asking people if it is for homework I don't think that a lot of teenagers post here Hey BLACKBERRY. Welcome back. I never said they were teenagers. College students, TECHNOLOGY students, etc. all have the potenial for posting a question for a quick answer rather than doing their homeworrk and reading the text. With the VAST amount of information available on the web and in books, there is no point in reinventing the wheel. One needs to get a litle knowledge before asking questions on the simplest of TOPICS. |
|
| 3593. |
Solve : any input command can replace waiting keyboard? |
|
Answer» Dear friends, |
|
| 3594. |
Solve : Command prompt won't stay open.? |
|
Answer» I recently downloaded a dmg file for my mac (doesn't have cd burner). I need to convert it to iso so i can burn it using my PC (running xp PRO) I downloaded this dmg2iso thing and it should convert it using dos but when i click on it, the command promt window opens quickly then closes as soon as it opens. When i went to open cmd using start then run it didnt work either. it did the same thing. i looked around on the internet and downloaded this thing that deleted some files. i restarted and cmd worked but dmg2iso still won't. i tried it on my other oc and it worked. REALLY CONFUSED...... |
|
| 3595. |
Solve : I would like to display a number in reverse? |
|
Answer» I would like to know how to display a number in reverse using BATCH file programming eg. 20060211 to be displayed as 11206002 |
|
| 3596. |
Solve : quick DOS question? |
|
Answer» Hello, |
|
| 3597. |
Solve : Not ready reading drive x:? |
|
Answer» [size=14] |
|
| 3598. |
Solve : Using batch files to protect Win 98? |
|
Answer» I've put together a couple of batch files that protect the registry, autostart folders and core system files from undesired changes or additions. They're written for Win98 but may ALSO work on WinME. Instead of trying to prevent changes in real time, the first makes backup copies of the files. The second is called during boot before windows STARTS and OVERWRITES the existing files with the backups. |
|
| 3599. |
Solve : Who can explain? |
|
Answer» [SIZE=14]The following lines are from win 98 autoexec.bat [size=14]I have a very big book (bible) [/size] Suggest you begin by reading it. For the third line of your Autoexec.bat file have a look here. Good luck |
|
| 3600. |
Solve : I dont know how to do a batch? |
|
Answer» [size=14]I need a batch I'm using windows xp and as you know if I boot the machine it means DOS Actually we know no such thing. Are you running this batch file in XP to create this bootable CD or in the environment you have booted to? If your batch file runs in XP then there are no errors in either the batch file or the script. If you EXPECT your batch file to run in the booted environment, you can't expect the CD drives to to be referenced as drives S and T. If your batch file runs in the booted environment, the batch file needs to be referenced in the startup file (ie. autoexec.bat for DOS) and the CD drives must be assigned drive letters with the MSCDEX driver. Let us know exactly what you are trying to do. 8-) [size=14][highlight]you can't expect the CD drives to to be referenced as drives S and T.[/highlight] If you chang the D in the following line in Autoexec.bat to what letter you want the first cd rom referenced to the letter you assign, and I'm usually using (s) here is the line LH %RAMD%:\MSCDEX.EXE /D:mscd001 /L: D After changing LH %ramd%:\MSCDEX.EXE /D:mscd001 /L:S When you boot for EXAMPLE win 98 or xp cd it will work from any cd rom because the path of the batches does not referenced to any letter but to %cdrom% Ok how can I do it this way I am using dos 7 files ,98 and xp what will work I will use (some thing will allow me to boot of course in dos) i study 98 , xp and part's cd autoexec.bat but because my knowledge of dos is low level i could not Succeed Thanks [/size]It seems that for any strange reason the drive T: don't is mounted at boot (maybe hardware ?) I haven't installed WXP, but the the command MOUNTOVL works for W2000 Proffesional and later. If you are running the version of MS-DOS for XP, I suppose it will works: C:\Documents and Settings\Administrador>mountvol Crea, elimina o lista la información de un punto de montaje de volumen. MOUNTVOL [unidad:]ruta volumen MOUNTVOL [unidad:]ruta /D MOUNTVOL [unidad:]ruta /L ruta Especifica el directorio NTFS para establecer el punto de montaje volumen Especifica el nombre de volumen que será el destino del punto de montaje /D Quita el punto de montaje de volumen del directorio especificado /L Lista el nombre de volumen montado para el directorio especificado Los valores posibles para "volumen", junto con los puntos de montaje actuales, son: \\?\Volume{f8ed6643-aeca-11d9-acb5-806d6172696f}\ C:\ \\?\Volume{63a6c030-730d-11d3-a2c2-806d6172696f}\ <-- don't mounted *** NO HAY PUNTOS DE MONTAJE *** \\?\Volume{f8ed6645-aeca-11d9-acb5-806d6172696f}\ <-- don't mounted *** NO HAY PUNTOS DE MONTAJE *** \\?\Volume{f8ed6646-aeca-11d9-acb5-806d6172696f}\ D:\ \\?\Volume{f8ed6647-aeca-11d9-acb5-806d6172696f}\ <-- don't mounted *** NO HAY PUNTOS DE MONTAJE *** \\?\Volume{f8ed6648-aeca-11d9-acb5-806d6172696f}\ <-- don't mounted *** NO HAY PUNTOS DE MONTAJE *** \\?\Volume{763b6850-7013-11d3-96f3-806d6172696f}\ E:\ \\?\Volume{34babd31-aebf-11d9-bfb5-806d6172696f}\ <-- I have umounted this vol *** NO HAY PUNTOS DE MONTAJE *** \\?\Volume{f8ed6640-aeca-11d9-acb5-806d6172696f}\ A:\ \\?\Volume{63a6c031-730d-11d3-a2c2-806d6172696f}\ I:\ \\?\Volume{9624f342-aec3-11d9-b444-9b5a09c9f193}\ H:\ You must have the vols S and T, if not, try to mount one of this without mountage point: C:\Documents and Settings\Administrador>mountvol T:\ \?\Volume{34babd31-aebf-11d9-bfb5-806d6172696f}\ C:\Documents and Settings\Administrador>mountvol Crea, elimina o lista la información de un punto de montaje de volumen. MOUNTVOL [unidad:]ruta volumen MOUNTVOL [unidad:]ruta /D MOUNTVOL [unidad:]ruta /L ruta Especifica el directorio NTFS para establecer el punto de montaje. volumen Especifica el nombre de volumen que será el destino del punto de montaje. /D Quita el punto de montaje de volumen del directorio especificado. /L Lista el nombre de volumen montado para el directorio especificado. Los valores posibles para "volumen", junto con los puntos de montaje actuales, son: \\?\Volume{f8ed6643-aeca-11d9-acb5-806d6172696f}\ C:\ \\?\Volume{63a6c030-730d-11d3-a2c2-806d6172696f}\ *** NO HAY PUNTOS DE MONTAJE *** \\?\Volume{f8ed6645-aeca-11d9-acb5-806d6172696f}\ *** NO HAY PUNTOS DE MONTAJE *** \\?\Volume{f8ed6646-aeca-11d9-acb5-806d6172696f}\ D:\ \\?\Volume{f8ed6647-aeca-11d9-acb5-806d6172696f}\ *** NO HAY PUNTOS DE MONTAJE *** \\?\Volume{f8ed6648-aeca-11d9-acb5-806d6172696f}\ *** NO HAY PUNTOS DE MONTAJE *** \\?\Volume{763b6850-7013-11d3-96f3-806d6172696f}\ E:\ \\?\Volume{34babd31-aebf-11d9-bfb5-806d6172696f}\ <-- here is the drive T: T:\ \\?\Volume{f8ed6640-aeca-11d9-acb5-806d6172696f}\ A:\ \\?\Volume{63a6c031-730d-11d3-a2c2-806d6172696f}\ I:\ \\?\Volume{9624f342-aec3-11d9-b444-9b5a09c9f193}\ H:\ [size=14]I don't understand your file Do you think this will work in Ms dos only [/size]You don't HAVE MSDOS. Get your mind around that concept. DOS defaults to one more drive letter than you physically have. Try using the lastdrive=t directive in the config file on the CD bootable OS. Just out of idle curiousity, where did the %ramd% variable come from and why do you need a ramdrive? A basic DOS system can be booted from a single floppy. I'm still not clear what you're trying to do. 8-) |
|