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.
| 551. |
Solve : Help making a bat file to telnet into a server.? |
|
Answer» Hi I am new at this and I just want to know how to set up a .BAT file that will open a telnet session, logon with user name and password. Then at the prompt I would like to exacute the following command trackinv. this is an exe file. Once this file has run I would like to copy the saved date from the server DIRECTORY to my local pc. |
|
| 552. |
Solve : DOS Batch File Parameters? |
|
Answer» Having TROUBLE referencing parameter values in Called Batch File: Anyone have a SOLUTION? |
|
| 553. |
Solve : managing files run on computer? |
|
Answer» managing files that runs on my computer. |
|
| 554. |
Solve : How to insert programer's notes in dos? |
|
Answer» Can someone tell me how to place PROGRAM NOTES into my .bat file? As in text that's there so that people can get an explination, but won't run.Hi! |
|
| 555. |
Solve : Floppy Space? |
|
Answer» okay. i formatted the floppy disk into a boot diskette and i ATTEMPTED to move AMIFLASH and the *.rom into it so i could update my bios. but, now here is where the problem comes in. the floppy does not have enough space! what should i do? |
|
| 556. |
Solve : How to compare two....? |
|
Answer» I'm TRYING to compare two check files I made in my batch FILE for differences, and then output the results to a file. Also I need to specify that line numbers are used in the COMPARISON. Any info is appreciated this maybe WORTH a visit>http://www.robvanderwoude.com/index.html |
|
| 557. |
Solve : Sum of all the numbers in a file using Batch? |
|
Answer» Hello all, |
|
| 558. |
Solve : Trouble setting BATCH default...? |
|
Answer» So, I accidentally set the batch files to open with Notepad++ by default. I NEED them to open regularly, and I CANNOT FIGURE out how to reset it without resetting all defaults. I need everything to stay the same on my computer as-is, except I need the batch files to open regularly. Please help!Open the cmd prompt, and try ENTERING the following: |
|
| 559. |
Solve : Reinstalling Windows Me from Disc in DOS Mode? |
|
Answer» I am TRYING to RESTORE a computer as it was new. I have run the restore disc and I have received the following message: |
|
| 560. |
Solve : mac address???? |
|
Answer» I was just wondering if it is possible for me to change the Mac address of my COMPUTER. http://students.washington.edu/natetrue/macshift/ or this>http://www.soft32.com/download_64505.htmlyo a MILLION thanks, you help me in a tremendous WAY. as I know it is imposible |
|
| 561. |
Solve : Avoid Abort, Retry, Fail on CD "if exist"? |
|
Answer» I want to test if a file exists (by using "IF EXIST" or some other alternate) on a data CD without geting the "Abort, Retry, Fail" message in case I forgot to insert a CD into the CD-drive. Is there a way to do this? |
|
| 562. |
Solve : Embedded File Emergency!? |
|
Answer» [glb][/glb] Not sure if this is what you want or if it will work but try Thank you very much. I knew there would be a way for entering multiple lines of text! [glb]MAY GOD BLESS YOU VERY MUCH![/glb] |
|
| 563. |
Solve : Trying to launch a file through .cmd on remote PC? |
|
Answer» echo off |
|
| 564. |
Solve : Running exe without prompts? |
|
Answer» Hi There |
|
| 565. |
Solve : How do I create a batch file?? |
|
Answer» How do I create a batch file that dose the following Just another oddity of the venerable Batch File It's not an "another oddity", it's just that you don't understand why it happens. If you work as a system administrator, understanding batch is very important. Otherwise, hobbyists should consider learning more about other FORMS of windows scripting options. VbSscript or PowerShell are two. Meanwhile, Salmon Trout is the resident expert on batch. What he says is just the way it is. Question: Are there really educators out there promoting the study of batch as a introductory programming language? Quote from: Geek-9pm on October 15, 2011, 11:20:11 AM Salmon Trout is the resident expert on batch. What he says is just the way it is. ... I wish! Quote from: Salmon Trout on October 15, 2011, 11:22:03 AM ... I wish! Modest as you are...i'd say your one of the best ones...The paradox is I have mostly moved on to other scripting tools for my everyday tasks - Powershell mainly. The thing is, programming is quite simply just translating. Knowing the batch language, or any programming language for that matter, is not something that is easily forgotton. So even though you have moved on to bigger and better languages (which is pretty much any other programming language) your expertise in batch is still APPRECIATED and needed for those who are learning the language, or learning to program. Thank you. To the OP: Why wouldn't you just do a dir a:\u and save yourself the directory changing trouble? Quote from: Raven19528 on October 15, 2011, 02:00:16 PM Why wouldn't you just do a dir a:\u and save yourself the directory changing trouble? Study the wording. The question is clearly a school assignment. So far, the only place where teaching DOS in a Computer Class - has been is the article: Quote Computer Education in Nigerian Secondary SchoolsBut I will keep looking, Somewhere there is a teacher telling students to learn batch programming. He must be told he has given the children a handicap. They use batch and QBasic in lots of countries. India notably. Quote from: Salmon Trout on October 15, 2011, 02:50:18 PM They use batch and QBasic in lots of countries. India notably.Thanks for mentioning that. So do I. But if I say her that they laugh at me. BTW, one of the best books on QB in found in a used book pile in La Paz, Bolivia from a street vendor. And it was in Spanish, of course. I recently had a small problem where I used Qbasic and Batch to rename some files for me. All files in a directory with _+_ near the start of the name would be truncated to remove that part. So I wrote a little code using INSTR and RIGHT$ to chop the names and wrote it out as a batch file to do a bulk rename. Not elegant, but quick. And Qbasic has a debug feature and lets you know if the syntax is wrong. But keep it a secret. Do you use QB64? Quote from: Geek-9pm on October 15, 2011, 04:22:30 PM Do you use QB64? No. I downloaded it out of curiosity, but I found the user interface a nightmare of retro ugliness. I seem to remember it CRASHED. If I want to do anything in that line of country, I'll use FreeBasic. |
|
| 566. |
Solve : Explanation of advanced command? |
|
Answer» I've been reading old threads to figure out how to do something. Whilst there I came across an answer I don't fully understand and would love to know the full explanation. |
|
| 567. |
Solve : Comparing content of a variable with string literal? |
|
Answer» I need to do an If statement based on a variable being EQUAL to a string literal. I didn't think that cmd prompt had the %userprofile% variable until Vista.%userprofile% was introduced in NT4.Thanks again to both of you! Trout - your suggestion makes sense and I've amended my script. GREAT Stuff! |
|
| 568. |
Solve : Help with renaming? |
|
Answer» Hi. I've RECENTLY experimented with multiple ways of renaming image files using the REN command, but I can't seem to get the result I want. For example, I have abc01.jpg abc02.jpg and abc03.jpg, and I want to erase all the "abc" from each image, leaving me with 01.jpg 02.jpg and 03.jpg. I tried using wildcards * but it only gives me 0bc01.jpg 0bc02.jpg and 0bc03.jpg. Can anyone help?I see "David Murphy" is viewing this.... watch out for trolls! Honestly, it's not worth anybody bashing out a script just for a one-off task like that, it just leads to troll activity, that is if you aren't David Murphy yourself anyway. Darn, I already had. Well, not really for this particularly, but a renaming script that allows the user to bulk rename files either with sequential numbering scheme or with standard naming scheme and ability to edit the "non-standard" part of the name. But that's because I have way too much time on my hands and programming is a relaxing activity to me. (And I think I need to see somebody about that.) Quote from: Raven19528 on October 16, 2011, 02:05:02 PM Darn, I already had. Well, not really for this particularly, but a renaming script that allows the user to bulk rename files either with sequential numbering scheme or with standard naming scheme and ability to edit the "non-standard" part of the name. But that's because I have way too much time on my hands and programming is a relaxing activity to me. (And I think I need to see somebody about that.) Go on, post it, it would be interesting. I was going to myself but I saw at the top of the page a hint that that a certain banned troll had possibly signed up under a new name and was viewing the topic. He has a habit of creating multiple user accounts and using one to ask a question and another to "answer" it, often hilariously badly. So some real scripts would be very helpful. I haven't gone back to this code to consolidate and streamline it at all, but it does allow for a lot of flexibility with the renaming scheme. Code: [Select]echo off setlocal enabledelayedexpansion title Renamer v1.1 mode con: cols=61 lines=15 set origdir=%~dp0 set numnam=0 call :targets cls call :startstring cls call :endstring cls :renaming for /f "delims=" %%F in ('dir /s /b %tarstr%') do ( cls set OldFilePathAndName=%%~dpnxF set OldName=%%~nF set OldFilePath=%%~pF set Extension=%%~xF set FileDate=%%~tF call :SetOldFilePath cls echo !OldName!!Extension! in !OldFilePath! folder echo. set /p Continue=Edit this filename {y,n} if /i "!Continue!"=="y" ( call :EditNameSubroutine ) ) cls echo You changed the name of !numnam! files echo You can view the names that were changed echo in the Renamelog.txt file located at echo %origdir% echo. echo Thank you for using Renamer v1.1 echo. ping 1.1.1.1 -n 1 -W 10000>nul goto eof :targets :loop cls echo Is the directory path in the targetdirectory.txt file? set /p yn1={y,n} cls if /i "%yn1%"=="y" ( set /p tardir=<targetdirectory.txt ) else ( echo Type full path of target directory set /p tardir= ) if exist %tardir% ( cd %tardir% ) else ( echo Target does not exist echo PLEASE try again ping 1.1.1.1 -n:1 -w:3000>nul goto loop ) echo Is there a target string you want to enter? set /p yn2={y,n} if /i "%yn2%"=="y" ( echo. echo Type target string for renaming set /p tarstr=[Target] set tarstr="*!tarstr!*" cls goto addtarstrques ) else ( set tarstr=* goto eof ) :addstring cls set /p addstr=[Target] set addstr="*%addstr%*" set tarstr=%addstr% %tarstr% echo Searching for strings: %tarstr% :addtarstrques echo. echo Is there an additional string you wish to look for? set /p yn3={y,n} if /i "%yn3%"=="y" goto addstring goto eof :startstring :startloop cls echo Is there a standard starting string echo to the naming convention? set /p yn4={y,n} if /i "%yn4%"=="y" ( cls echo Enter standard start string echo [Include an ending space if desired] echo. set /p startstr= ) else ( set startstr= goto eof ) echo The current start string is "%startstr%" echo Is this okay? set /p yn5={y,n} if /i "%yn5%"=="n" ( set startstr= goto startloop ) goto eof :endstring cls echo Is there a standard ending string to the naming convention? set /p yn5={y,n} if /i "%yn5%"=="n" ( set endstr= goto eof ) cls echo Would you like the end string to echo include the date the file was created set /p DateEnd=[y,n] cls if /i "%DateEnd%"=="y" call :DateEndFormatting cls echo Would you like the end string to include echo today's date set /p yn6={y,n} cls echo Enter standard end string echo [Include spaces if desired] set /p origendstr= if /i "%yn6%"=="y" call :DateTodayFormatting if "%DateEnd%"=="y" set origendstr=%origendstr%[date created] echo The current end string is "%origendstr%" echo Is this okay? set /p yn7={y,n} if /i "%yn7%"=="n" ( set origendstr= goto endstring ) if /i "%DateEnd%"=="y" set origendstr=%origendstr:~0,-14% goto eof :DateEndFormatting echo In what format would you like the echo date to appear: echo. echo 1. dd Mmm yy echo. echo 2. yyyymmdd echo. echo 3. Mmm dd, yyyy echo. echo 4. mm/dd/yy echo. echo 5. More... echo. set /p DateEndForm=Selection {1-5}- if "%DateEndForm%"=="5" goto more goto dateendskip :more cls echo 6. dd Mmm yyyy echo. echo 7. yy/mm/dd echo. echo 8. mm/dd/yyyy echo. echo 9. yymmdd echo. set /p DateEndForm=Selection {6-9}- :dateendskip goto eof :DateTodayFormatting echo In what format would you like the echo date to appear: echo. echo 1. dd Mmm yy echo. echo 2. yyyymmdd echo. echo 3. Mmm dd, yyyy echo. echo 4. mm/dd/yy echo. echo 5. More... echo. set /p DateTodayForm=Selection {1-5}- if "%DateTodayForm%"=="5" goto more goto settodayform :more cls echo 6. dd Mmm yyyy echo. echo 7. yy/mm/dd echo. echo 8. mm/dd/yyyy echo. echo 9. yymmdd echo. set /p DateTodayForm=Selection {6-9}- :settodayform if "%date:~4,2%"=="01" set todaymonth=Jan if "%date:~4,2%"=="02" set todaymonth=Feb if "%date:~4,2%"=="03" set todaymonth=Mar if "%date:~4,2%"=="04" set todaymonth=Apr if "%date:~4,2%"=="05" set todaymonth=May if "%date:~4,2%"=="06" set todaymonth=Jun if "%date:~4,2%"=="07" set todaymonth=Jul if "%date:~4,2%"=="08" set todaymonth=Aug if "%date:~4,2%"=="09" set todaymonth=Sep if "%date:~4,2%"=="10" set todaymonth=Oct if "%date:~4,2%"=="11" set todaymonth=Nov if "%date:~4,2%"=="12" set todaymonth=Dec if "%DateTodayForm%"=="1" set origendstr=%origendstr%%date:~7,2% %todaymonth% %date:~12% if "%DateTodayForm%"=="2" set origendstr=%origendstr%%date:~10%%date:~4,2%%date:~7,2% if "%DateTodayForm%"=="3" set origendstr=%origendstr%%todaymonth% %date:~7,2%, %date:~10% if "%DateTodayForm%"=="4" set origendstr=%origendstr%%date:~4,6%%date:~12% if "%DateTodayForm%"=="6" set origendstr=%origendstr%%date:~7,2% %todaymonth% %date:~10% if "%DateTodayForm%"=="7" set origendstr=%origendstr%%date:~12%/%date:~4,5% if "%DateTodayForm%"=="8" set origendstr=%origendstr%%date:~4% if "%DateTodayForm%"=="9" set origendstr=%origendstr%%date:~12,2%%date:~4,2%%date:~7,2% goto eof :DateEndSet if "!FileDate:~0,2!"=="01" set month=Jan if "!FileDate:~0,2!"=="02" set month=Feb if "!FileDate:~0,2!"=="03" set month=Mar if "!FileDate:~0,2!"=="04" set month=Apr if "!FileDate:~0,2!"=="05" set month=May if "!FileDate:~0,2!"=="06" set month=Jun if "!FileDate:~0,2!"=="07" set month=Jul if "!FileDate:~0,2!"=="08" set month=Aug if "!FileDate:~0,2!"=="09" set month=Sep if "!FileDate:~0,2!"=="10" set month=Oct if "!FileDate:~0,2!"=="11" set month=Nov if "!FileDate:~0,2!"=="12" set month=Dec if "%DateEndForm%"=="1" set endstr=%origendstr%!FileDate:~3,2! !month! !FileDate:~8,2! if "%DateEndForm%"=="2" set endstr=%origendstr%!FileDate:~6,4!!FileDate:~0,2!!FileDate:~3,2! if "%DateEndForm%"=="3" set endstr=%origendstr%!month! !FileDate:~3,2!, !FileDate:~6,2! if "%DateEndForm%"=="4" set endstr=%origendstr%!FileDate:~0,6!!FileDate:~8,2! if "%DateEndForm%"=="6" set endstr=%origendstr%!FileDate:~3,2! !month! !FileDate:~6,2! if "%DateEndForm%"=="7" set endstr=%origendstr%!FileDate:~8,2!!FileDate:~0,5! if "%DateEndForm%"=="8" set endstr=%origendstr%!FileDate:~0,10! if "%DateEndForm%"=="9" set endstr=%origendstr%!FileDate:~8,2!!FileDate:~0,2!!FileDate:~3,2! goto eof :SetOldFilePath set OldFilePath=!OldFilePath:~-25,-1! :filepathloop echo !OldFilePath! | find "\" >nul if errorlevel 1 goto eof set OldFilePath=!OldFilePath:~1! goto filepathloop :setcaps set NewName=!NewName:A=a! set NewName=!NewName:B=b! set NewName=!NewName:C=c! set NewName=!NewName:D=d! set NewName=!NewName:E=e! set NewName=!NewName:F=f! set NewName=!NewName:G=g! set NewName=!NewName:H=h! set NewName=!NewName:I=i! set NewName=!NewName:J=j! set NewName=!NewName:K=k! set NewName=!NewName:L=l! set NewName=!NewName:M=m! set NewName=!NewName:N=n! set NewName=!NewName:O=o! set NewName=!NewName:P=p! set NewName=!NewName:Q=q! set NewName=!NewName:R=r! set NewName=!NewName:S=s! set NewName=!NewName:T=t! set NewName=!NewName:U=u! set NewName=!NewName:V=v! set NewName=!NewName:W=w! set NewName=!NewName:X=x! set NewName=!NewName:Y=y! set NewName=!NewName:Z=z! :caps cls echo !NewName! echo. set /p caps=How many capital letters? if "!caps!"=="0" goto eof for /l %%i in (1,1,!caps!) do ( cls echo Capital LETTER %%i echo !NewName! echo 012345678911111111112222222222333333333344444444445555555555 echo 01234567890123456789012345678901234567890123456789 set /p capoff=At Position- set /a endcap=!capoff!+1 call set before=%%NewName:~0,!capoff!%% call set capletter=%%NewName:~!capoff!,1%% call set after=%%NewName:~!endcap!%% set capletter=!capletter:a=A! set capletter=!capletter:b=B! set capletter=!capletter:c=C! set capletter=!capletter:d=D! set capletter=!capletter:e=E! set capletter=!capletter:f=F! set capletter=!capletter:g=G! set capletter=!capletter:h=H! set capletter=!capletter:i=I! set capletter=!capletter:j=J! set capletter=!capletter:k=K! set capletter=!capletter:l=L! set capletter=!capletter:m=M! set capletter=!capletter:n=N! set capletter=!capletter:o=O! set capletter=!capletter:p=P! set capletter=!capletter:q=Q! set capletter=!capletter:r=R! set capletter=!capletter:s=S! set capletter=!capletter:t=T! set capletter=!capletter:u=U! set capletter=!capletter:v=V! set capletter=!capletter:w=W! set capletter=!capletter:x=X! set capletter=!capletter:y=Y! set capletter=!capletter:z=Z! set NewName=!before!!capletter!!after! ) cls echo !NewName! echo. echo Are there any additional caps needed? set /p yn14={y,n} if /i "%yn14%"=="y" goto caps goto eof :EditNameSubroutine :editname cls echo !OldName! echo 012345678911111111112222222222333333333344444444445555555555 echo 01234567890123456789012345678901234567890123456789 echo. set /p NameStart=Enter Start Position- set /p NameEnd=Enter End Position- set /a NameLength=1+!NameEnd!-!NameStart! if /i "%DateEnd%"=="y" call :DateEndSet else set endstr=%origendstr% call set NewName=%%OldName:~!NameStart!,!NameLength!%% cls echo !NewName! echo Would you like to make changes to this part echo {Start and end strings will be added later} echo. set /p yn10={y,n} if /i "!yn10!"=="y" ( call :setcaps cls echo !NewName! echo. echo Would you like to insert anything into the name set /p yn8={y,n} if /i "!yn8!"=="y" call :insertsubroutine cls echo !NewName! echo. echo Would you like to remove anything from the name set /p yn12={y,n} if /i "!yn12!"=="y" call :removesubroutine ) cls echo !NewName! echo. echo Do you need to make any other changes? echo. set /p yn15={y,n} if "%yn15%"=="y" goto editname set NewName=!startstr!!NewName!!endstr!!Extension! cls echo. echo !NewName! echo. echo Is this correct set /p yn9={y,n} if /i "!yn9!"=="y" ( echo !NewName! from !OldName!!Extension! >>%origdir%\Renamelog.txt ren "!OldFilePathAndName!" "!NewName!" set /a numnam=!numnam!+1 ) else ( cls echo Would you like to try again echo. set /p yn12={y,n} if /i "!yn12!"=="y" goto editname ) goto eof :insertsubroutine :insertsub cls echo !NewName! echo 012345678911111111112222222222333333333344444444445555555555 echo 01234567890123456789012345678901234567890123456789 echo To the **right** of what position would echo you like to insert the string? set /p strpos=Right of Position- echo What would you like to insert set /p stradd=[String] call set NewName=%%NewName:~0,!strpos!%%!stradd!%%NewName:~!strpos!%% cls echo !NewName! echo. echo Is there anything else that needs to be added set /p yn11={y,n} if /i "!yn11!"=="y" goto insertsub goto eof :removesubroutine :removesub cls echo !NewName! echo 012345678911111111112222222222333333333344444444445555555555 echo 01234567890123456789012345678901234567890123456789 echo What are the start and end positions echo of the string to be removed? echo. echo Note that the start position should be echo the last character that you want to stay echo and the end position the last character echo you want deleted echo. set /p remstpos=Start Position- set /p remenpos=End Position- call set NewName=%%NewName:~0,!remstpos!%%%%NewName:~!remenpos!%% cls echo !NewName! echo. echo Do you need to remove anything else set /p yn13={y,n} if /i "!yn13!"=="y" goto removesub goto eofOf course that one is very long and complex to help allow for a lot of different USES with renaming. For what you are trying to do, try this: Code: [Select]echo off setlocal enabledelayedexpansion set seq=1 for /f "delims=" %%a in ('dir *.png /s /b') do ( set newname=0!seq!.png set newname=!newname:~-6! ren %%a !newname! set seq+=1 ) This only allows for 100 files to be renamed this way in a single directory, if you are wanting to have more, just change the number of zeros in the first "set newname" command and change the number in the second newname command. |
|
| 569. |
Solve : Dos executables? |
|
Answer» is there a program that will convert .cpp files into .exe files? |
|
| 570. |
Solve : create a list of files? |
|
Answer» Folder InPut on desktop is having 3 files.. Code: [Select]echo off That will give you a full directory output, but I don't think that is what the OP is looking for. Try adding /b the dir command to shorten things up. Also, not all batchers are going to know where "..\File.txt" is going to show up, so make it a little more obvious: dir /b > %userprofile%\desktop\File.txt Quote from: Raven19528 on October 24, 2011, 10:56:39 AM not all batchers are going to know where "..\File.txt" is going to show up They will soon (if they are the sort who are worth helping!) and especially if you tell them that two DOTS and a slash like this ..\ means "the directory one level up from where you are" and that you can stack them to go all the way up the tree. I knew exactly what the code I posted would do. But thank you for clarifying it for me. While I may be pretty INTELLIGENT, I don't necessarily communicate WELL. |
|
| 571. |
Solve : net send.... help!? |
|
Answer» HI my friend thought it would be funny to run a batch FILE to net send me loads of messages, but made his batch file so that the messages were under a false name. he refuses to TELL me what the code was to MAKE it anonymous. i already KNOW how to make a batch file that sends loads of net send messages....... but how do i make them anonymous? any help is much appreciated!chuck fadanoid.....with friends like that ...who needs enemies .....lol. With all due respect , why would we tell you how to create spam or unwanted messages..... Sorry .... dl65 |
|
| 572. |
Solve : function keys don't seem to be handshaking on new computer running DOS program? |
|
Answer» I have an old 386 computer that runs a DOS program for a test machine I have. I had the hard drive CLONED over to a newer machine with PS/2 keyboard CONNECTIONS.. Everything seems to work fine except there is one program that I need to run to download some software to my test machine and it requires the use of the function keys. When I use the F2 key on the new cloned computer it returns an error " VAL string isn't a proper number" |
|
| 573. |
Solve : Capture error/and output of commands to log file? |
|
Answer» I'd like to be able to capture all error output generated from a dos batch file (regardless of error generated) |
|
| 574. |
Solve : how to use expression in for loop? |
|
Answer» Hi Guys, I know the statement "set /A count = %count% + 1" is not correct but don't know how to fix it. set /A count=%count%+1 set /A count+=1 are equivalent but in a loop you need to USE delayed expansion (exclamation marks instead of percent signs) in the long form set /A count=!count!+1 (best to omit spaces) (google for zillions of explanations) Quote from: Salmon Trout on October 17, 2011, 08:22:20 AM set /A count=%count%+1 Set /A count=count+1 is also equivalent both inside and outside of a loop, delayed expansion not necessary for a Set /A command LINE.. A little demo: Code: [Select]echo off setlocal cls for /l %%1 in (1,1,20) do ( set /a count=count+1 set /a cntr=cntr+1 set /a number=count+cntr ) set /a number=number+100 echo Number=%number% Quote from: Dusty on October 19, 2011, 12:57:35 AM Set /A count=count+1 is also equivalent both inside and outside of a loop, delayed expansion not necessary for a Set /A command line.. Right. You can use both the long and short form set /a notations in a loop without delayed expansion, and the final value after the loop is exited will be correct, but delayed expansion is definitely necessary if you want to, er, expand the variable inside the loop. |
|
| 575. |
Solve : Function Keys AT type keyboard vs PS2 keyboard? |
|
Answer» I have an older piece of test equipment that runs a program out of DOS originally loaded on an AT type PC. I had a clone made of the harddrive on a newer machine that uses a PS2 KEYBOARD instead of the OLD AT (large round 5 pin keyboard connector) keyboard. Everything seems to work fine except the F1 - F6 keys do not function with the PS2 keyboard. Is there a fix or workaround?Just a thought - have you tried using the old keyboard with an adapter? I know that has worked for us in the past here at work on some of our DOS machines.I just tried using the old AT style keyboard + adaptor to PS2 no luck. That was definately worth a try. I wonder if it COULD be anything to do with the way the GRAPHICS are displayed? |
|
| 576. |
Solve : Window positioning? |
|
Answer» Is there anyway to have a batch FILE start another and have that window open at a specific point on the screen. I'm trying to have a batch file open three others, one as a banner at the top of the screen and the other two on either side of the screen. In the START options, it MENTIONS you can start a program minimized or maximized, but it says nothing about positioning on the screen. Is it something I can write into the other batch files? Is it possible to do within batch? |
|
| 577. |
Solve : Seaching for documents by an owner? |
|
Answer» Hi there, |
|
| 578. |
Solve : Using find to Search files in Different directories for a string? |
|
Answer» Hello I have a windows directory structure that contains some logs I want to search. With in the logs folder there is user1...user2... sub folders. I would like to point to the top level "logs" folder and have the .bat file search the subfolders automatically. Right now I have to point to the user folder. Here is the code I have |
|
| 579. |
Solve : Batch works, but token arguement looks wrong?? |
|
Answer» So I put together this batch with some help from google, and I changed it to GET the output I wanted which was the 3 letter Day instead of 10/25/2011. I REPLACED the "tokens=*" with "tokens=3" and end up with what I want, BUT I dont think I am using this token arguement correctly as for even placing values of 1 and 8 in 3's place I still get the same result. I am guessing that I am misinterpreting the token arguement even though I am getting the result I want. I assumed that the token arguement was to specify how many character places on the line or range to read in on the line. So when i put in 1, I expected to see just a T for Tue and when using 8 I expected to see Tue 10/2. I FEEL I am way off on my understanding of the token arguement and someone here will point out where I am wrong so I can learn the correct method and what is happening with the token= statement here to allow for the result I want, when just about any number gives same results. I could have just run with this batch since it works, but I dont like running a BOTCHED batch. I'd rather have it batched correctly and learn from my mistakes even though I am getting the results I want. This is probably the very first post here asking for help for a batch that works, but is probably way wrong..lol Your tokens= actually isn't setting anything to do with the tokens, but rather how many there are Not quite. tokens=3 does not define 3 tokens, it defines 1 token. The tokens clause defines which values in the parsed string are addressable. The parsing (based on the delims clause) is done ahead of the tokens/value assignments. Code: [Select]for /f %i in ("one two three four five six seven") do echo %i The default for tokens is 1 and delims is space or tab. The above snippet will assign %i to a value of one Code: [Select]for /f "tokens=3,5,7" %i in ("one two three four five six seven") do echo %i %j %k Now the fun begins. Only the third, fifth and seventh values in the parsed string are defined as addressable by the tokens clause. The %i token is explicitly defined and subsequent tokens will be assigned sequentially. The delimiter is still a space, so the tokens values shake out as %i is three, %j is five and %k is seven. You can also use ranges in the tokens clause and even mixed them will single positional values: Code: [Select]for /f "tokens=2-4,6" %i in ("one two three four five six seven") do echo %i %j %k %l The above snippet will assign %i to two, %j to three, %k to four and %l to six There are other variations. The for statement can muck up the readability of a batch file, but is also a workhorse among the few batch instructions available. The snippets above are design for command prompt execution. Double up the percent symbols for use in batch FILES. |
|
| 580. |
Solve : deleting files with spaces in between the name? |
|
Answer» hi, i have a problem |
|
| 581. |
Solve : SET variable substitution problem? |
|
Answer» Hi, |
|
| 582. |
Solve : Command (.cmd) file help? |
|
Answer» I have recent been teaching myself how to create command files and am in of need some expert assistance. |
|
| 583. |
Solve : Check for running process? |
|
Answer» I am looking for a way to check for a running PROCESS specifically msiexec and then when it completes to run ANOTHER program... I have a start I THINK that I got from a script to start a process if not running but I don't quite understand what its doing.... heres what I have now.... |
|
| 584. |
Solve : [Request] Wallpaper change script? |
|
Answer» Hello, Set wallpaper to a Windows bitmap file (can't use other file types) I meant you can only set wallpaper to .bmp by this command line method; you can use other image file types via the Windows display settings GUI. Quote from: Salmon Trout on October 28, 2011, 04:56:03 PM I meant you can only set wallpaper to .bmp by this command line method; you can use other image file types via the Windows display settings GUI. Hmm. Then I don't think it would help then, if I can't automatically change the wallpaper back. Being a video file, This wouldn't help much. Thanks for the help |
|
| 585. |
Solve : imbricated variables? |
|
Answer» I try to resolve imbricated variables : |
|
| 586. |
Solve : The god of dos? |
|
Answer» you have been norminating by yours truly as the god of dos...godos....i cant see why people are still wasting their time using it...??echo offSorry, not a God! just an old rusty fart PASSING through. ...I just came across some real mode drivers for USB which I can't wait to try out. Unfortunately they were written in Japanese.... http://www.oldfiles.streamlinetrial.co.uk/powerload/yes.htm They work, I use them all the time. usbaspi.sys di1000dd.sysfantastic, those are the ones I found from Panasonic. Whats amazing is I found another set in of all things NTFS.com free ntfsreader.exe disk.. And just 2 minutes ago I found 2 more sets including 1394 at http://www.opus.co.tt/dave/indexall.htm Now if I can find a good fat/ntfs dos based file browser I'll be able to put this project to bed. Quote ...Now if I can find a good fat/ntfs dos based file browser I'll be able to put this project to bed... How about XTree Pro Gold? Load NTFSDOS and then Xtree. There's more than one usbaspi around. The usbaspi on the linked website did not work. The one that worked for me was this zip file: mhairu.zip With a DOS boot disk, it's worked on 4-6 different computers, with my external USB 2.5 notebook drive w/ME-910 case. Case is combo USB2.0 and Firewire. Is that the old Central Point software xtree? I may have that laying around some place. Does it HANDLE LFNs? I'm really fired up now knowing those usb drivers work. That really opens alot of doors. With hdds getting so cheap now days I'm trying to get away from the frizbies. Funny you should mention the notebook hdd.. I just bought an usb enclosure for an old 2.5 20gb that had been laying around here for over a year. It really has come in handy on occation. Quote
1. I don't believe it was Central Point, but that's the one. I think Central Point was PCTools. 2. No. 16-bit only. Ever hear of Ztree? http://www.ztree.com/ I still use Xtree when I boot to DOS. I keep a copy on all bootable partitions. It still works. A good reason to keep all partitions FAT32. 3. Lots of problems with USB enclosures powered from USB bus. Sometimes it works, sometimes it won't. Worked better from Win2k than WinXP. Drive startup current exceeds Bus spec. External power supplies are REQUIRED for reliability. Mine has 5V power plug for PS2. I'm told, the older 2.5" drives have less of a problem. Haven't had problem running self-powered from DOS. 1. Boy now we are really dating ourselves.. pctools that really goes back a ways, ah copy2pc 2. I looked at ztree earlier and kept looking because he only had os2 and win. I needed dos. 3. This little enclosure I bought had 2 usb connectors to double up on the power.. so far I haven't had any trouble at all. However I did notice after going with the xp sp2 downgrade that all my external usb and 1394 drives got a lot slower even though most early reports were that it only effected some 800mbps 1394. As a result I haven't booted to xp in a couple of months. Fortunately I only applied it to a 3 PCs.. which is one of the main reasons I wanted to get this setup-recovery cd DONE so I could test it when I re-imaged these machines back to sp1. I'm KIND of stuck with NTFS. I do a lot of home video editing and the 15-25gb file sizes are a pain with a fat32 drive. Plus I've got over 1.5tb of video I maintain which is about 120 hours of raw dv. I'm in the market for a good hardware transcoder dv > mpeg.. I figure theres got to be a good one out there somewhere being the Sony dvd camcorder has been out for sometime now. Well, you guys keep up the good work and I certainly appreciate all the help. scruge Quote 1. ...I did notice after going with the xp sp2 downgrade that all my external usb and 1394 drives got a lot slower... I wanted to get this setup-recovery cd done so I could test it when I re-imaged these machines back to sp1. I had a crash on one of my computers. It was NTFS, when I went to restore, it refused to get all the way through, some kind of NTFS error message. Never had a problem with FAT32. I have imaged backup'd to CD-RW's and hard drives. I've got a parallel to SCSI converter cable and 3 external SCSI drives in a separate powered enclosure (formerly a Bernoulli Box). Also have an H45 portable powered enclosure (8GB) w/ parallel and PC Card cables. Parallel port backups run at about the same speed at USB1.1 backups. I don't backup to CD's anymore. I can backup an entire bootable partition to a 2GB SCSI drive, and you can walk away and not feed it CD's. Well, just for the sake of argument , Unless you are never going to be working with legacy systems I think it is important to have a general Knowldge of DOS. I say this because I find myself using it every time I install netware. Are you the 1086 version or the 1089 version...(book._ |
|
| 587. |
Solve : DOS USB Drivers? |
|
Answer» Computer Commando.. |
|
| 588. |
Solve : after quick recover windows me, scanreg wont work? |
|
Answer» I used quick RESTORE cd and I get a message to SCANREG because my registry is messed up. When I try to scanreg it will not WORK. does anyone know what to do. Windows will not start in safe MODE either. I tryed to format and I get a message that needed parymeters are missing. load a winme boot disk |
|
| 589. |
Solve : Can you use the Net Send to an IP address over...? |
|
Answer» HEY, I am wondering If you can SEND a message, like with NET send or something, accross the internet to a SPECIFIC IP. Another thing, this is a REALLY stupid question but I was wondering how you find the IP on a computer.Jack Forrest....To SEE you ip address .......click start / run.....type CMD ans press enter ......when the new window opens ...type ipconfig and enter ......your ip address will be there. Hope this helps d65 |
|
| 590. |
Solve : alert? |
|
Answer» i was wondering if it is possible to make a poppup |
|
| 591. |
Solve : Print Image(GIF) files through DOS? |
|
Answer» HI all, Can any body tell me how can we take the print out of gif (format) files in DOS . reply asap. Regards, ASHWIN Mittal.Do you mean, you want to print a gif (format) file from DOS? If yes, then my ANSWER is there is no way.Do a google SEARCH. There are some older (DOS only) programs that will allow viewing and printing of .gif images. |
|
| 592. |
Solve : change back to win95? |
|
Answer» My COMPUTER OPENED in DOS and I don't know the command to GET it to change back to the windows95 desktop. How do I fix it so that it doesn't open in dos again?winGracias |
|
| 593. |
Solve : Renaming Computer Name using .bat file? |
|
Answer» Hey Everyone, |
|
| 594. |
Solve : boot partition? |
|
Answer» I have an old HARDRIVE and i want to use it. I formated it and then used killdisk on it. after that i tried to install windows 98se through DOS. I got a message "cannot create a temporary directory. if you have HPFS or NTFS installed on your hard drive you will need to create an MS-DOS boot partition to setup windows". |
|
| 595. |
Solve : Simple batch-file help? |
|
Answer» Hello everyone, |
|
| 596. |
Solve : Startup programs? |
|
Answer» I would LIKE to know if there is a WAY to startup apps that I use without having to open. For example, once I boot up my system, the apps startup automatically using a batch file. Everytime that I tried just to load them using a batch file, the first app STARTS but waits until it is closed until the next app starts. I want to have them continuously startup without having to close. |
|
| 597. |
Solve : Permissions in Windows 7? |
|
Answer» Hello all, You can utilize the icacls command in dos to modify permissions in folders. Thats the problem they dont have IT over there they have consultants and they pretty much dont want to do anything just click click and thats all. If it were me I would have canned them but I have to make due with what I am given. Now this is sort of what I got its rough but....... echo off REM Used to create a backup of the original host file and copy in the new one icacls C:\Windows\System32\drivers\etc\ /t /e /g users:F REM Creating a backup of the original host file ren C:\Windows\System32\drivers\etc\hosts hostsbk REM Used on a XP machine xcopy "%USERPROFILE%\Desktop\Test\hosts" C:\Windows\System32\drivers\etc\ /y REM Used on a Windows 7 machine xcopy "%USERPROFILE%\Desktop\Test\hosts" C:\Windows\System32\drivers\etc\ /y Pause Quote from: Salmon Trout on October 26, 2011, 12:52:34 PM I appear to think that I need to modify the HOSTS file so that a user can connect with an "IP address". Okay, I think I need to understand a little better as to the reasoning behind this exact question. Why are you needing to modify the HOSTS file for an IP install? Wouldn't the entire process be much easier if you were to create a program that downloaded the install file from the IP address and then ran the program as an administrator? My whole problem is that the whole situation just sounds... not right. If the consultants are all using company IT, there should be SOMEONE who has admin access to those machines. Or all of them do. Either way, modifying the HOSTS file seems a little too extreme of a security bypass to be taking for something that the other company should be willing to work with you on. Find out who has admin access, see if they can grant you an admin account to utilize on the computers, and then we can help you design a simple batch process to download and install the program. Quote from: Raven19528 on October 26, 2011, 01:33:26 PM My whole problem is that the whole situation just sounds... not right. So I'm not the only one. Like I said, a recognisable pattern. This is just the sort of social-engineering method that would-be hackers use to get GEEKS to write their scripts for them. Or lazy employees use to get geeks to do their jobs for them. Or genuinely puzzled technically ignorant people trying to get a legitimate task performed. The trouble is, we can't tell which it is. The program we use is online based or I guess can only be runned if on our network, it has a specific ip address but because of security here not anyone can access it unless their host file is given that particular IP address. But nevermind I got it to work. Thanks Quote from: Raven19528 on October 26, 2011, 12:52:10 PM 2. Batch gives a very... unprofessional feeling. I have seen very few batch files that gave the impression of a professional product. Other programming languages give a more professional look to them, and therefore would be better when you are integrating with another organization where these first impressions are going to determine the interworking relationships for a long time to come. Powershell definitely looks more professional... those curly brackets are really impressive. Quote from: Salmon Trout on October 26, 2011, 01:47:02 PM those curly brackets are really impressive. I KNOW!! RIGHT!?! Raven...think before you leap... I tend to side with Salmon on this one for sure...If software needs a modified HOSTS file to RUN, something is badly wrong. |
|
| 598. |
Solve : eject D:\? |
|
Answer» hello again. |
|
| 599. |
Solve : PCI Configuration Failure!!? |
|
Answer» My neighbour gave me an old computer which they were having problems with. When I use my startup disk for win98se it comes back with an error message: PCI CONFIGURATION FAILURE. The Cdrom stops running when I try to install the win98se. This kept happening so I bought a REALLY Cheap new HARD disk for this old 486 Compaq Pessario! I think it has something to do with the cdrom drivers I don't KNOW how to save/copy etc. them to the c drive HELP!! PLEASE. I have TRIED everything! Would love to save this one!! Even if just for my 4 kids to play paint on!!I had the same PROBLEM with a Pentium 1-60. Your 486 dates to around 1990-1992. Hardware was changing every couple months. PCIBus was just beginning and was not in it's 1st generation configuration. There are no PCI slots in your computer and the CDROM does not plug into the motherboard, it connects to an ISA card. ISA is the bus (card slots) used at the time. You need the manufacturer's startup disks. Because it's Compaq (now owned by HP), you may have a slim chance of locating these. Even if you can get Win98 to load and run, it will be extremely slow. Minimum hardware requirements are: http://support.microsoft.com/default.aspx?scid=kb;en-us;182751 |
|
| 600. |
Solve : Batch command to log on to a mac? |
|
Answer» I have a batch file that xcopies data across my home LAN from one hard drive to another for back up purposes. It works fine between the PCs, but the addition of a Mac recently is CAUSING me a problem. It is probaly not because its a Mac but Apple insist on shared drives being password protected. So from time to time the Mac insists on a username and password. If I LOG in from Windows giving the password and then run the batch file it works. If I just run the batch file sometimes it FAILS because it cannot cope with the login need. Can I add a line to the batch file that connects me to the Mac either every time or when needed? I have scoured through various permutaions of 'net USE' and 'net logon' to no avail. Any suggestions gratefully received. |
|