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.
| 7751. |
Solve : Ms Dos command to know in which drive the operating system is installed? |
|
Answer» Hi everybody, I am chaitanya. I need some help regarding the operating system installation path. There is no rule that the operating system must be installed in 'c' drive only. So I need a command to know in which drive the operating system is installed. Sir %SystemDrive% is not working. My operating system is Windows XP Service Pack 3 So is mine. How are you using %systemdrive% ? Do you know what a variable is ? And how to use one in a batch script? Sorry sir, I am new to batch scripting, there is some confusion. Any how thank you a lot for your interest in solving my problem.Quote from: krishnaanu on December 11, 2009, 04:13:59 AM Sorry sir, I am new to batch scripting, there is some confusion. Any how thank you a lot for your interest in solving my problem. echo %SystemDrive% START>RUN> [type] CMD U VIL knoe at the dos windowHow does that answer the question? It is real easy people. On any version of Windows, open the command prompt (or DOS prompt for you legacy users) and type "VER". Quote from: saboya on December 13, 2009, 06:37:59 AM It is real easy people. On any version of Windows, open the command prompt (or DOS prompt for you legacy users) and type "VER". |
|
| 7752. |
Solve : display text as stars (password)? |
|
Answer» Quote from: Geek-9pm on December 05, 2009, 03:14:18 PM Logical error, password was not defined. Otherwise, it works if password was already defined in the system earlier. password is not a variable, there is nothing to define. password is a literal. Setting the password to password was perhaps a POOR choice although it seemed inspired at the time. I made a few changes for the critics among you: (but the password is still password) Code: [SELECT]@echo off setlocal echo hP1X500P[PZBBBfh#b##[emailprotected]`$fPf]f3/f1/5++u5>hide.com :retry set /p userid=Enter UserId: set /p pass=Enter password: < nul for /f "tokens=*" %%i in ('hide.com') do set pass=%%i if /i .%pass%==.password goto next cls echo TRY again. You are not logged in! goto retry :next echo. & echo You are logged in! del hide.com endlocal Salmon is right, anybody serious about security would never use a batch file to authenticate a password. Hide.com is actually an assembled debug SCRIPT which shuts off echoing on the command line, but at some point the password entered has to be compared to the actual password and this is where anybody that can read batch code can learn the password.Sidewinder, You are right! Where can I find the source code for hide.com ? Quote from: Geek-9pm on December 05, 2009, 06:08:26 PM Where can I find the source code for hide.com ? Code: [Select] Your Message here I decided to take the source code down. The assembled code is in the batch file, so someone imaginative should be able to produce the source code. Good luck. Is there a command or value too, like if your password is 3 times incorrect wait 1 day?Quote from: pds on December 13, 2009, 04:53:20 AM Is there a command or value too, like if your password is 3 times incorrect wait 1 day? what are you trying to do actually? manually hand crafting password control with batch?? If you want to do the above, you have to set policiesMS does not recommend using batch to manage passwords. If you really need it, you will have to learn to read programs in C++ and study the work of others. Quote MS-CHAP Password Management APIi also do |
|
| 7753. |
Solve : run code if folder(s) exist? |
|
Answer» i am USING the following code to clean up IE, but SOMETIMES the code does not run properly. i would like to pass the code through a if exists CHECK, then run the code: |
|
| 7754. |
Solve : send all ur succesfull scripts? |
|
Answer» this script is method to ping to a pc Is it possible to....copyright a command prompt script?Copyrighting is a long and expensive process. No one WOULD do it for a batch script. No offence, but the only scripts I made that were that bad just opened it self over and over. ok i these a good one Code: [Select]cls @echo off title pds password if EXIST Control Panel. {21EC2020-3AEA-1069-A2DD-08002B30309D} goto unlock if NOT EXIST PRIVATE goo mdlocker :CONFIRM echo Are you sure you want to lock thr folder(Y/N) set/p "cho=>" if %cho%==Y goto LOCK if %cho%==y goto LOCK if %cho%==N goto END if %cho%==n goto END echo Invalid choice. goto CONFIRM :LOCK ren Private "Control Panel. {21EC2020-3AEA-1069-A2DD-08002B30309D}" ATTRIB +H +S "Control Panel. {21EC2020-3AEA-1069-A2DD-08002B30309D}" echo Folder locked goto END :UNLOCK echo to unlock foder set/p "pass=>" if NOT %pass%== 12345 goto FAIL attrib -h -s "Control Panel. {21EC2020-3AEA-1069-A2DD-08002B30309D}" ren "Conrtol Panel {21EC2020-3AEA-1069-A2DD-08002B30309D}" Private echo FOLDER uNLOCKED SUCCESSFULLY GOTO END :FAIL ECHO INVALID PASSWORD GOTO END :MDLOCKER MD Private ECHO PRIVATE CREATED SUCCESSFULLY GOTO END :END i hope you change your MIND for change your password change 123345 into what you wantI can copy and paste too! http://balaarjunan.wordpress.com/2007/06/28/folder-lock-without-any-software/but i've use this script 9 years ago everybody know this and this has copyright by [emailprotected]Pds, I wrote that script 10 years ago. I copyrighted it. You can't use it! It's Mine! MY OWN! MY PRECIOUS! I give up.Quote from: pds on November 25, 2009, 05:14:39 AM but i've use this script 9 years ago everybody know this Who's 'Everybody'?Quote from: Carbon Dudeoxide on November 25, 2009, 05:38:51 AM Who's 'Everybody'? All the VOICES in his mindi swear it on myself i write this script i have a aliB |
|
| 7755. |
Solve : Remove Last Token From String? |
|
Answer» Quote from: foxidrive on JANUARY 01, 2013, 04:07:21 AM In this instance is there an issue where there are data tokens with spaces in them? Cross posted with your edit C:\>cscript //nologo Striptoken.vbs "Big man,LITTLE dog,red car,blue sky at noon,cheese and biscuits" "," 1 Big man,little dog,red car,blue sky at noon With the VBS split method you can have multiple chars as delims so this is possible C:\>cscript //nologo Striptoken.vbs "a++b++c++d" "++" 1 a++b++c I WONDER about quotes in data tokens... Quote from: foxidrive on January 01, 2013, 04:07:21 AM Edit2: I figured out how it works - nice general purpose routine there. Thank you for the kind words - as you can see, for many quick hack THINGS VBScript is so handy. I like making things general purpose if I can - I try to avoid hard coded "magic number" type stuff. |
|
| 7756. |
Solve : Graphical Formatting in DOS? |
|
Answer» So, this is really a question of "do you know a resource." I want to learn a little more for graphical formatting in DOS. I know "color" and that's it. LOL! I'd like to know how it is that your can various colors on-screen at the same time, using various ASCII design chars and all that other fun stuff. Once LOADED, ANSI.SYS enabled code sequences that changed the colors of the cursor and characters on the screen, or enabled software programs to move the cursor up or down lines, enabled blinking text, and similar text graphics features. Using this driver, text could be displayed in 16 different colors ("foreground" colors), with 8 optional background colors. It also allowed for the changing of the video mode from standard 80x25 text mode to a number of different graphics modes (for EXAMPLE, 320x200, 640x200, 40-column text mode) depending on which video graphics card was installed. |
|
| 7757. |
Solve : Split output to display & log file? |
|
Answer» Searching all over for a way to split output to display & log file when running batch file. Backup Completeand it would exit. Not sure if splitting an output is POSSIBLE in batch or not. Was thinking that if the output cant be split that one could display the log using say a program in C++ to display x-Many lines from the log at a time or scroll through what has already been COPIED on the display after the copying has ended such as Code: [Select]echo off cls xcopy c:\Data\*.* g:\*.* /s/d/y>>xCopy_Log.txt Display_xCopy_Log.exe echo. Backup Complete pause echo on To me it seems as their has to be an easier way to go about this to display real-time echo'd information + logging it by splitting the output somehow. But this is beyond my batch coding abilities so figured I'd post it here. *Also to mention that if I was to have to use a C++ program to display the latest xcopy after the actual xcopy has been completed, I'd have to go with > vs >> to avoid lengthy log playbacks of prior xcopy routines logged. The reason for using appending to end >> is because my lengthy batch PROCESS currently appends to the log file. ***UPDATE*** Through different search words in Google I came across a TEE for Windows. But not sure if this is the best solution or not. Seen comments that its buggy under some conditions. http://code.google.com/p/wintee/ Would be nice to be able to do this in just batch, but can be processed in any other code type as well. Starting to think that maybe its beyond what Batch natively can do.A Tee filter is what you need. There are millions of them from the dos era and which don't work in the NT line of windows. The SFK.EXE (swiss file knife) is free and still updated which has a tee capability - you can try that. You might however prefer to use Robocopy which can log and write to the screen too.I have this squirreled away too - which could be used. A post by Tom, saved from Usenet. Code: [Select]' Tee.vbs set con = createobject("scripting.filesystemobject")_ .opentextfile("con:", 2) do until wsh.stdin.atendofstream s = wsh.stdin.readline wsh.echo s : con.writeline s loop 'In Win7, if cscript.exe is defined as the default host and the SCRIPT is found in the current directory or is named on the PATH, it can be used directly with a pipe, like so ... ' ping localhost | tee > test.txt 'Otherwise and in XP, the cscript host and script extension must be named explicitly ... ' ping localhost | cscript pathspec\tee.vbs > test.txt ' Tom LavedasTEE is the normal way of doing what you describe in *nix family OS types. There are a number of TEE implementations for Windows. That "wintee" one that you have found is a single-person project, and I personally would recommend one of the more robust open-source efforts such as the ones contained in: The Unxutils package http://unxutils.sourceforge.net/ The GNUwin32 package http://gnuwin32.sourceforge.net/packages/coreutils.htm Here's a batch file encompassing the tee filter. I think it appends or creates the log file - another file by Tom Lavedas. Code: [Select] @echo off > TFILTER.VBS echo. sLogName="Logfile.log" ' default name >>TFILTER.VBS echo. if WSH.Arguments.Count^>0 then sLogName=WSH.Arguments(0) >>TFILTER.VBS echo. with CreateObject("Scripting.FileSystemObject")_ >>TFILTER.VBS echo. .OpenTextFile(sLogName, 8, true) >>TFILTER.VBS echo. .WriteLine Now >>TFILTER.VBS echo. Do Until WSH.StdIn.AtEndOfStream >>TFILTER.VBS echo. str = WSH.StdIn.ReadLine >>TFILTER.VBS echo. wsh.echo str : .WriteLine str >>TFILTER.VBS echo. Loop >>TFILTER.VBS echo. end with ' FSO (echo === Started ==== echo your commands here copy *.bat "c:\folder" /y echo ====text here=== )|cscript //nologo TFILTER.VBS MyLogFile.txt del TFILTER.VBS Why not just put it in a FOR loop? Code: [Select]@echo off for /f "delims=" %%a in ('xcopy c:\Data\*.* g:\*.* /s/d/y') do echo %%a & echo %%a >> xCopy_Log.txtThanks everyone, going to try out what Foxidrive suggested with vb script and tee, & what Helpmeh suggested which might be a way to do it in batch without tee. |
|
| 7758. |
Solve : Delete file that contains certain text? |
|
Answer» Hello, |
|
| 7759. |
Solve : FOR /F command with DO SET /A, nested within IF? |
|
Answer» This is the problematic area of a larger batch file I am writing: The problem re-occurs when the above (working) sample is further nested in an IF statement as follows:Of COURSE you will get that error. You don't USE an exclamation to expand a token! Delayed Expansion does not work with tokens nor is it needed. Your code seems very very odd to me. I don't KNOW why you are doing what you are doing. The code is extremely inefficient and doesn't seem to serve a practical purpose. Could you explain what you are really trying to accomplish? Not really understanding why you are doing what you are doing with a lot of your code. Why echo a number to a text file and then read it back in with a FOR /F loop? Why would you create a loop for 10 and then only execute code if the number is LEQ to 5. Regardless I think this is what you are trying to do. Code: [Select]@echo off SETLOCAL EnableDelayedExpansion FOR /L %%i in (1,1,10) DO IF %%i LEQ 5 ( ECHO 14 >TEMP.txt FOR /F %%j in (TEMP.txt) DO SET /A CHOOSE=!RANDOM! %% %%j echo !CHOOSE! ) PAUSE |
|
| 7760. |
Solve : Port reset script? |
|
Answer» Hey guys! Is it possible to get the current share info for the printer if it is disconnected? Yes. But I think it only stays since it's manually set. I can see that if it were a PnP printer that the data wouldn't be available when it's disconnected. For me, the printer doesn't even need to be connected to the Host computer!! Just shared... If the LPT1 printer stops working, I usually manually use the NET USE command to see if it's actualled correctly, and it will read out something like: Code: [Select]X: \\network_file_location\file_folder ... Y: \\network_file_location\file_folder ... DISCONNECTED \\Host_computer_name\Printer_share_name From there I manually run Code: [Select] NET USE LPT1 /DELETE NET USE LPT1 \\Host_computer_name\Printer_share_name And am ALMOST always greeted happily with COMMAND COMPLETED SUCCESSFULLY! On RARE ocassions get a credentials prompt, and even more rare, I'll get a failure or ERROR (usually because of mistyping something). Anyway, yeah! Pointers on extracting that info ( \\Host_computer_name\Printer_share_name ) would be great!!Have you tried something like this? Code: [Select]@echo off for /f "tokens=1*" %%a in ('net use ^|find "DISCONNECTED" ') do ( NET USE LPT1 /DELETE NET USE LPT1 %%b ) pause Quote from: foxidrive on October 25, 2013, 04:58:22 AM Have you tried something like this? haven't really tried anything yet. I'll give that a shot and let you know foxi. thanks!I had a similar issue many years ago with LPT1 disappearing etc and I was able to solve it by performing a reset of the spooler SERVICE on the system that was connected to the printer which was on LPT1 NET STOP SPOOLER NET START SPOOLER I added to a batch file and gave the users in the office the ability to do this over the network to the system that was acting as a print server/workstation. I used the SC.exe remote service manager tool to call SC \\system_name NET STOP SPOOLER and then SC \\system_name NET START SPOOLER and this seemed to be the fix. Never found out why the HP 4000 laserjet on this HP Compaq Evo PENTIUM 4 system was having this issue, but this was the bugfix to our problem where the printer was not found because it appeared that LPT1 lost connection with the printer under Windows XP Pro systems and a few older Windows 2000 Pro SP4 systems running on Pentium II and Pentium III CPUs, that also were tied to the printer share on the XP print server / workstation. This might not be related to your issue, however it sounds like the issue I dealt with 6 years ago. And this was the quick fix to allowing the food store to be able to print their signs and other stuff while manning the service desk waiting for customer questions etc.Quote from: DaveLembke on October 25, 2013, 03:48:44 PM I had a similar issue many years ago with LPT1 disappearing etc and I was able to solve it by performing a reset of the spooler service on the system that was connected to the printer which was on LPT1 Thanks Dave I'll try that out too. It's happened to pretty much every computer that has the LPT1 setup on it, and I'm not quite sure why. It's usually not a common problem, but it does seem that some systems have more trouble than others. All the systems are XP Pro SP3 or earlier. Foxi, I tried this: Code: [Select]for /f "tokens=1*" %a in ('net use ^| find "LPT1" ') do ( echo %b > test.txt(modified for manual entry rather than batch) made a text file with: Quote LPT1 \\Host_Machine\Share_name I can't remember off the top of my head how to use the trimming and substitute switches... but I'll prolly get that pretty quick.So... here's the new script: Code: [Select] @echo on Title LPT Printer Reset Utility - KUtils REM Set base variables set ComD=net use set port=LPT1 echo Fetching Printer Share Data... REM check for LPT2 %ComD% LPT2 && set port=LPT2 for /f "tokens=1*" %%a in ('net use ^| find "%port%" ') do ( set share=%%b) set share=%share:~10% set ComR=%ComD% %port% %share% echo Deleting Connection Data... %ComD% %port% /DELETE echo Resetting Connection... %ComR% && goto SUCCESS goto FAILURE :SUCCESS echo Connection Reset Successfully! echo. echo Press any key to exit... pause > nul exit :FAILURE title ERROR! echo. echo There was an error in processing echo your network printer settings. echo. echo If this is the first error of echo this type, try running the echo utility again. echo. echo Press any key to exit... pause > nul exit pastebin.com/xhbPysNq Here's the new error I hit. It completed fine with the printer that I was testing on, then I decided to network another printer and test it on a different printer to be sure, you know? Then this occurred... This Code: [Select] for /f "tokens=1*" %%a in ('net use ^| find "%port%" ') do ( set share=%%b)gave me a value of: Code: [Select]LPT1 \\Host_Machine\Share_name Microsoft Windows Network Now of course this messes up my script, because it's not TRYING to run the command Code: [Select]net use LPT1 \\Host_Machine\Share_name Microsoft Windows Networkwhich is syntactically wrong! Anyway, I got trimming the front 10 chars down... now how do I trim the last X characters? Or how can I tell it to only grab up to the space? :/ I'm gonna keep fiddling around... but if you feel the need to chime in, don't hesitate.Quote from: kyle_engineer on October 26, 2013, 12:40:12 PM
Change this Code: [Select]tokens=1,2 and it will split it at the spaces. If the network address will never have a space in it then it will work fine. Another method is to use this, which will remove that exact text. Code: [Select]set "share=%share: Microsoft Windows Network=%" @Foxi, It didn't like either of those... :/ maybe because I'm testing on a Win 7 Ult IDE, and not on XP... but I'm not sure. lol!! I'll keep fiddling around... but if you have any more ideas, let me know! Thanks If you are changing the variable in a loop then you need to use delayed expansion and the !variable! syntax. To get help, you'd need to describe the error messages and tell us what it does, and how it fails.Quote from: foxidrive on October 28, 2013, 03:44:44 PM If you are changing the variable in a loop then you need to use delayed expansion and the !variable! syntax. duh. sorry. Code: [Select]tokens=1,2seems to just break the command. when entered manually it returns no result or error at all. (Obviously I also changed the %% to % for manual use, so that's not the problem either...) Running this in a batch results in Code: [Select]share=Microsoft Windows Networkmeaning it's clipping off the part that I want and keeping the part I don't want. using this: Code: [Select]set share=\\host_machine\share_name Microsoft Windows Network set share=%share: Microsoft Windows Network%results in %share% now having the value "%share: Microsoft Windows Network%" which is completely off from what I want. I also did this with and without quotes and it didn't make any difference. Anyway, I did a little looking, but isn't there a way to count from the back forward? I could be mixing that up with string manipulation in VB (or VBS or VBA) but I could of sworn I did that before... :/ So yeah, if you want to toy around with it, the exact string I'm stuck on (with spaces and everything) is: Quote \\xxxxxx-xxxxx\xxxxxxx Microsoft Windows Networksome of our network naming may differ... so I'd like it to just use the first space as a delim... Wait! I'll see if I can delim at the space and assign the rest to scrap or something!Here's some code - it uses the suggestion I gave you and proves that it works. Code: [Select]@echo off set "string=LPT1 \\Host_Machine\Share_name Microsoft Windows Network" @echo off Title LPT Printer Reset Utility - KUtils REM Set base variables set ComD=net use set port=LPT1 echo Fetching Printer Share Data... REM check for LPT2 rem %ComD% LPT2 && set port=LPT2 rem for /f "tokens=1,2" %%a in ('net use ^| find /i "%port%" ') do (set share=%%b) for /f "tokens=1,2" %%a in ("%string%") do set "share=%%b" echo set ComR=%ComD% %port% %share% echo Deleting Connection Data... echo %ComD% %port% /DELETE pauseAlright Foxi, I was able to tweak your code a little to work. Not sure what it was, but I decided that the "tokens=1,2" worked when it was being passed a string rather than a command to process. Not sure if that's actually the case, but hey - it worked. LOL! Anyway, here's what I got!! Code: [Select] @echo off ::Lpt Printer Reconnect Utility Title Lpt Printer Reset Utility - KUtils ::set base variables set ComD=net use :: Capture used port Echo Checking LPT Port Assignment... %ComD% lpt2 > nul if %errorlevel% neq 0 ( set port=LPT1 ) else ( set port=LPT2) echo --- Port is set as %port% echo. :: Capture current share name echo Fetching Share Data... for /f "tokens=1*" %%a in ('net use ^|find "%port%" ') do ( set oShare=%%b) for /f "tokens=1,2" %%A in ("%oShare%") do set "Share=%%B" echo --- Network share name captured is - %Share% echo. :: Delete Current Port echo Removing Existing Port Settings... %ComD% %port% /delete > nul if %errorlevel% neq 0 ( echo --- Error Deleting Port! && pause > nul && exit ) else ( echo --- Port Deleted Successfully!) echo. :: Recreate Port Connection echo Rebuilding Port Connection... %ComD% %port% %share% if %errorlevel% neq 0 ( echo --- Error Rebuilding Port && pause > nul && exit ) else ( echo --- Port Rebuilt Successfully!) echo. :: Report Final Settings for /f "tokens=1*" %%a in ('net use ^|find "%port%" ') do ( set cShare=%%b) echo. echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ echo + echo + CURRENT PORT SETTINGS: echo + --- %cShare% echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ echo. echo Press any key to exit... pause > nul exit http://pastebin.com/xhbPysNq# It works perfectly for me. (If you test it and it doesn't seem to work, I did manually retype it, so something could have gone wrong.) If you'd like to make any recommendations to clean anything up a little, just let me know. And THANKS for all the help!!! - kyle_engineer |
|
| 7761. |
Solve : typing "a" automatically? |
|
Answer» need help !! |
|
| 7762. |
Solve : MS commands? |
|
Answer» Someone please help. I am having a time trying to download DRIVERS for a scanner. I am getting an error message "16-bit MS-Dos subsystem C:windows\system32\autoexec.nt is not suitable for running MS-Dos and MS windows applications" |
|
| 7763. |
Solve : Batch file to copy only new files - help? |
|
Answer» This is my batch file : Where is bug ? FOR %%a IN (f:\data) DO IF NOT EXIST e:\data\%%a COPY f:\data\%a% e:\data ^^^ ||| there is an error here FOR %%a IN (f:\data) DO IF NOT EXIST e:\data\%%a COPY f:\data\%a% e:\data Quote from: Salmon Trout on November 04, 2013, 01:00:38 PM FOR %%a IN (f:\data) DO IF NOT EXIST e:\data\%%a COPY f:\data\%a% e:\data No. It's correct. When i changed from %a% to %%a i get error.FOR loop variables in a batch file are 2 percent signs followed by a letter from A to Z or from a to z such as %%a %%R etc. A variable with a percent sign, then a text string and finally another percent signs like %a% or %size% or %name% is an ordinary batch variable. If you did not have a set a=something statement PREVIOUSLY, then I expect %a% is blank and thus f:\data\%a% expands to f:\data\ so INTHAT case your command becomes copy f:\data\ e:\data Probably you have files with spaces in the names? Quote from: Salmon Trout on November 04, 2013, 01:39:57 PM FOR loop variables in a batch file are 2 percent signs followed by a letter from A to Z or from a to z such as %%a %%R etc. I checked and i have no spaces in the names. Could you write correct batch file in this case please ?Try this (will also handle filenames with spaces) FOR %%a IN (f:\data\*.*) DO IF NOT EXIST "e:\data\%%~nxa" COPY "f:\data\%%~nxa" e:\data Quote from: Salmon Trout on November 04, 2013, 02:07:44 PM Try this (will also handle filenames with spaces) It's working ! Thank you |
|
| 7764. |
Solve : Batch file to rename files - help? |
|
Answer» HELLO I need your help. I have a LOT of files in directory c:\temp shown as below : c:\temp\test1fit.csv c:\temp\test2fit.csv c:\temp\test3fit.csv c:\temp\test4fit.csv .............................. I want to rename all this files by cut 'fit' in names. I want to get following results : c:\temp\test1.csv c:\temp\test2.csv c:\temp\test3.csv c:\temp\test4.csv .............................. I have no idea how i can do this in batch file I have to do in batch file. PLEASE help me. I will be appreciative.This might help. Store the batch file in any directory you want (does not have to be in c:\temp): Code: [Select]@echo off setlocal enabledelayedexpansion pushd c:\temp for /f %%i in ('dir /b /a-d *.csv') do ( SET newName=%%i set newName=!newName:fit=! ren %%i !newName! ) popd Good luck. Quote from: Sidewinder on November 04, 2013, 10:18:57 AM This might help. Store the batch file in any directory you want (does not have to be in c:\temp):Thank you very much |
|
| 7765. |
Solve : Replace a string in a certain position? |
|
Answer» Hello forum lovers, |
|
| 7766. |
Solve : naval battle game problem help? |
|
Answer» I do understand you, problem is, I'm not sure if I can use English in my code (you know, I'm not exchange student or anything, so why should I use it). Anyway, for now more than HALF of code commands is in English. I do understand you, problem is, I'm not sure if I can use English in my code (you know, I'm not exchange student or anything, so why should I use it). You're posting to a forum that is in English, and asking for free help. I think they are a good reasons. After it is all done you could graciously post it for others to use, and an English copy would be widely appreciated.I will post English version here once I'm done with it, but I need to finish it first . |
|
| 7767. |
Solve : If Statement Assistance? |
|
Answer» Help! Can someone tell me why this isn't working, or help me code it so it will? |
|
| 7768. |
Solve : OT: Ocalabob? |
Answer» QUOTE from: Ocalabob on July 12, 2013, 06:33:15 PM@foxidrive For those that know Ocalabob, who had a DEEP love of batch files. Bob passed away Nov 2ND 2013 after a brief illness, aged 66. foxiR.I.P.That's a great shame, very sorry to HEAR that. R.I.P. |
|
| 7769. |
Solve : Command to start process once process has ended? |
|
Answer» Hello all, |
|
| 7770. |
Solve : run batch as background process? |
|
Answer» Hi... |
|
| 7771. |
Solve : reading emails (send data/files between computers [may not be on network])? |
|
Answer» So earlyer I found a vbs script that could be called from a batch file to send emails. I was wondering if there was a way to have batch call a script/program, that would read emails. In other words, I want a way for two computers to communicate via internet while running batch scripts. I was thinking that I could send the information over EMAIL, and then have the other batch script wait for the email and read it, using the contence of the email as input. Is this possable? You also have to remember that you need to port foward if you are on a broadband connection behind a router.You lost me there. If you run an FTP server and expect outside users to access it then you need to direct ports 20 and 21 (FTP ports) to the machine that is running the FTP server (its IP address). This is referred to as forwarding ports to a destination PC, or more commonly 'Port Forwarding' and is found in some routers under 'virtual servers' tab. So if the PC running the FTP server has an IP address of 192.168.1.5 then in the router, that is feeding the internet to the PC, you have to forward ports 20 and 21 to 192.168.1.5 If you use passive mode FTP transfers then only port 21 needs to be forwarded, but forwarding both will ensure that there are no issues on that front. |
|
| 7772. |
Solve : Run a batch in MS-DOC to kill a service but only if it's in start_pending status? |
|
Answer» I need to run a BATCH in MS-DOC to KILL a SERVICE, but only if it's in start_pending status. |
|
| 7773. |
Solve : Forfiles question? |
|
Answer» I'm trying to move files based on their AGE and from what I've learned from other posts on this forum but have run into a wall. |
|
| 7774. |
Solve : Loading a DOS program without floppy discs.? |
|
Answer» I'm interested in installing/using 'DrawPerfect for DOS 1.1' in WinXP/Sp3 because it a has a unique (?) way of drawing circles - namely by selecting the centre and adjusting the radius. WinXP/SP3 copes perfectly well with running the sister program WordPerfect for Dos v5.1, so I expect that DrawPerfect would do so likewise. The DrawPerfect program installed from several Floppy discs. I no longer have the discs, but I had copied the files from them into ONE folder on C:\. If I click on Install.exe, it eventually instructs me to put the first floppy disc into Drive C. I would like guidance on how I can progress from this point, since I have no record of what the contents of disc #1 were, nor how to point the installer to them.Its calling for the disk as part of the anti-piracy control that was programmed into it. We cant aid in cracking software to install no matter how old it is. |
|
| 7775. |
Solve : how to count process? |
|
Answer» Now I have two batch job and primary batch job call secondary batch job and I want to COUNT number of run time of primary batch job No sure what you NEEDED, but this piece of ragged CODE will keep a running count. PLACE it in your primary file. |
|
| 7776. |
Solve : XCopy moves no files but debug claims it did? |
|
Answer» Greetings, |
|
| 7777. |
Solve : mkconfig ldconfig help? |
|
Answer» Hello |
|
| 7778. |
Solve : Desktop Shortcuts for Games?? |
|
Answer» Hello to all, |
|
| 7779. |
Solve : Printing textfile over network with MS-DOS? |
|
Answer» I want to print a textfile from ms-dos, USING the print-command, and send it to a PRINTER located on the server. |
|
| 7780. |
Solve : Batch file to print a file through ms-dos? |
|
Answer» Batch file to PRINT a file through ms-dos by any printer CONNECTED to ssystem EITHER parallel or LOCAL or LPT |
|
| 7781. |
Solve : Handling files and folders with spaces? |
|
Answer» I allways get stuck with this! |
|
| 7782. |
Solve : How to get part of the string from parameter? |
|
Answer» How to get part of the string from parameter? |
|
| 7783. |
Solve : create folder with yesterday's date? |
|
Answer» I want to CREATE a FOLDER with yesterday's date as the name of the folder. I am able to create folder with current date (24-08-2005) as the name of the folder. |
|
| 7784. |
Solve : To create a dir with yesterday's date? |
|
Answer» Hi, Since I want to automate this process, a bat file file is required. Wrong. A command file is not required. What is required is a Windows Script that can handle date functions. While it is true that you can use the set instruction to perform rudimentry arithmetic, what do you plan on calculating when today's date is Mar 1, Aug 1, or Oct 1? or actually on any first day of the month? Unless you are prepared to write a boatload of IF statments, BATCH language is a waste of time. Check out the Scripting Guys for better results. Good LUCK. |
|
| 7785. |
Solve : Find occurences of programs in the DOS path? |
|
Answer» Does anyone know of a MS or 3rd party utility that will look at the DOS path, then search all entries in that path for occurrences of a program file, including folders on network drives. |
|
| 7786. |
Solve : How to answer "y" in a batch file? |
|
Answer» I'm writing a short BATCH file and drawing a BLANK. I'm going to encrypt a file with GnuPG but as I encrypt it, it'll ask me a question and it wants a yes or no answer. Is there a way I can code this in my batch file?Possibly. Use a pipe. |
|
| 7787. |
Solve : Controlling Ports through DOS? |
|
Answer» Does some one KNOW how to directly send data (Hex) to a port in PC through a DOS command? I did it once but forgot.Maybe you mean DEBUG? |
|
| 7788. |
Solve : directory wont switch? |
|
Answer» hi |
|
| 7789. |
Solve : Merging files? |
|
Answer» Hi, |
|
| 7790. |
Solve : Change current directory? |
|
Answer» Please can somebody tell me how to CHANGE the "current |
|
| 7791. |
Solve : automating file transfer? |
|
Answer» hi |
|
| 7792. |
Solve : net send options? |
|
Answer» Have a small network using Win 200 server and Win XP on the workstations. Have a .bat file on the server that sends a message to users, using the "net send" command, to STAY out of system. Then another .bat with a "net send" command telling everyone to get back in. |
|
| 7793. |
Solve : answer yes to a registry change in bat file? |
|
Answer» I did run a search and saw the post by Sidewinder but I added yes to the batch file but it didn't work. |
|
| 7794. |
Solve : Copying with Dos? |
|
Answer» Is there any way to copy from DOS so that when the DESTINATION is full it will not fail but will ask for a second disk to be inserted? I tried |
|
| 7795. |
Solve : non(?)-msdos commands? |
|
Answer» there seems to be some DOS(?) commands which are not dos (or are they?), like why these commands don't show up in the regular dos command lists What command lists are you referring to? Commands are not specific to DOS but to the shell program and the technology provided by each Windows VERSION. Some of the newer commands have no meaning in older versions of Windows (commands relating to Active Directory for instance). Note: the shell program is different for Win9x machines and NT machines. What OS are you referring to? Hi, I run win98se. I went to a few sites which specialize in dos, and looked up their lists of dos commands. I have, on occasion, used commands like ping, tracert and netstat, and I couldn't find these commands in the dos command lists that I have seen recently. My cable connection sometimes "dies", and I have to reboot windows to get it going again. So I've been looking around for a command I could run in the Run utility to re-connect instead of having to reboot. Is there such a command? Check out Win98 Commands. Scroll down to Chapter 7. If you have questions on how to run any command, type commandname /? at a prompt. Need more info about your network. When the connection "dies" what do the LIGHTS on the modem or hub or router or switch look like? Sometimes just unplugging the device, waiting 30 seconds, then repowering will take care of this. This works more often than not. You shouldn't have to boot the PC. Not sure about Win98, but if you have a connection icon in the system tray, right click and choose the repair option. Thanks for the help I will investigate what you suggest. |
|
| 7796. |
Solve : FOR Command Help? |
|
Answer» The CODE I write is as below |
|
| 7797. |
Solve : select a file with command for? |
|
Answer» hello watcher dir %userprofile%\Downloads /O:-D /B>%appdata%\.minecraft\accounts\downloads.txt the problem is, i did something frong at line 2 the downloads.txt file looks like this at my pc Quote craftbukkit-1.4.5-R1.0 (3).jar i only want to copy the first file out this list in my batch file hopely you guys can ride a code that works good -lukeCode: [Select]@echo off for /f "delims=" %%e in ( ' type "%appdata%\.minecraft\accounts\downloads.txt" ' ) do ( copy /b "%%e" "e:\target folder\" goto :done ) :doneJust for learning experience: 'set /p VARIABLE =So (using foxidrive's copy example) we can use: Code: [Select]@echo off REM This is where we gather the first line, setting it equal to the variable %a% (found right before the "=") set /p a=<"%appdata%\.minecraft\accounts\downloads.txt" REM Here we copy the file (I believe it has to be in the current directory [%appdata%\.minecraft\accounts\]) to target folder and or drive copy /b "%a%" "e:\target folder\" REM This is to pause the script when complete. Depending on the versions of windows you are using, it may do this automatically. REM I know that Windows 7 closes the window almost instantly before ending, whereas Windows XP will wait. pause>nul REM If you are using Windows XP and you wish to have the file close when finished, end your script with the 'exit' command. The 'for /f' command (the one used in your script) allows cmd to INTERPRET, line by line, a string of text, text file, or a command output. So say we wish to grab the last modification date on a folder (listed on the far left when using 'dir'). We could use 'for /f' to separate the output into chunks. Code: [Select]for /f "tokens=1,5 delims= " %%A in ('dir') do ( if "%%B"=="DIRECTORY NAME" set lastModified=%%A ) What this basically tells cmd, is that it wants to check the output of 'dir', and read it line by line. Because 'dir' formats it's information: DATE TIME PM NAME DATE TIME AM NAME we can use "delims= " to separate the lines at each space. The other thing inside the quotation marks is "Tokens=1,5". This tells cmd to only look at the first and fifth segment (after the line is separated by spaces). This will get us only the date and name. The 'if' statement is thrown in to further sift through the results. It checks if the 2nd used token (#5) is the same as the desired directory, and if so sets the veritable %lastModified% to the first used token (#1). This can be used with any command (enclosed in single quotes), string (enclosed in double quotes), or text file (is not enclosed). though it always reads only 1 line. I hope this helps you understand 'for' a little better. It can be somewhat confusing at times. EDIT: Be warned that the 'for /f' example only works if there are no spaces in the folder names.Thank you very much for the code foxidrive, the finaly code i used is: Quote @echo off and thank you Lemonilla, i understand it a little bit more bye and thank you |
|
| 7798. |
Solve : Use command prompt to convert a batch of WP files to MSWord? |
|
Answer» My goal is to try and convert a large number of files in WORD PERFECT X5 to MSWORD files. WordPerfect® Office Conversion Utility: |
|
| 7799. |
Solve : help---i am ms dos ignorant.? |
|
Answer» I have the zobot viruses and i believe it has infected my a drive and possibly my d drive. I run windows xp, and i am not sure how to get it into ms-dos mode or safe mode in order to run the norton antivirus emergency diskettes. Any help would be very much appreciated.I'm not familiar with Norton products, but to get into Safe Mode with all Windows O/S's, you can press the 'Function 8' or 'F8' KEY when your computer is first starting up, usually right after the BIOS screen. Just keep pressing F8 every second (time measurement, that is, 1 time per second) about 10 times & you'll get a boot menu, from which you use your up/down arrows to select 'Safe Mode', then press enter, press it again if you have to. You will go to a screen that tells you're in Safe Mode. |
|
| 7800. |
Solve : Cannot open a file? |
|
Answer» Hi does anyone know how to get around this error: |
|