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.
| 7501. |
Solve : Downloading a file using a dos command? |
|
Answer» HI All, Do we have any MS DOS COMMAND to download a file from the internet.? I m sure there is one.. could you please help me with the syntax. http://stackoverflow.com/questions/1615612/how-can-you-download-a-file-zip-from-the-dos-commandline-using-putty This may help.the one I generally USE is wget.exe which you can GET here http://users.ugent.be/~bpuype/cgi-bin/fetch.pl?dl=wget/wget-1.10.2.exe |
|
| 7502. |
Solve : Installing fonts? |
|
Answer» Hi! At my job I am working with a strictly DOS system, no version of Windows is installed on this computer, and I have some fonts that I NEED to install. I have the fonts on a disk, and I can pull up the directory of that disk and see the fonts on it, but what commands do I use to find the font directory on the c: drive? And once I have found the font directory on c:, what commands do I use to copy the fonts from the disk to that directory? I am experienced working with Windows, but when it comes to DOS I know very little.DOS doesn't even have a concept of fonts. DOS doesn't even have a concept of fonts.Quote MS-DOS does not support the concept of DIFFERENT fonts, it does (or at least the graphics card does) support the concept of changing screen resolution, which has the effect of changing the font.http://www.jasspa.com/me/m2cmd027.htmlA:) DOS doesn't support fonts, aside from the default, VIDEO card-provided text mode font. PERIOD. no exceptions. DOS APPLICATIONS might, DOS itself does not. the only "font" support is by hacking around video memory and changing the bitmaps for the text mode display, which doesn't change a font any more then drawing a picture in paint is changing a font. At the DOS prompt- that is, when you are RUNNING only DOS- you cannot change the video resolution, except for a few instances such as mode commands or changing the number of columns or rows. In those cases, it doesn't use "fonts" any more then it is using "predefined bitmaps in video memory". Can you change those? yes. That doesn't mean they are fonts, nor does it necessarily mean that DOS supports fonts because it happens to be running while all this is going on. There is no "fonts" directory in DOS. you cannot install Fonts in DOS. |
|
| 7503. |
Solve : Batch Program: flush dns and reboot? |
|
Answer» This is for use on a Windows XP/NT environment |
|
| 7504. |
Solve : How to delete ext dos partition, when it says it has logical drives, but doesn't? |
|
Answer» Hi, I'm working on a friends MACHINE, and trying to DELETE this ext dos partition. It says it has logical drives, but when I try to delete them, it says it doesn't. Any ideas? |
|
| 7505. |
Solve : password batch? |
|
Answer» ok i have a flash drive that if lost has personal numbers and such that i dont want just anyone to find... if i place all the documents into one folder and make it so when u open that folder a batch starts up can i have that batch prompt a password? and if u enter the wrong password it doesnt let u access the document? if so please POST the script or whateverits called. im a noob in need of advice im trying to teach myself batches but this is a lil complexWhat software did you use to create these documents? Microsoft Office programs have built-in security methods at the document level. You probably COULD set passwords on documents programmatically with VBSCRIPT. Other publishers may also have security methods you can use. Caution: If you lose or forget your password, it can't be recovered, and you won't be able to open your document/database. You'd be surprised how often that COMES up, used notepad and this info isnt top secret just personal so it just needs to stop ur basic computer user not a wiz kid... It doesn't take a "Wiz kid" to hit the X button. You've been TOLD this countless times. Let's have a recap: Quote [16:10] <cmdpro> so culd i write a batch Basically- No. you can't. If you are using XP pro you can encrypt the file.You can always give this a try.... http://keepass.info/ |
|
| 7506. |
Solve : Multiple batch file option? |
|
Answer» Hi, so it will be very helpful if you provide me that code. Surely you can work it out for yourself? Substitute: if errorlevel 1... for... if errorlevel 0 goto eof Quote from: Salmon Trout on October 04, 2011, 12:13:21 AM Surely you can work it out for yourself? Sometimes.........it just doesn't make sense. Personally what I might do is make each batch script create a lock file after first checking for the existence of the other script's lock file and exiting if it is found. Or you could make it wait in a loop until the other script's lock file becomes non-existent. If it is not found, then the script creates its own lock file, performs it operations, then finally deletes its lock file. e.g. REM Batch A if exist batchB.lock exit echo abcde > batchA.lock bla bla bla bla bla bla del batchA.lock REM Batch B if exist batchA.lock exit echo abcde > batchB.lock bla bla bla bla bla bla del batchB.lock |
|
| 7507. |
Solve : Output Redirection Control? |
|
Answer» Currently I check the disk free space on several servers and day and each of them have several drives mounted. They are all MS Windows Server 2000 and up. My goal is to create a log file for the disk checking. I only have one server and one drive in the batch file while I work on this. Here is what I currently have: and then use FOR to get the line of DIR output that has the "bytes free" figure into another string |
|
| 7508. |
Solve : How to assign two IP address in one NIC card using batch script? |
|
Answer» Hello All, |
|
| 7509. |
Solve : batch loop? |
|
Answer» Code: [Select]@ECHO off The idea of the program is if a drive exists then to backup the drive to D:\backup but if the drive doesn't exist then the progaram should loop until it does. Any help appreciated as i clearly am making a stupid mistake. Looping the batch code until a drive exists might take a while. Might be better to INVENTORY the DRIVES and backup the ones that you find. Don't know your OS, so I took a guess you have the DISKPART utility. Code: [Select]@echo off for /f "tokens=3" %%i in ('echo list volume ^| diskpart ^| find /i "partition"') do ( xcopy %%i:\ d:\backup\%%ibackup /e /h /i /q /y ) I added a directory level for each drive backup. Good luck. Thanks for that but what I want is for it to automatically backup my USB drive every time i plug it in which is why i want it to keep trying until its plugged in. Is there a way to do this even if it isn't the best way?Code: [Select]:loop if exist "E:\NUL" goto found goto loop :found XCOPY F: D:\backup /E /H /I /Q /Y This isn't a batch but it may help, or give you an idea: http://www.backup4all.com/kb/configuring-a-backup-to-run-automatically-when-the-usb-drive-is-plugged-in-248.html for example, although it uses a program called "backup4all" you could use the autorun file to run a batch. |
|
| 7510. |
Solve : change my wallpaper each time i login? |
|
Answer» Hello, what about if i wanted to do it in DOS First you would need a machine with DOS installed. Why do you want to use batch code anyway on a WinXP machine? Code: [Select]@echo off set source="source directory goes here" set dest="destination directory goes here" for /f "tokens=* delims=" %%i in ('dir /ta /b /o:d %source%') do ( echo y | copy "%source%\%%i" "%dest%" > nul echo Y | copy /b "%dest%\%%i" "%source%" > nul echo y | reg add "HKCU\Control Panel\Desktop" /v Wallpaper /d "%dest%\%%i" > nul goto :eof ) Be sure to change source and dest to valid directory names otherwise its the same stuff as yesterday: The script will select a picture each time it is run and update the registry. If you have a shutdown script, I would put it in there so the wallpaper resets at the next boot. If you put it in the startup folder, the wallpaper change may not take effect until you logoff/logon. You may have to play around with this. hello, Im a former Cobol programmer, so im learning as i go .....so I dont have VB to develop in but I do know a little about dos...not much as you can see if there is a way to develop in VB without having to pay for it ....i could do that ?? I tried the dos script but it gave me this Source = "C:\path\input" Dest = "C:\path\output" copy ""C:\path\input"\pic1.jpg" ""C:\path\output"" and the copy didnt work thanks for your help cheers Check out Microsofts Express range http://www.microsoft.com/express/Windows/ GrahamQuote from: newkid on July 23, 2010, 04:56:36 AM Im a former Cobol programmer You might like COBOL.NET I guess I got a little carried away with the quotes. Code: [Select]@echo off set source=source directory goes here set dest=destination directory goes here for /f "tokens=* delims=" %%i in ('dir /a:-d /ta /b /o:d "%source%"') do ( echo y | copy "%source%\%%i" "%dest%" > nul echo Y | copy /b "%dest%\%%i" "%source%" > nul echo y | reg add "HKCU\Control Panel\Desktop" /v Wallpaper /d "%dest%\%%i" > nul goto :eof ) Do not quote the source or dest values at the beginning of the code even if the PATHS have embedded spaces. They will be inserted at the proper time. For the record, the first script I posted was VBScript which was installed on your system with Windows. All you need now is a DOLLAR and a dream. There is a compiled help file for VBScript (script56.chm) which you can search for on your machine or you can download it from here Except for REXX, IMO VBScript is one of the easiest script languages to learn and has much more functionality than batch code could ever hope to have. Good luck. It WORKS ...thanks very much !! Hello, As I looked for the same (i.e. a small script or tool to change the Windows wallpaper in a random way every day - and without downloading an .exe file...), I tried the VB script available at the URL: http://sites.google.com/site/sharerandomwallpapers/ It works fine and handles a variable number of files (the VB script listed above only handles 3 files or a constant number of files...). I hope it will bring some help! John |
|
| 7511. |
Solve : BATCH GAME HELP!!? |
|
Answer» Is there any way to make a PLAYER earn points in a batch file game??The qustion makes no sense as stated...Quote from: lewy on August 11, 2011, 01:10:46 AM Is there any way to make a player earn points in a batch file game?? You can have a player ACCUMULATE points and on exit write the number to a file and read the score in the next time the game is run. Please note, in English we only use ONE question mark at a time. Code: [Select]@echo off echo *************** echo * * echo * Simple Game * echo * * echo *************** echo. set /p player="Your name? " set score=0 if exist %player%.score ( for /f %%A in (%player%.score) do set score=%%A echo Welcome back %player% ) else ( echo Hello new player %player% set score = 0 ) echo Your score is %score% set /p answer="5 + 5 = " if %answer% equ 10 ( echo correct set /a score+=1 ) else ( echo incorrect ) echo Your score is %score% set /p answer="8 - 3 = " if %answer% equ 5 ( echo correct set /a score+=1 ) else ( echo incorrect ) echo Your score is %score% set /p answer="25 x 4 = " if %answer% equ 100 ( echo correct set /a score+=1 ) else ( echo incorrect ) echo Your score is %score% echo Saving your score... echo %score% > %player%.score echo Goodbye Thoughts - You would NEED to think about if you want the player to retain points after they have stopped the script or if you want the points to be maintained within memory for only the time frame of running the script. Points can be used using the math dos variable set \a points=1+%points% and if you want it saved to a file you would redirect the points to a file name.Quote from: Darth on October 05, 2011, 06:55:15 PM Points can be used using the math dos variable set \a points=1+%points% This is exactly what I already wrote, except you GOT the slash around the wrong way. |
|
| 7512. |
Solve : Batch script Echo redirection symbols.? |
|
Answer» Win XP Cmd.exe |
|
| 7513. |
Solve : Copy a File or Directory form one Drvie to Multiple Drives? |
|
Answer» Hi Guys, xcopy "C:\MyFiles\*.*" "D:\MyFiles\" /s /y /H /R /D I don't know if this will help you or not....but I do hope so. Cheers Mate! The Shadow |
|
| 7514. |
Solve : can anyone tell me that how can i close media player through a command prompt? |
|
Answer» can anyone TELL me that how can i close media player through a command prompt or a batch file?Which media player? If your using the Windows Media Player, you can use the /close switch at both the command LINE or in a batch file. |
|
| 7515. |
Solve : Batch commands for 32 or 64bit? |
|
Answer» How would I WRITE a BATCH that allowed for registry uninstall by OS. |
|
| 7516. |
Solve : Find and Replace one string with another inside the file using DOS batch? |
|
Answer» Wow, this thread just keeps getting revived from the grave. Fun. for /f "delims=" %%G in (changefile.txt) do ( One error: there is no ~ after the colon in the set newstring line. It should read: set newstring=!oldstring:0, 52=0, 21! |
|
| 7517. |
Solve : net user Error Code? |
|
Answer» Hi, |
|
| 7518. |
Solve : Making [Y/N] questions in batch files? |
|
Answer» the NT version is the one that you would want.3.1 or 3.5?Quote from: PirateSamir on January 26, 2009, 10:57:24 AM 3.1 or 3.5? Either, or NT4, or Win2K resource kit k thnx, i got 3.5 gonna learn to use it now Quote from: PirateSamir on January 26, 2009, 11:38:43 AM k thnx, i got 3.5Code: [Select]Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\>choice /? CHOICE [/C[:]choices] [/N] [/S] [/T[:]c,nn] [text] /C[:]choices SPECIFIES allowable keys. Default is YN /N Do not display choices and ? at end of prompt string. /S Treat choice keys as case sensitive. /T[:]c,nn Default choice to c after nn seconds text Prompt string to display ERRORLEVEL is set to OFFSET of key user presses in choices. ok, 2 questions how would define your default choice? and what is errorlevel? (i've seen it quite oftenly in batch files) Quote from: PirateSamir on January 26, 2009, 11:55:00 AM ok, 2 questions Example Default choice is Y, timeout is 10 seconds Code: [Select]choice /C:YN /T:Y,10 Press Y or N echo errorlevel is: %errorlevel% If Y was PRESSED (or timeout occurred) the %errorlevel% will be 1 (because Y is choice 1) and if N was pressed %errorlevel% will be 2 (because N is the second choice) errorlevel is a system variable which is set by a program. Often 0=no ERROR, 1 or more means an error. Choice uses it to PASS the key pressed. Code: [Select]S:\>chtest1.bat Press Y or N [Y,N]?Y errorlevel is: 1 S:\>chtest1.bat Press Y or N [Y,N]?N errorlevel is: 2so can errorlevel be used for anything else?Quote from: PirateSamir on January 26, 2009, 12:49:58 PM so can errorlevel be used for anything else? Yes. Code: [Select]dir *.txt if %errorlevel% GTR 0 echo "No text files" Plenty of information if you use Google. ok thnx Quote from: hiteshsavla on January 23, 2009, 03:16:25 PM Code: [Select]@ECHO OFF Thanks hiteshsavla - Exactly what I required, saved me a lot of time. (I write batch files so infrequently these days that it takes time to get back into it) |
|
| 7519. |
Solve : loop a batch file that reaads parameter from an external file in XP? |
|
Answer» here is what i am trying to doI'm not UNDERSTANDING the question. Are these parameters in response to a PROMPT issued by the program? or are they VARIABLES for the batch code itself? It would help if you would show your code and exactly what you need to do. |
|
| 7520. |
Solve : Batch file only processing a number of records instead of the full file? |
|
Answer» Hi, well, the only thing we can't ignore is he provided a legit solution, so there's nothing really "wrong" with that. I suppose you have a point, but he shouldn't be encouraged! |
|
| 7521. |
Solve : Batch Files and Deleting Subdirectories? |
|
Answer» Alright lets say for example I have the following file structure C:\Users\user name\DOWNLOADS\ |
|
| 7522. |
Solve : De-mute and pump up the volume? |
|
Answer» I want to make a batch-file that should turn off MUTING (you know, the one that resides in the systray) and then set the volume at maximum. You may have problems attempting a batch solution. Better to use a VBScript where you can interact with the Volume Control. @sidewinder: No VBScripting since I'm totally unfamiliar with that. BTW, we do not have external speakers, so even with the volume at max it would be close to inaudible. But I realize now this warning could scare the begeebers out off persons if they run it at a place that does have speakers PLUGGED in. Quote from: Dias de verano on July 09, 2008, 08:42:00 AM I don't think I like this idea. It sounds suspiciously like a "prank", or worse, especially when read alongside your other post about hiding Media Player. @Dias: This was meant to run mediaplayer on the background, yes. I did not want users to drag or close screens before the process is finished. Loading time tends to be extremely slow at times and people can be impatient. I 'm new to this and got carried away a little, reading this site. Thought of this solution at first as a funny way to warn. Forgot the KISS principle. Popup messages appear allmost instantly and stay on screen until user input. Sounds do neither. Using messages is indeed a gentler way, as Sidewinder stated and I 'm looking into it right now. Thank you both for your feedback and showing me the right path. Dramklukkel |
|
| 7523. |
Solve : Using variables inside variables? |
|
Answer» i'm trying to make a simple way to block websites if i lock my machine, the problem is i have a bunch of variables with . . . . . in them and they are set to v.0 v.1 v.2 ect and i need to seperate the variable and have a variable that can increase , this is what i have so far @echo off set c=0 set d=0 for /f "tokens=1* skip=1" %%a in ('ipconfig /displaydns') do echo %%b>>%temp%\v.t for /f "tokens=1* skip=1" %%a in ('findstr .COM %temp%\v.t') do ( call set /a c=%%c%%+1 call set c.%%c%%=%%b call set d=%c% ) i need a way to use a variable inside another variable because i dont know how many there is going to be for example, %c.%d%:~11,100% instead of %c.1:~11,100%well you realy need use a Code: [Select]setlocal enabledelayedexpansion for seting variable in loopthanks, so i've been reading more about how this makes it so the variable expansion takes place before the execution of the for command, i understand how it works just not the syntax @echo off setlocal enabledelayedexpansion set c=0 set d=0 for /f "tokens=1* skip=1" %%a in ('ipconfig /displaydns') do echo %%b>>%temp%\v.t for /f "tokens=1* skip=1" %%a in ('findstr .com %temp%\v.t') do ( call set /a c=%%c%%+1 call set c.%%c%%=%%b setlocal d=%c% ) what am i doing wrong?diablo, could you explain in a bit more detail just what it is you are trying to do? In words, I mean? I'm creating a lock similar to winkey + L only without the password it disables .exe programs and webpages, i noticed recently active connections are viewable using ipconfig /displaydns, the part i dident bother typing was adding them to the host file when i use FOR to get the tokens , the closest i can get it down too is . . . . . : www.weburl.com , as an example i'm not sure why there is . . . . . : infront of it anyways, to solve this problem i decided to set it into variables and split up the variable to ignore the . . . . . : because i didnt think there was ANYWAY to set delims for charachters, without it ignoring the entire line.. , so i already know splitting the variable to ignore the first 11 charachters is what i want, so %c.1:~11,100% my problem is , there could be well over 100 of them.. and i need to add an ADDITIONAL variable, since all the variables set are c.1,c.2,c.3 , and since i will never know how many there are, and want to avoid lots of lines of code .. i need to use the variable already being set as D , witch is the number of Times LOOPED or in this case would be used as the number of the variable set , and total number set when its finished' i need to use it as a way to increase itself without adding lots of lines.. like for example for /f "tokens=1* skip=1" %%a in ('findstr .com %temp%\v.t') do ( call set /a c=%%c%%+1 call set c.%%c%%=%%b setlocal d=%c% call echo 127.0.0.1 %C.%d%:~11,145%>>hostfiledir\hostfile )You want to process the output of ipconfig /displaydns? and grab something? What? Code: [Select]www.kuching.co.uk ---------------------------------------- Record NAME . . . . . : www.kuching.co.uk Record Type . . . . . : 5 Time To Live . . . . : 11313 Data Length . . . . . : 4 Section . . . . . . . : Answer CNAME Record . . . . : homepages.plus.net pop3.blueyonder.co.uk ---------------------------------------- Record Name . . . . . : pop3.blueyonder.co.uk Record Type . . . . . : 1 Time To Live . . . . : 14192 Data Length . . . . . : 4 Section . . . . . . . : Answer A (Host) Record . . . : 195.188.53.61 www.onvon.com ---------------------------------------- Record Name . . . . . : www.onvon.com Record Type . . . . . : 5 Time To Live . . . . : 8243 Data Length . . . . . : 4 Section . . . . . . . : Answer CNAME Record . . . . : onvon.com news-text.blueyonder.co.uk ---------------------------------------- Record Name . . . . . : news-text.blueyonder.co.uk Record Type . . . . . : 1 Time To Live . . . . : 3879 Data Length . . . . . : 4 Section . . . . . . . : Answer A (Host) Record . . . : 195.188.240.200 here is example of using setlocal with Code: [Select]setlocal enabledelayedexpansion if 1 equ 1 ( set var=END goto !var! ) exit :END pause without Code: [Select]if 1 equ 1 ( set var=END goto %var% ) exit :END pausein the second example, in the third line, %var% will be blank.thanks, but i still dont understand.. setlocal enabledelayedexpansion set h.0=3985u90289g28gj2 set var=0 echo %h.!var!:~0,1% and yes im trying to process the output of ipconfig /displaydns, except i cant seem to get just the host name, like www.google.com when i use for i get . . . . : www.google.com and since i need to echo more then one of these variables into the host file, i need it to count automatically.. like echo %c.%d%:~11,100% instead of having to type echo %c.0:~11,100% echo %c.1:~11,100% echo %c.2:~11,100% echo %c.3:~11,100% echo %c.4:~11,100% echo %c.5:~11,100% because i wont know how many variables it sets to begin with..Is this going in the right direction? Code: [Select]@echo off setlocal enabledelayedexpansion REM for each section, isolate the Record Name line REM use the colon symbol as delimiter REM so that there are 2 tokens REM grab the 2nd token REM and remove the leading space it will contain for /f "tokens=1,2 delims=:" %%A in ('ipconfig /displaydns ^| find "Record Name"') do ( set recname=%%B set recname=!recname: =! echo !recname! ) thanks dias and devcom i understand now. This wont work at all will it? lol , i just realized ipconfig /displaydns is whats already in my hostfileNo it isn't only what is in your hosts file. It shows the contents of the Domain Name System (DNS) client resolver cache, which includes entries that are preloaded from the local Hosts file, as well as any recently obtained resource records for name queries that were resolved by the system. |
|
| 7524. |
Solve : Creating folders using the date? |
|
Answer» I am trying to figure out how to create new folders in DOS by using a date stamp. You'll need to parse the date to eliminate the forward slashes (MMDDYYYY)Ah right. My format is DD-MM-YY Quote Ah right. My format is DD-MM-YY Changing the delimiters and flipping the variables would be what I meant by: Quote Any code concerning dates is dependent on your local settings. You may have to make some minor adjustments to the code. Code: [Select]@echo off for /f "tokens=2-4 delims=- " %%i in ('date /t') do ( md c:\folder\%%j%%i%%k ) Many languages have functions for returning singular values for day, month and year regardless of format. Batch code can return the date; the USER has to be aware of the format. |
|
| 7525. |
Solve : Computer language and the meaning and the definition? |
|
Answer» I would like to DEFINITION and what it means and what it says and stands for such as dos, alo, bsd, linus, unix, and all the other definition LETTERS that are use when trying to understand or FIX something that only gives letters and you must know what those letters STAND for thank you [removed] |
|
| 7526. |
Solve : how do you copy a hidden file? |
|
Answer» Hi, |
|
| 7527. |
Solve : Problem using DOS xcopy and a French keybaord? |
|
Answer» Hi all, I need someone with more knowledge than I have! |
|
| 7528. |
Solve : find and copy? |
|
Answer» I am trying to find a list of files using wildcards (*.abcd.*) and copy them to another location. I am using xcopy to do that but the problem is that the directory has about 60000 files and it is taking for ever for me to run the batch file. |
|
| 7529. |
Solve : how to reject cdrom? |
|
Answer» RSM command can be used to reject / load for cdrom |
|
| 7530. |
Solve : batch file not working in XP? |
|
Answer» Can someone tell me why this does not work on XP. |
|
| 7531. |
Solve : Run batch file based on user logged in.? |
|
Answer» Hi All |
|
| 7532. |
Solve : switching to windows? |
|
Answer» could anybody kindly let me KNOW what shortcut keys would let us switch to windows when one is playing a GAME in MS DOS mode. here it was not possible to write command.. and do anything.. when restarted again the same game comes...... not possible to exit from the game as well... |
|
| 7533. |
Solve : Testing for number of Dir's in a batchfile? |
|
Answer» Hi all if "%count%" GEQ "22" (goto :cont else (echo ... & goto :failed) You could try getting rid of all those messy quotes (count has a value even if it might be zero). Also the IF statement syntax is incorrect: Code: [Select]if %count% GEQ 22 (goto :cont) else (echo ... & goto :failed) It's DOUBTFUL that only the first significant digit is being used in the compare. Good luck. 8-) |
|
| 7534. |
Solve : Extracting directory from full path filename? |
|
Answer» Hi there! |
|
| 7535. |
Solve : String entry routine for DOS? |
|
Answer» I am looking for a "string entry" routine that can be included in a batch file; I need to enter a filename into a batch file and cannot figure out how to do it. I had a routine that I got from the internet a couple of years ago which I have reprinted below. Although I have NO CLUE how this works, it DID work FINE until the company upgraded my computer to Windows 2000 PROFESSIONAL. Now, whenever I try to use this routine, all I get is the error message: |
|
| 7536. |
Solve : Error 32768? |
|
Answer» Trying to re-install xp and KEEP GETTING a |
|
| 7537. |
Solve : Password commands in batch files? |
|
Answer» I'm TRYING to write a batch file to automate a SQL server truncate command, but it requires a password to be put in to access the command lines. How do I write the Batch file to automatically enter the password?You might try using the pipe, but be aware that not all PROGRAMS can TAKE info this way: |
|
| 7538. |
Solve : Re: For someone else.? |
|
Answer» Either a VBSCRIPT, which has a sendkey method where you could send the F4 key or a program called AutoIt WOULD be a good solution. |
|
| 7539. |
Solve : complicated question? |
|
Answer» ok, here's the thing, perhaps anoyne in amerika looks to the tv serie lost (www.lost.abc.com). In the "hatch" there is a computer where you have to enter a code correctly and on time every 108 minutes... I was wondering if it is possible to do such thing in batch to. This is what the batch should do: The only thing I can think of is using the shutdown prompt, and just changing the amount of time you have. not such bad idea, but than i still don't have, the thing if you enter the code that it don't shut down. Anybody other ideas?You really need something other than a batch file for this. A HTML Application (HTA) would be a likely solution; the window object has a setinterval method that might be helpful. The problem here is you need two threads (windows) which need some common point of communication. You ask for a dinky batch solution, so I put forth dinky: Boom.bat Code: [Select]@echo off echo 0 > boom.txt set count=0 :tag sleep 1 for /f %%i in (boom.txt) do ( call set /a count=%%i+1 if %count%==6480 ( echo Boom! goto :eof ) else ( echo %count% > boom.txt ) ) goto tag Code.bat Code: [Select]@echo off start boom :tag set /p var=Enter Code: if .%var%==.8 (echo 0 > boom.txt) goto tag PS. If you need a copy of sleep, try Google for a standalone copy or download the Win2003 Resource Kit.Quote You really need something other than a batch file for this. A HTML Application (HTA) would be a likely solution; the window object has a setinterval method that might be helpful. i tried a few things out but i don't really understand what the codes does. when i use the script (i open code.bat) i get two dos screens, one whit enter code and another that does nothing, you can't type in it. When i enter 8 nothing seems to happen. And when I enter a code nothing happens.... What i tried to get was: counting from 108 till zero. If you enter the CORRECT code (the number example at the 70th minute, it recounts from 108 till zero, and so one. If you enter the WRONG code, it says immediately boom OR if you enter the code not at time (not within the 108 minutes) it says boom too. so perhaps i do something wrong, because the things i want doens't seems to work, can you help me pleas... greetz blackberry Code: [Select]@echo off start boom :tag set /p var=Enter Code: if .%var%==.8 (echo 0 > boom.txt) else (echo 6479 > boom.txt) goto tag FYI: Most scripting languages can do date/time arithmetic; batch cannot. Instead of counting down, it's easier to count up to a predetermined number (60*108 with a 1 second delay between increments). Hope this helps. 8-)There might be an easier way to do this but here is what I have. You have to use 2 batch files. The code to restart the countdown is 4, 8, 15, 16, 23, 42, RUN this batch file to start the countdown Code: [Select]@echo off TITLE Lost Menu start countdown.bat :MENU CLS Echo Enter in code set /p code= echo %code% >%temp%\entercode GOTO MENU Countdown batch file Code: [Select]@echo off :start SET thecode=0 IF EXIST %temp%\entercode del %temp%\entercode SET D=8 SET T=0 SET H=1 GOTO COUNTDOWN :BEGIN IF EXIST %temp%\entercode FOR /F "tokens=1* delims=" %%A IN ('TYPE %temp%\entercode ^| findstr /I "4, 8, 15, 16, 23, 42,"') do set thecode=1 if "%thecode%"=="1" GOTO START IF "%COUNT%"=="099" GOTO DIGITS IF "%COUNT%"=="009" GOTO DIGITS IF "%COUNT%"=="100" set COUNT=099 IF "%COUNT%"=="010" set COUNT=009 IF "%COUNT%"=="099" GOTO 1SKIP IF "%COUNT%"=="009" GOTO 1SKIP :DIGITS IF "%COUNT%"=="099" SET H=0 IF "%COUNT%"=="099" SET T=9 IF "%COUNT%"=="099" SET D=9 IF "%COUNT%"=="009" SET T=0 IF "%COUNT%"=="009" SET D=9 IF %D%==0 goto TENS if %D%==1 set D=0 if %D%==2 set D=1 if %D%==3 set D=2 if %D%==4 set D=3 if %D%==5 set D=4 if %D%==6 set D=5 if %D%==7 set D=6 if %D%==8 set D=7 if %D%==9 set D=8 goto COUNTDOWN :TENS if %D%==0 SET D=9 if %T%==1 set T=0 if %T%==2 set T=1 if %T%==3 set T=2 if %T%==4 set T=3 if %T%==5 set T=4 if %T%==6 set T=5 if %T%==7 set T=6 if %T%==8 set T=7 if %T%==9 set T=8 if %T%==0 set T=9 goto COUNTDOWN :COUNTDOWN SET COUNT=%H%%T%%D% Title Minutes Remianing %count% IF %COUNT%==000 GOTO BAD :1SKIP cls echo Time Remaining %count% ping -n 2 127.0.0.1 >NUL GOTO BEGIN :BAD CLS Echo You are too late Process's are set in motion pause EXITForgot change the Ping statement to 60 seconds ping -n 60 127.0.0.1 >NUL If you use sleep.exe it is a little more accurate at counting. Quote There might be an easier way to do this but here is what I have. You have to use 2 batch files. The code to restart the countdown is 4, 8, 15, 16, 23, 42, fantastic code, but... if you enter the code wrong, nothing happens, and it should happen something. But thanx for the code yet! another problem that i like to be solved, is if you just enter 4, 8, it recounts to, so is it possible that you have enter correctly the exactly combination, nothing else To make it require the exact code change the findstr. This will make it require the exact passcode Code: [Select]IF EXIST %temp%\entercode FOR /F "tokens=1* delims=" %%A IN ('TYPE %temp%\entercode ^| findstr /I /C:"4, 8, 15, 16, 23, 42,"') do set thecode=1 Insert the line below after this lineif "%thecode%"=="1" GOTO START This if they enter the wrong code. Code: [Select]IF EXIST %temp%\entercode GOTO Wrong then add this to the bottom of the file Code: [Select]:wrong cls Echo. Echo You Entered in the worng cade, That was a bad mistake. echo. pause Have funQuote To make it require the exact code change the findstr. bad code, it doesn't work! nothing happens if you enter the wrong code, beside it should be possible if you just enter 4, 8 that is shows the message too, because 4, 8 is just a part of the code and is wrong, does anybody knows an other solution Aren't you being a bit unreasonable? Two solutions have been offered and all the feedback we've gotten is "it doesn't work" or "I don't understand the code" or "this is what I want". It doesn't help that the SPECIFICATIONS keep changing with each post. You already know quite a bit. You know you need two threads, you have two different techniques for implementing a timer, and you have enough code to choke a horse. All you need to do is put it together. The best way to learn is by doing. 8-) Please don't post back with one your more colorful "*censored* is your problem?" comments. We've seen it all before. I only come here for the entertainment, I am never disappointed. Quote Aren't you being a bit unreasonable? Two solutions have been offered and all the feedback we've gotten is "it doesn't work" or "I don't understand the code" or "this is what I want". It doesn't help that the specifications keep changing with each post. lol first of all i only use the such sentences like *censored* is your problem for peoples who really iritate me, just posting here some crap or want to make VIRUSES, or who thinks they have the right to SCOLD to someone (mostly that last reason). now second, when I read you message it looks like you think that I don't appreciate at all the help the people gave me. That is a totaly wrong vision, I really appreciate the help people gives me, but with my last post I was a bit disappointed that it didn't worked... So I asked (perhaps on a bit impolite way) if he -or anybode else- knew an other solution. and my thirth and last point on your text, you say you have enough code to choke a horse..... i'm here for learning and yes i learned a lot yet, but you can't expect that if you post a totaly strange code for me, that I understand it within the minute... I am still busy to decipher it.. and if you think that it isn't so hard, whell you can take my work over as seen you can understand everything in two minutes. By monday I would like to have some calculatings for my house that i'm designing now (i'm an architect) |
|
| 7540. |
Solve : how to catch return code/message of Cacls command? |
|
Answer» Does anyone know if Cacls.exe returns any code or any message? I have a system command like: system(cacls.exe ....), sometimes the command fails, I need to, instead of USE "system(...)" which does not catch any error code or message, output the error code and message and at the same TIME notify people that this permission command fails. Your help will be greatly appreciated!I GET %errorlevel% 0 if the command works. And I get %errorlevel% 0 if the command fails cause it can't find the folder. |
|
| 7541. |
Solve : List files on drive????? |
|
Answer» OK This is probably a really easy question for most of you and what makes it worse is that I KNOW that I used to know the answer. Age is a nasty business. messes with the memory cells. :-? |
|
| 7542. |
Solve : Start XP in Dos, anyone?? |
|
Answer» Yeah, so... I have a floppy diskette, and I want to know if there is any possible way to Boot from the disk, and Enter command/run program/satanic ritual (j/k) to start windows. |
|
| 7543. |
Solve : ms dos commands? |
|
Answer» ok this is weird, i changed it to c:\windows\system32\cmd.exe, and when i type cmd it says c:\windows\system32\cmd.exe up the top, but it doesnt work like usual, if i run c:\windows\system32\cmd.exe or type set path=C:\WINDOWS\system32 in cmd it works... well thanx for all the help ppls:DIt's not weird at all. Running the program with c:\windows\system32\cmd.exe changes the PROMPT to indicate you're logged in to the c:\windows\system32 DIRECTORY. This is where the external commands live and Windows always searches the CURRENT directory before checking the directories on the path. |
|
| 7544. |
Solve : Folder sharing attribute in MS-DOS.? |
|
Answer» Hi! I was wondering, is ther any way I can set the sharing attibutes of a folder using MS-DOS commands and assign ACCESS permissions to it?you can change or give folder / file permissions to a group or a user with: |
|
| 7545. |
Solve : Getting %2 %3 %4... in one variable (Batchfile)? |
|
Answer» Hello... |
|
| 7546. |
Solve : Regedit and Batch file help? |
|
Answer» Hello, I'm needing something probably pretty simple for some of you out there. |
|
| 7547. |
Solve : C drive help? |
|
Answer» It's an EPIDEMIC! |
|
| 7548. |
Solve : Commodore64 joystick? |
|
Answer» Hey there everyone! Are you sure it is a serial device. I don't think so. Neither do I. It just happens to use a DB9 connector. +---------> Right | +-------> Left | | +-----> Down | | | +---> Up | | | | _____________ 5 \ x o o o o / 1 \ x o x o / 9 `~~~~~~~' 6 | | | +----> Button +--------> Ground OK,, ignore my post. Commodore64 joystick was not like the Apple type joystick. Instead it was a bang-button type where it is all or nothing, no degree of movement. I was thinking of the analog joystick.Hmmm, ok. I had heard that it was possible to do it, hence why I asked. I do have an analog joystick for an old macintosh (uses the old Apple Serial plug, looks similar to the old PS/2). Please note, the computer I'm using to run MS-DOS is a Toshiba Satellite 2520CDT. It only has 1 DB-9 (serial) and 1 parallel (printer) port, there is no game port, and no replicator expansion port like some older LAPTOPS have. Just letting you know. So I doubt that I could get the Apple joy to work because of the port type. So is there no way to get the Commodore64 joy to work? no driver build or config setup? I have searched around the net for a solution, and I can only get other joys and reviews of the commodore64.Quote from: kosmro on March 19, 2012, 03:46:42 PM Hmmm, ok. I had heard that it was possible to do it, hence why I asked. I do have an analog joystick for an old macintosh (uses the old Apple Serial plug, looks similar to the old PS/2). Build yourself an interface Or buy one USB Atari RetroPort (works with Atari, Commodore, and Sega Master System digital gamepads and digital joysticks) http://www.retrousb.com/product_info.php?cPath=21&products_id=70 Stelladaptor 2600 Controller to USB Interface http://www.stelladaptor.com/ Or buy a joystick with a USB plug There is plenty of info out there, I'm surprised you could not find any, I just GOOGLED for "commodore joystick to pc" and found plenty of sites and this forum thread (just one of many) http://sleepingelephant.com/ipw-web/bulletin/bb/viewtopic.php?t=4726&sid=5b9e0133ee61836a4989f19956a30f4dBut does USB work with MS-DOS? |
|
| 7549. |
Solve : startup in DOS not Windows 2000? |
|
Answer» I need to remove INFECTED files in windows temp file. I have directions from OfficeScan but it says to restart in MS-DOS mode |
|
| 7550. |
Solve : Replace '/' char in a DOS Batch File variable? |
|
Answer» I have captured today's date into a DOS batch file variable (under XP) using : |
|