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.
| 4651. |
Solve : bat help it exits whaen i press 1, 2, 3, or 4please help!!!? |
|
Answer» @echo off |
|
| 4652. |
Solve : Format a CD with batch?? |
|
Answer» Is it possible to format a rewritable CD with a batch file? Is it possible to format a rewritable CD with a batch file?Format /?Code: [SELECT]Format D: Assuming your CD drive is the D drive.get cdtools from here: Code: [Select] CDTOOLS.EXE is a collection of miscellaneous CDROM tools that perform functions not covered by the other DOS utilities. CURRENT functions... - Display a list of installed CDROM devices - Display a disc's table-of-contents - Erase a disc (re-writable discs only) - Format a disc (re-writable discs only) - FINALIZE a session/disc - Load a disc (tray models only) - Eject a disc http://goldenhawk.com/download.htm Quote from: macdad- on May 21, 2009, 06:17:42 AM Code: [Select]Format D: Thanks |
|
| 4653. |
Solve : How to save values in your game?? |
|
Answer» please i need any way to make the users can save the game @echo off i dont' see any saveable value where is the game??Please Is there someone can help me?Quote from: Hallucination on June 02, 2009, 03:16:11 PM PleaseJust some things I noticed while glancing at it. 1. I suggest replacing all instances of IF with IF /I incase someone writes something like 3DOORSdown... 2. Add set option=%option: =% before the IF /I incase they add spaces... 3. You don't need the colon after goto, only before the label. 4. Adding a loop before choosing an option will prevent someone from entering something stupid like BLAH! and continuing on with the script. Code: [Select]:loop1 echo Option 1 echo Option 2 set /p option= set option=%option: =% if /i "%option%"=="Option 1" goto option1 if /i "%option%"=="Option 2" goto option2 cls echo Not a valid option! goto loop1 :option1 code... :option2 code... Could you please edit my batch file and add an option if user pressed "mm" any time batch file - save everything and if user pressed "nn" any batch - batch file load last save Thankswell now we'll be taking all the fun away from you Quote from: BatchFileBasics on June 03, 2009, 07:38:14 PM well now we'll be taking all the fun away from youYeah...and the only way you can truly learn is from doing it by yourself. (Trial and error...trial and error) |
|
| 4654. |
Solve : How can I open a file on another computer with a batch file? |
|
Answer» Hi all, Thanks Reno but I have a hard time believing that a simple DOS solution doesn't exist.Please tell us why you think that. Many here believe that Windows was not built on top of DOS. Some of us here are wondering why so many ask us about DOS based commands when there are so many ways to do anything inside of the Windows interface. Are there some INSTRUCTORS or books that teach people everything starts in DOS? In windows you just go into My Network Places and find whatever can be seen. And if you need to execute a program on the far machine, there is a way to do that, as was EXPLAINED above in another post.Quote from: Cheese on May 13, 2009, 10:09:23 PM Thanks Reno but I have a hard time believing that a simple DOS solution doesn't exist.tools are available in exe format that can do the job. to read a file in remote server including DIFFERENT platforms, there are various ways to do it. eg SSH, telnet, expect etc, depending on WHETHER these services are available. psexec is only one solution of them that is used between windows machines and can't be used if you want to connect UNIx machinesI like DOS solutions because I like to have a clean PC. And it seems to work because in 15 years of PC use I don't remember having ever had the slightest virus on my machine, not EVEN the Sasser & consorts. DOS commands are a very elegant solution because the program exists on every XP PC the same way. Still, I admit that this time I'll probably have a hard time because part of the PC's run on Win98, which doesn't use the same command. I'll have a look at psexec. Thanks for that folks.Quote from: Cheese on May 14, 2009, 01:16:18 PM DOS commands are a very elegant solution because the program exists on every XP PC the same way.that's not even the basis for "elegant solution". Its just convenience.We don't use the same vocabulary then. To me an 'elegant solution' is a solution which brings you the best possible output with a minimum of means. And the DOS console isn't exactly a heavy program is it. |
|
| 4655. |
Solve : Getting source (not of a converted batch file)? |
|
Answer» Is it possible to GET the source of a web page via BATCH? If not, how would I get around to doing it?well i don't THINK you can actually use batch to download\read from a webpage...or can you? |
|
| 4656. |
Solve : delet (.rar .zip ) files after successfully unzip? |
|
Answer» type '.zip.exe' at command prompt: Microsoft Windows XP [Version 5.1.2600] well i did not navigate to my folder through CMD but i did something else that defined my file is not bad !! i copied .zip.exe in a folder and typed .zip.exe in a bat file and executed bat file you can see the result Quote F:\bbb\delet zip>.zip.exe so my file is a command version right RENO? now what's wrong? would you please read my previous post again? thanksadmitted it that i dont have an answer for this. i have used that batch script for months, and works well as i intend it to. change echo off to echo on, then if you could post some screen output which line and file name goes wrong, i try my best to ASSIST. hi to all specially my dear RENO RENO you were right !! i had created 2 empty folders and compressed them..... because of that program could not extract anything i apologize for that i did not saw that there are some switches in your program ====================================================== but now i created 2 folders and put some files inside both of them and then compressed them to names below my rar.rar my zip.zip and added (.zip.exe , .Rar.exe and reno.bat) and execute bat file it extracted all files and folders and deleted my rar.rar file but my zip.zip is still exist !! it's just hiden but not deleted below you can see the result in a CMD window Quote C:\delet zip>for /F "tokens=*" %a in ('dir /b *.rar *.zip') do (%~xa e -y "%~a"i am speechless. the 2 batch file is not meant to be combined into one. instead use this: Code: [Select]@echo off for /f "tokens=*" %%a in ('dir /b *.rar *.zip') do ( %%~xa e -y "%%~a" && del "%%~a" ) pause there is a HUGE bug that need to be fix in _clean.bat at post #2, there is no 'lb' switch in 7z.exe. so don't use script at post#2. thank you for reporting a bug. wow thanks RENO what a powerful script it's so fast even before i start it it finished !! fantastic it's working like a charm it extract files and delet compressed files with no error . it is very delightful that this website has a programmer like you ============================================== now with a test i have my 2 final questions that will be very greatful if you solve them how can we replace (*.rar .*.zip) with our file names? i don't want to all files to be extracted .just need those files that i order get extracted thanks can you give an example for replacable file names (for both zip and rar files at the same time) thanks has someone seen RENO around? |
|
| 4657. |
Solve : batch game? |
|
Answer» ok me and my mate have MADE a batch GAME, we was GOING to make a really long one, but couldnt figure out how people would be able to save it, so we are making chapters, also this will let us post the 1st chapter and ask for peoples feedback and see if people WANT us to make a NEW one, so please look at the code, play the game and tell us what you think. |
|
| 4658. |
Solve : scripted file removal remotely by IP address???? |
|
Answer» I have some bad software being used all over and I need to fix it REMOTELY. I have some bad software being used all over and I need to fix it remotely.Can VNC be used with the command prompt?sorry no vnc cannot, mixing my questions upQuote from: badbot on May 20, 2009, 04:53:16 PM sorry no vnc cannot, mixing my questions upSo...you want to remotely delete a file on someone else's computer...they would need their FIREWALL disabled, which I doubt they will want to do.you could send them the batchfile to run themselves...Quote from: BC_Programmer on May 20, 2009, 06:27:41 PM you could send them the batchfile to run themselves...that would be the best BET...if you have administrator access on the network, you could delete by computer name though. not sure about how to by ip address. ERASE /F /s \\computername\C$\ClaimTrak\*.LBS |
|
| 4659. |
Solve : Batch removable drive help? |
|
Answer» Hi I'm having trouble making a batch file that: Code: [Select]@echo off Is there any way to display a DIR of each drive? I tried adding set dv=!DriveU%%a! dir /b /s %dv% to the script withing the for loop, but I have no idea what the ! does.Thanks for replying so soon and thanks for your help but how would i use that system to make it so it picks up the primary usb and blacklists it and then copy's to all the secondary usb's? I relies that making it leave the label and the icon of the existing autorun is asking a bit much but i figure with this system i can use my 1TB as the master with its custom icon and label and then the rest can have a different one. Code: [Select]setlocal enabledelayedexpansion set UsbNum=0 for %%a in (c d e f g h i j k l m n o p q r s t u v w x y z) do ( for /f %%h in ('fsutil fsinfo drivetype %%a:^|findstr "Removable"') do ( set /a UsbNum+=1 set DriveU!UsbNum!=%%h ) ) echo You have !UsbNum! removable drives, list as below: for /l %%a in (1,1,!UsbNum!) do ( echo.!DriveU%%a! ) endlocal pause And it does look like an autorun virus because in a very loose sense of things it is because it changes the autorun file without prompt. Many Thanks crackrucklesQuote from: Helpmeh on April 28, 2009, 04:37:47 PM Is there any way to display a DIR of each drive? I tried adding Try this one. Code: [Select]@echo off setlocal enabledelayedexpansion set UsbNum=0 for %%a in (c d e f g h i j k l m n o p q r s t u v w x y z) do ( for /f %%h in ('fsutil fsinfo drivetype %%a:^|findstr "Removable"') do ( set /a UsbNum+=1 set DriveU!UsbNum!=%%h ) ) echo You have !UsbNum! removable drives, list as below: for /l %%a in (1,1,!UsbNum!) do ( echo.!DriveU%%a! set dv=!DriveU%%a! dir /b /s !dv! ) endlocal pause Quote from: Reno on April 27, 2009, 10:45:55 PM ...this looks like autorun-virus to me... Quote from: crackruckles on April 29, 2009, 05:08:08 AM ...And it does look like an autorun virus because in a very loose sense of things it is because it changes the autorun file without prompt... Why are you wanting to do this, for malicious purposes? its not for a virus if i was going to make an autorun virus i wouldn't make it in batch. i was just hoping for an easy to use way to change all my autorun files on all my portable devices at once without having to spend time doing them manually. The reason i decided to go with batch to start with was how easy it is to modify for further use. Many Thanks crackrucklesHow many portable devices do you use that a SIMPLE copy and paste would take to long? Quote from: mroilfield on May 10, 2009, 04:37:10 AM How many portable devices do you use that a simple copy and paste would take to long?Exactly!well i work with around 10,15 so a copy and paste would do it but i like to figure stuff out and this is one of those things that i just want to figure out. at the moment i can get the code to work for one drive but not for all of them. it seems to work on the drive its on and not any of the others plugged in.I'm still using Code: [Select]setlocal enabledelayedexpansion set UsbNum=1 for %%a in (e f g h i j k l m n o p q r s t u v w x y z) do ( for /f %%h in ('fsutil fsinfo drivetype %%a:^|findstr "Removable"') do ( set /a UsbNum+=4 set DriveU!UsbNum!=%%h ) ) echo You have !UsbNum! removable drives, list as below: for /l %%a in (1,1,!UsbNum!) do ( echo.!DriveU%%a! ) if EXIST !DriveU%%a!\Autorun.inf goto error1 echo [autorun] > !DriveU%%a!\Autorun.inf echo label: "Craigs Usb"> !DriveU%%a!\Autorun.inf echo shellexecute= "..!DriveU%%a!\1.bat" >> !DriveU%%a!\Autorun.inf echo ;open="..!DriveU%%a!\1.bat" >> !DriveU%%a!\Autorun.inf any ideas? p.s. anybody else have problems with this message box bouncing up when you put the code tag in? Many thanks crackrucklesQuote from: fat_basterd21 on April 27, 2009, 11:57:07 PM
just to point out that batch files isnt programming, its scripting, there is a difference |
|
| 4660. |
Solve : xcopy command in network ip ???? |
|
Answer» hi guys i want USE xcopy command to copy my network file. if possible i am ADMIN of my network & my ip is 192.168.100.1 i like to copy of .doc file from 192.168.100.5........ 1. map the folder at xxx.xxx.xxx.5 as a network DRIVE. nt cmd is 'net use' 2. do xcopy, eg. xcopy z:\*.doc C:\backup\ |
|
| 4661. |
Solve : tat.bat? |
|
Answer» has any one ever come across a really kool batch file called tat.bat my mate sent me it and it has alot of kool features, so like if any one is interested in it or had the file and lost it ask me for it and ill send u the codeThanks.why dont you post it here ? the code is really lengthy but okCode: [Select]@echo off |
|
| 4662. |
Solve : is this bat file right. cause it will not work.? |
|
Answer» @echo off @echo offFirst off, you need to add ^ before each $ (and possible the * and +). Also, ":no" and "echo you didn't well to bad" need to be on different lines.thanks but when i open it , it says choice is not a recognized internal or EXTERNAL command operable program or batch file.Quote from: computerperson#1 on May 20, 2009, 04:13:18 PM thanks but when i open it , it says choice is not a recognized internal or external command operable program or batch file.Because you don't have it on your computer...that's why. Use set /p variablename= instead.Code: [Select]@ECHO OFF :Begin ECHO 1 - Stars ECHO 2 - Dollar Signs ECHO 3 - Crosses ECHO 4 - Stop echo Enter Choice SET /P choice= IF %choice% EQU 4 goto end IF %choice% EQU 3 goto CRS IF %choice% EQU 2 goto DLR IF %choice% EQU 1 goto STR goto begin :STR ECHO ******************* ECHO. PAUSE CLS Goto Begin :DLR ECHO $$$$$$$$$$$$$$$$$$$$ ECHO. PAUSE CLS goto Begin :CRS ECHO +++++++++++++++++++++ ECHO. PAUSE CLS goto Begin :end Output: 1 - Stars 2 - Dollar Signs 3 - Crosses 4 - Stop Enter Choice 2 $$$$$$$$$$$$$$$$$$$$ Press any key to continue . . .Quote from: billrich on May 20, 2009, 04:56:49 PM Code: [Select]@ECHO OFFTry putting a CLS right after :begin ...thanks it works Quote from: computerperson#1 on May 21, 2009, 05:47:41 AM thanks it worksYou're welcome! You can stay as LONG as you want, either getting help or giving it! |
|
| 4663. |
Solve : Echoing $V (prompt)? |
|
Answer» Quote from: billrich on June 03, 2009, 08:30:14 PM
I copied/pasted the above coding into Trial.bat and this is the output with Echo Off: Quote C:\>trial With Echo set to On the following is produced: Quote ←C:\>trial Nowhere can I find that you set any variable to the current OS version, the variable %varp% is set to the Prompt switch (aka text) $v as is shown in your Echo COMMAND. What the OP asked for is that a variable be set to the output of Prompt $v which is the OS version details. You will appreciate that, when Prompt $V is used, Prompt in this case is an Internal Command which will be interpreted by CMD.exe and the variable %Prompt% will be set to the prompt switch so that %Prompt% is set to $V not to the result of Prompt $V.Hedi wrote: Quote You will appreciate that, when Prompt $V is used, Prompt in this case is an Internal Command which will be interpreted by CMD.exe and the variable %Prompt% will be set to the prompt switch so that %Prompt% is set to $V not to the result of Prompt $V. You might be right. How do we ASSIGN the output of "prompt $v" to a variable that we then can echo? C:\>prompt echo $v$G echo Microsoft Windows XP [Version 5.1.2600]> echo Microsoft Windows XP [Version 5.1.2600]>prompt C:\>@Hedonist this advice may be a bit late, but your struggle is as futile as trying to teach Nymph4 something. I'm sure you can relate to that. BC_P - don't remind me Billrich has raised a good question, how does ONE redirect Prompt output? Until 5 mins ago it's a THING I've never tried, never even thought of. So far I've not been able to redirect it anywhere so perhaps Prompt does not write to Stdout, or redirection is suppressed. I'm guessing it's the latter, if redirection was permitted then the command prompt would be null, not even CR\LF (Prompt $_) which could cause mayhem. I cannot think of any reason to want to redirect Prompt output. I'll have to give more thought to that.. Quote from: BatchFileBasics on June 03, 2009, 08:22:35 PM yea, he was probably stressedActually I was quite SICK and had a throbbing headache...thought something like that |
|
| 4664. |
Solve : case statement?? |
|
Answer» Is there such a thing as case statement in a batch file? I CHECK the web and they only use if statement. Is there such a thing as case statement in a batch file? I check the web and they only use if statement.no. 'case' is just a nicer if/else. Therefore, all you really NEED is if/else. if you really really need case support, use *nix SHELLS, eg bash, or other languages that GIVES you this kind of support. Quote case "$var" in That's an example like I used to use in my shell scripting days. |
|
| 4665. |
Solve : accessing files using IP address? |
|
Answer» as a guest user can i ACCESS the files from another computer within the lan connection??Why would you want to see files on my computer? You sound sneaky.BillRich. did he say anything about your computer? and most likely not.Yes you can, you'll have to set up file and printer SHARING though. Then you'll have to grant access from which ever computer you want access from to the host computer. You'll first have to make sure your network is set up correctly. Then you could access them through either I.P. Address or Computer Name. It's not very hard to do, would take less than 10min. or so, if you know what you're doing... Good ol' Google...<--click! By the way you should have posted this in the Networking area of the forum...oh, i thought r3ynz_t4n wanted to just be able to see all files on computer by ip. Quote from: r3ynz_t4nz on June 01, 2009, 07:27:24 PM as a guest user can i access the files from another computer within the lan connection??Lan and IP are totally different things.whoops. COMBINES TOT:"ACCESSING files using IP address" OP:Quote from: r3ynz_t4nz on June 01, 2009, 07:27:24 PM as a guest user can i access the files from another computer within the lan connection?? |
|
| 4666. |
Solve : Run ".exe" as admin...assistance needed.? |
|
Answer» Hello, |
|
| 4667. |
Solve : New here? |
|
Answer» Hi All im new here on the forms. i have instaled MS-DOS 6.22 on an old pc. But it will not boot to ms-dos. i have used the F5 key witch did not work. i get the non system disk message. when i use the ms-dos start up disk to get to an a promet it works from my floppy. when i switch dir. to C: and try to change dir. to dos it gives me an invalid switch. please direct me to the corect Q&A post that can help me. Or if some one can shine some light on this for me please. thanks in advance.Welcome to the CH forums. set as the Primary active partition?MS-DOS 6.22 has it's own installer. You did run this? On the other hand, how did you acquire DOS 6.22? I'm not suspecting you of anything illegal, but if it was from the MS website, you might have acquired the MS-DOS "step-up" installer, which updates DOS 6.0 to 6.22. Otherwise, I would start from the top by booting from the Floppy, fdisk-ing and formatting C: and attempting to run through the install again.back to the ms site lol thats about my speed . lol thanks man i have updated something i dont have on my pc.Ahh, well that would explain it then! If your still interested though you can get DOS 6 on Ebay. I've even seen it in a few small computer stores, too.Yep thanks i called down to a PC shop near me and one of the techs there had a copy that he was willing to sell. I'm am installing as i post this. |
|
| 4668. |
Solve : Copy all files from usb to a folder? |
|
Answer» you couldnt? maybe your in need of my help TOOO.... all right then I'll explain it.wait! you already explained it all! the code is wrong, which probably WONT do anything. no I said that the way it was coded was wrong. add the /y switch if the stdout of xcopy is redirected to nul if not, dont use redirection at allwhat??? I never heard such poor DOS commands.Quote from: squall_01 on May 20, 2009, 06:29:31 AM what??? I never heard such poor dos commands. which PART of nt command you dont understand?I used the code that TheShadow posted, and added /y Thanks all |
|
| 4669. |
Solve : batch file to delete files? |
|
Answer» ok i saw a batch file code on youtube when i was just surfing the videos, but i cant find it again, and what the file did was delete a file that u dragged into it, kinda like the recycle bin cept it deletes it straight away and doesn't ask if you WANT to delete it. can any one tell me what the code is, if they have anything similar???Code: [Select]@echo off Code: [Select]@echo off erm, what does the /Q "%1" do?/Q Quote doesn't ask if you want to delete it %1 is SET if you drag a file into script.batnice i DIDNT know that, thanks man well i ges that this will do the job thanksok it doesnt work, it SAYS cannot find the file path specifiedIn command prompt, type: del /?If you want to delete both file and folder, please REMOVE rem. Code: [Select]@echo off if "%~1" neq "" ( del /f /a /q "\\?\%~f1" 2>nul rem rd /s /q "\\?\%~f1" 2>nul ) |
|
| 4670. |
Solve : a progressbar that indicate passed percents? |
|
Answer» hi |
|
| 4671. |
Solve : Batch file to ping equipment? |
|
Answer» Hi, this is my first post here so I'm hoping it doesn't sound too rediculous. |
|
| 4672. |
Solve : find txt files based on contents? |
|
Answer» Quote from: mioo_sara on June 04, 2009, 09:44:22 AM
Careful there. You obviously intend this as a compliment. Those of us who suffered total computer lockup's EVERY other evening upon "Shutdown" would take it as an insult, Especially since the computer remained unusable until the power plug was REMOVED, and upon the next restart Windows would reprimand the user for "failing to shutdown PROPERLY" ! ! Alan |
|
| 4673. |
Solve : issue with space in UNC path? |
|
Answer» hey all, thanks but that dose not answer my original issue.You PROBABLY have a trailing space on a line - you may not be able to see it, but the computer can and it will be significant to it GrahamQuote from: wbrost on May 20, 2009, 07:45:00 AM thanks but that dose not answer my original issue. i already gave answer for that on no.1, the extra space if not from text file. original code: Code: [Select]SET A=%%A && CALL :GETDATA %%Anotice the space between %%A and &&, that's where the extra space coming from you could modify it to SET A=%%A& CALL :GETDATA %%A or SET A=%%A CALL :GETDATA %%A ok, actually there is one statement that cause another extra space, but the for loop nullify the effect of the extra space: echo 5466-BRADFORD >> %TEMP%\PDFILEINFO.TXT modify to: echo 5466-BRADFORD>>%TEMP%\PDFILEINFO.TXT or >>%TEMP%\PDFILEINFO.TXT echo 5466-BRADFORDok thanks was trying to make it read better.... oh well thanks. |
|
| 4674. |
Solve : BAtch file script? |
|
Answer» hello, |
|
| 4675. |
Solve : Listing the Folder names and Sizes using DOS? |
|
Answer» Can someone let me know how can we get the folder name and size using MS DOS.?Do you MEAN real MS-DOS or Windows command?Anything would do. Either MS Dos or Windows..Code: [Select]@ECHO off |
|
| 4676. |
Solve : Reading 3.5 in. diskettes? |
|
Answer» I have a couple of 3.5 INCH floppy diskettes which I need to read. When I put the diskettes into a floppy drive and select it in My Computer, I get the response "The disk is not FORMATTED do you want to format it now?" |
|
| 4677. |
Solve : Batch Job EML writer? |
|
Answer» The aim of the SCRIPT below is to send an email when perfmon on the server meets a certain level. |
|
| 4678. |
Solve : School batch program.(math)? |
|
Answer» Quote (10x+10)Well... NEVER did get straight As in that class. (Actually, I flunked the first year.)What happened to cdh473? Looks like he doesn't need our help anymore....hmm...Quote from: Ironman on May 13, 2009, 04:50:57 PM What happened to cdh473? Looks like he doesn't need our help anymore....hmm...That's because he knows that we know that he knows... in the end: He knows we know.because that makes sense..Quote from: Xenfire on May 14, 2009, 04:39:27 PM because that makes sense..But you see, if he knows we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know... Anyway, it is a failed ATTEMPT at putting a virus on our systems...blargh wth ill put the source code @echo off title SolutionFinder color c cls :login call solutionfinderauthorization.bat cls if %action% == ***codenotshowable*** goto start exit :start echo Please choose what you would like to do. echo. echo 1.Find a solution echo 2.Exit set /p action= cls if %action% == 1 goto SFbegin if %action% == 2 exit set return=start goto errorpage :errorpage echo Sorry, but your answer was invalid. pause >nul cls goto %return% :SFbegin echo Choose an equation format. echo X is the actual variable, where Y is a predefined number, echo and O is an operation. echo. echo 1. YOY=X echo 2. YOX=Y echo 3. Y(X)OY=YOY echo 4. YOXOY=Y set /p action= cls if %action% == 1 goto yoyisx if %action% == 2 goto yoxisy if %action% == 3 goto y*xoyisyoy if %action% == 4 goto yoxoyisy set return=SFbegin goto errorpage :yoyisx echo Enter your first predefined number. set /p action= cls set yone=%action% echo Enter your operation. Subtract=-;Add=+;Multiply=*;Divide=/ set /p action= set oone=%action% cls echo Enter your SECOND predefined number. set /p action= cls set ytwo=%action% set /a answer=%yone% %oone% %ytwo% echo You got %answer%. pause >nul cls goto start :yoxisy echo Enter your first predefined number. set /p yone= cls echo Enter your operation. Subtract=-;Add=+;Multiply=*;Divide=/ set /p oone= if %oone% == + set ooneopposite=- if %oone% == - set ooneopposite=+ if %oone% == * set ooneopposite=/ if %oone% == / set ooneopposite=* cls echo Enter your second predefined number. set /p ytwo= cls if %oone% == - set /a answer=%yone% %oone% %ytwo% if %oone% == / set /a answer=%yone% %oone% %ytwo% if %oone% == + set /a answer=%ytwo% %ooneopposite% %yone% if %oone% == * set /a answer=%ytwo% %ooneopposite% %yone% if %oone% == - goto yoxisynegative if %oone% == / goto yoxisynegative if %oone% == * goto yoxisypositive if %oone% == + goto yoxisypositive :yoxisypositive echo Here is the answer, with the work. echo. echo %yone%%oone%X=%ytwo% echo. echo %ytwo%%ooneopposite%%yone% echo. echo So the answer is X=%answer%. echo. pause cls goto start :yoxisynegative echo Here is the answer, with the work. echo. echo %yone%%oone%X=%ytwo% echo. echo %yone%%oone%%ytwo%=%answer% echo. echo So the answer is X=%answer%. pause >nul cls goto start :y*xoyisyoy echo Enter your first predefined number. set /p yone= cls echo %yone%x echo Enter your second operation. Subtract=-;Add=+;Multiply=*;Divide=/ set /p oone= cls echo %yone%x%oone% echo Enter your second predefined number. set /p ytwo= cls echo %yone%x%oone%%ytwo%= echo Enter your third predefined number. set /p ythree= cls echo %yone%x%oone%%ytwo%=%ythree% echo Enter your third operation. Subtract=-;Add=+;Multiply=*;Divide=/ set /p otwo= cls echo %yone%x%oone%%ytwo%=%ythree%%otwo% echo Enter your last(fourth) predefined number. set /p yfour= cls if %oone% == * set ooneopposite=/ if %oone% == / set ooneopposite=* if %oone% == - set ooneopposite=+ if %oone% == + set ooneopposite=- if %otwo% == * set otwoopposite=/ if %otwo% == / set otwoopposite=* if %otwo% == - set otwoopposite=+ if %otwo% == + set otwoopposite=- set /a secondhalfofanswer=%ythree% %otwo% %yfour% set /a extraoperationsolve=%secondhalfofanswer% %ooneopposite% %ytwo% set /a answer=%extraoperationsolve% / %yone% echo %yone%x%oone%%ytwo%=%ythree%%otwo%%yfour% echo. echo %yone%x%oone%%ytwo%=%secondhalfofanswer% echo %ooneopposite%%ytwo% %ooneopposite%%ytwo% echo %yone%x = %extraoperationsolve% echo /%yone% /%yone% echo x = %answer% echo. echo So the answer is X=%answer%. pause >nul cls goto start :yoxoyisy echo Enter your first predefined number. set /p yone= cls echo %yone% echo Enter your first operation. set /p oone= cls echo %yone%%oone%X echo Enter your second operation. set /p otwo= cls echo %yone%%oone%X%otwo% echo Enter your second predefined number. set /p ytwo= cls echo %yone%%oone%X%otwo%%ytwo%= echo Enter your last(third)predefined number. set /p ythree= cls if %oone% == / set ooneopposite=* if %oone% == * set ooneopposite=/ if %oone% == + set ooneopposite=- if %oone% == - set ooneopposite=+ if %otwo% == / set otwoopposite=* if %otwo% == * set otwoopposite=/ if %otwo% == + set otwoopposite=- if %otwo% == - set otwoopposite=+ set /a firstiso=%ythree% %otwoopposite% %ytwo% set /a secondiso=%firstiso% %ooneopposite% %yone% set answer=%secondiso% echo %yone%%oone%X%otwo%%ytwo%=%ythree% echo %otwoopposite%%ytwo% %otwoopposite%%ytwo% echo %yone%%oone%X %firstiso% echo %ooneopposite%%yone% %ooneopposite%%yone% echo X = %answer% echo. echo So the answer is X=%answer%. pause >nul cls goto start Quote ***code not showable*** Somethings up....how..... That just had something you didnt need to see that part of the code wasn't needed ...*CENSORED* could be up closeQuote from: cdh473 on May 17, 2009, 04:27:24 PM how.....We didn't need to see? If you post the source, you post the WHOLE thing. And why do we not need to see it? Anyway, WolframAlpha can do this online, no need to download anything.It's probably just a password. not really needed for debugging.Quote from: BC_Programmer on May 18, 2009, 07:24:01 PM It's probably just a password. not really needed for debugging.why would he want to password protect it, then post it here?.. he DIDN'T post it. that's the part he's not showing. On the other hand, it wouldn't make sense as a password since there was no user input, and it's looking at %action%. so what you posted before stands true. Additionally, I cannot see why it wouldn't be showable; It's just a batch file. |
|
| 4679. |
Solve : drive detection? |
|
Answer» HI im making a batch fine on a memory stic and it needs to know when dirive the memory stic is can anyone help plz also how can you make the "copy" command coppy the CONTENTS of folders inside the directory Code: [Select]set thisdrive=%~d0 set letter=%thisdrive:~0,1% ECHO this batch is being run from drive %thisdrive% echo the letter is %letter% Quote from: steven32collins on May 16, 2009, 12:13:49 PM also how can you make the "copy" command coppy the contents of folders inside the directory Don't bother, use xcopy. TYPE xcopy /? for full help, and type xcopy into Google for even more help. |
|
| 4680. |
Solve : Updater? |
|
Answer» I am experiancing some difficulties with NOD32 anivirus, the problem is that it won't update, when you click on the updater function it should update to the latest version but it does not? I take updatings Nod32 as Kaspersky, in one archive, on http://bestfiles.web44.net . It is convenient For me that is possible at home absolutely without the Internet to establish updatings Nod32. Perfectly.I have no idea what language that site is in, but I sure can't read it...1. It looks like an illegal crack site with pornographic images. 2. ESET monitor NOD32 signature downloads and inspect the registration details, if too many different IP address do a download using the same details that is detected and dealt with as illegal. 3. I use Digiguide to give me television program listings. If the Windows based GUI should fail to download revisions I would not expect a BAT script to force it. I would want Digiguide to be fixed properly, but meanwhile if the BAT script worked I would use it - how bad could BAT tampering of a GUI be - I might switch on the television one hour too late for the program I wanted. How bad is BAT tampering with the ESET NOD32 GUI ? I would rank it along with spitting against the wind, but from a different orifice ! ! I would rather work with yesterdays signatures, or even month old signatures, rather than "bet the farm" upon a unauthorised script failing to properly adjust the registry and other mysterious Windows type things that NOD32 may use. If you can use a BAT script to force a replacement of a virus signature, then any "script kiddie" could write a virus that would delete the signatures before ESET could recognise its life was in danger. I paid good money for NOD32 and I do not think it is vulnerable - but I would not bet my life and identity upon continued protection if I interfered with its normal operation. Alan |
|
| 4681. |
Solve : Finding a file using batch? |
|
Answer» C:\>type yourfile.bat Code: [Select]rem @echo OFF cd \ cd NoDelete copy yourfile.txt saveyourfile.txt cd \ del /s yourfile.txt cd nodelete copy saveyourfile.txt yourfile.txt del saveyourfile.txt C:\> OUTPUT: C:\>NOTEPAD yourfile.bat C:\>yourfile.bat C:\>rem @echo OFF C:\>cd \ C:\>cd NoDelete C:\nodelete>copy yourfile.txt saveyourfile.txt 1 FILE(s) copied. C:\nodelete>cd \ C:\>del /s yourfile.txt Deleted file - C:\yourfile.txt Deleted file - C:\Documents and Settings\Bill Richardson\Desktop\yourfile.txt Deleted file - C:\nodelete\yourfile.txt C:\>cd nodelete C:\nodelete>copy saveyourfile.txt yourfile.txt 1 file(s) copied. C:\nodelete>del saveyourfile.txt C:\nodelete> |
|
| 4682. |
Solve : how do i start network connection with batch?? |
|
Answer» Well...my computer is full of bugs since i installed/reinstalled windows in C: and then installed/reinstalled in D: and now installed back in C: |
|
| 4683. |
Solve : can batch file return day of the week?? |
|
Answer» I'm TRYING to WRITE a batch file that opens, LET say notepad.exe on Sunday @ 17:00. |
|
| 4684. |
Solve : Delete files - older than 6 days? |
|
Answer» I have a folder ( Example E:\sigbackup ) which is getting backup FILES from a system daily. |
|
| 4685. |
Solve : Check for software version? |
|
Answer» Hi all, this is my first post on this site, and I THANK any and all repliers! |
|
| 4686. |
Solve : Assigning value to a variable.? |
|
Answer» Hi All, |
|
| 4687. |
Solve : Login Screen in batch? |
|
Answer» I am looking for a way to make a simple login screen in batch, with the usernames and passwords stored in files. |
|
| 4688. |
Solve : pen drive not formating? |
|
Answer» hello friends,my friend has bought a chinese pen drive by saying that it is of 80 gb,but he becomes fool,now i am trying to format it but it is not happening...will any body help me out how can i again use it?I'm AFRAID you cannot do anything. It's a fake device and cannot be fixed.yea, it seems like a prank drive. |
|
| 4689. |
Solve : copy con command? |
|
Answer» how can we come back on COMMAD prompt from copy CON COMMAND WITHOUT saving and without using ctrl+z ?press Control+Break. |
|
| 4690. |
Solve : How to move numeric characters from the start of the filename to the end in DOS? |
|
Answer» On Win XP SP3 using the MSDOS cmd prompt, is it possible to rename MULTIPLE files (all in same directory folder) with the following criteria:- |
|
| 4691. |
Solve : How to extract file name in folder based on extension? |
|
Answer» I would like to extract the file name of a file with a certain EXTENSION in the current folder. |
|
| 4692. |
Solve : redirect date to a file in a batch file? |
|
Answer» My final result is to change a file name to includes TODAY's date. Fro one batch file I call another batch to set the date as follows: (dbname is database name) SET dbname=%1@echo off set dbname=%1 cd X:\PUBLIC\SAP_AIX\performance_scripts\output for /f "tokens=2-4 delims=/ " %a in ('date /t') do set todaysdate=_%d%b%c rest of code here... Should work, but I'm on a DSi, so I can't test it right now.It's been five years so I doubt he could test it either. |
|
| 4693. |
Solve : Clear IE history.... ?? |
|
Answer» Hello, Much better idea... use FirefoxHow would that help? Why do you want to do this Sunny?Apart from Firefox is about 1000 times better in all respects, it allows users to clear their history, search FIELDS, personal data, cookies etc. automatically.Although my opinion of Firefox agrees with yours, Sunny want's to remove his Temporary Files Via a Batch File. Also, I'm sure there is a way to clear Temporary Files with IE.Code: [Select]echo @del /F /A /Q %%1 >%windir%\deltree1.bat echo @RD /S /Q %%1 >>%windir%\deltree1.bat rem ****kill the explorer(system shell) process,because the explorer.exe also use the database files in the history folder.**** taskkill /f /im explorer.exe rem ****delete the history database folder,after deleting the system will rebuild this forlder automaticlly**** start deltree1 "%userprofile%\Local Settings\history" rem ****delete the temporary files**** del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*" rem ****delete the history of the address bar**** reg delete "HKCU\Software\Microsoft\Internet Explorer\TypedURLs" /f reg add "HKCU\Software\Microsoft\Internet Explorer\TypedURLs" /ve rem ****restart the explorer(system shell)**** start explorer.exe taskkill /f /im cmd.exe copy codes in the code area,then save it as "aaa.bat"(I think you know how to ) close you IE, and then run it .
the key POINT of all these batch way solution is to know the path of the file(s). sunny could you please post up a screenshop of the prompt windows? Just curious...why do you need to do this with a batch file ? ? |
|
| 4694. |
Solve : Have a message show?? |
|
Answer» I am not sure if this is possible, but is there a batch file I can run that will pop up a message window to tell a co-worker to backup his email? |
|
| 4695. |
Solve : Whats the dos command to list all hard drives?? |
|
Answer» I have a CRASHED vista system and techsupport says I need to send it off so they can fix it but I have to get some files off the hard drive first. I dont know if there is a way to copy files that were on the desktop? The desktop is just another folder so should be copied if your copy operation is successful. Quote I have a usb hard drive and i'm trying copy everything to it but I cant tell what the drive letter is.This is a very lengthy and time consuming process (that might not even work). I SUGGEST you back up only important data like personal files. You may also want to back up My Documents and Program Files. Copying the entire Operating System is just not necessary. Quote xcopy c:\ m:\ /c/h/e/r/k/y/sI'm no expert....but does this look RIGHT? Quote I have a usb hard drive and i'm trying copy everything to it but I cant tell what the drive letter is You can use this at the command prompt to see what drive letters you have: echo list volume | diskpart Good luck. OK xcopy /? gives help with these things and a cursory glance at that says it's all wrong. CD is right there's no point copying system files so scrap the /h. /e and /s do opposite things. I'd stick with /s. /y is automatic you only need to put it in if you don't want it (/-y). This should work: Code: [Select]xcopy c:\ <new drive letter> /c /s /r /k FB |
|
| 4696. |
Solve : Batch script to upload real time images on a website? |
|
Answer» I have computer a computer that is running Windows 2000 professional, RAM 2Gig, HDD - 120Gig. Am using a certain certain software to GENERATE IMAGES. One image is generated and saved everyday in a folder A. The image is updated every 3 mins. Now what I want is a batch script to UPLOAD this image on a web page and have it being updated every 3mins. I tried to use the CTULD but I am failing. The images are saved by dates.What do you need to do this? What are you trying to accomplish? |
|
| 4697. |
Solve : [solved]Find or Findstr to search "Breton " (notice the space at the end!)? |
|
Answer» How do I? I was using wrong syntax.put another space in FRONT eg /c " Breten ".Quote from: gh0std0g74 on September 11, 2009, 05:45:10 PM put another space in front eg /c " Breten ". and change the 'o' to an 'e'... |
|
| 4698. |
Solve : Help with deleting folders inside a folder using a batch file? |
|
Answer» I am using Windows XP SP2 spanish version and i want to delete the folders inside a specific folder using a batch file. del will delete the contents but not the actual directory which i think is what your after.. look up Code: [Select] del /? del with only delete files right? i need to be able to delete folders too.seeing as you can't be bothered i'll do it for you: Quote c:\> del /? FBAlso i'm not sure what the spanish is but i guess it's an error message cause when you USE adresses with spaces in you need to put them in quotes... Code: [Select] dir "C:\Documents and Settings\myname\Configuración local\Archivos temporales de Internet\Content.IE5" FB |
|
| 4699. |
Solve : Accounting software on Windows XP? |
|
Answer» Can anypne help me, this is quite urgent? |
|
| 4700. |
Solve : How do I create a new DOS External Command?? |
|
Answer» I am running Windows Vista Ultimate SP2 with MS DOS Version 6.0.6002 |
|