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.
| 8851. |
Solve : Multi Open Folder in a Local Area Network? |
|
Answer» MULTI Open folder. What can I use to open a folder in one of my pc : Example : c:\folder1\folder2 and the rest of my pc in the local area network ? By example c:\folder1\folder2 \\pm-7fg7fjkl432a\folder1\folder2 \\jose-a0555092b\folder1\folder2 where pm-7fg7fjkl432a is the equipment NAME. Best Regards A sort of a rules folder launcher. May be with possible selection of several rules pre-established I usually have the same folders in my three pc, but not all folders. I would like to get a initial folder selection. I can INTRODUCE in the batch file the name of the COMPUTERS in the local area network And the program search and open the folders with the same name and path in the LAN. Trying to figure out what you want to do... what about mapping the path to a drive letter such as \\pm-7fg7fjkl432a\folder1\folder2 mapped as say Y:\> \\jose-a0555092b\folder1\folder2 mapped as say Z:\> You then would be able to go to specific system by drive letter.It's a splendid idea. Best Regards |
|
| 8852. |
Solve : batch file wont back to prompt? |
|
Answer» hi there |
|
| 8853. |
Solve : administrative level command prompt? |
|
Answer» HI, How do I open the administrative level command prompt? Type cmd in the Start menu Search BOX, right-click the Cmd.exe shortcut, and then choose Run As Administrator. Quote from: hollymwebster on July 20, 2011, 10:20:38 AM typing regsvr32actprxy.dll 1. You need a space between regscr32 and actprxy.dll like this regsvr32 actxprxy.dll 2. It probably won't do anything. Quote from: hollymwebster on July 20, 2011, 10:20:38 AM I didn't see enter. This is Enter. You press it with your finger. open start and type cmd and press CTRL+SHIFT+ENTER |
|
| 8854. |
Solve : how to install dos using bios?? |
|
Answer» hey ,i REALLY need some help here..., i dont know how to install this ms-dos os. i've downloaded ms-dos 6.2 or something & i've burned it into a CD.. what next?It must be an illegal copy since MS-DOS only comes legally on floppy disks. No help with piracy. to install a os from a compact disk go into the bios and set your cd-rom drive to boot first, insert disk and restart and follow prompts, NOTE: i dont think ms-dos can be installed from a cdIf you have a legal copy of MS-DOS, it must be installed to a SMALL drive that has a format compatible with that version of DOS. And the drive must be the active drive. Hard to give more SPECIFIC instructions without knowing your system details. But way would you want to install DOS 6.22 anyway? Topic Closed. |
|
| 8855. |
Solve : MS-DOS 6.2 Step-up Files? |
|
Answer» An older MS-DOS computer can step up to MS-DOS 6.2 free. MS-DOS 6.2 Step-up FILES - Download.comThe above was quoted today. Apparently 78 people last week did the download. No explanation of why they would do this. Is it legal? On y if you have a computer. No, it's totally illegal, Microsoft is trying to trick people by putting this up.Quote from: BC_Programmer on June 03, 2011, 09:03:36 PM No, it's totally illegal, Microsoft is trying to trick people by putting this up.It's a conspiracy Quote from: Geek-9pm on June 03, 2011, 08:36:59 PM An older MS-DOS computer can step up to MS-DOS 6.2 free. Not QUITE. It's 6.22 (the last MS-DOS) that they can step up to. And only from a lower version 6.xx. That is, to use the MS-DOS 6.22 Step-Up, your computer MUST be running MS-DOS 6, 6.2, or 6.21. (I told you this about 2 weeks ago.) It's been available since at least 1999. Don't get the Step-Up confused with MS-DOS 6.x upgrade for older VERSIONS of MS-DOS (3.0 to 5.0) which you had to pay for. Quote No explanation of why they would do this. None needed. They have MS-DOS 6, 6.2 or 6.21 installed and they want to update as much as they can. Quote Is it legal? On y if you have a computer. I don't really see the point of these remarks. Is this some kind of running joke? You do realise that this isn't a complete MS-DOS install set? You may as well think of it as a "Service Pack" for the versions of MS-DOS 6 before 6.22. |
|
| 8856. |
Solve : How do you add line breaks when writing to a notepad file?? |
|
Answer» How do you add LINE BREAKS when using DOS to write to a text document? Code: [Select]whatever rolls eyes |
|
| 8857. |
Solve : How do you add several requirments to one "if" command?? |
|
Answer» I couldn't find the right way to say this, but: |
|
| 8858. |
Solve : move the files from one folder to another in VSS using MS-DOS commands? |
|
Answer» Hi, |
|
| 8859. |
Solve : Batch script for every file found in a given directory.? |
|
Answer» Hello guys, |
|
| 8860. |
Solve : File Rename? |
|
Answer» Hi All, |
|
| 8861. |
Solve : Problem with script to replace substrings in file, *censored* truncating!? |
|
Answer» Hi, so I have created a batch file to replace each occurence of the SUBSTRING "sid" in a reg file with the usersid. |
|
| 8862. |
Solve : ANSI esc Code help. Input on bottom, output on top.? |
|
Answer» I am modding my MS-DOS 7.10 prompt to look like the colsoles in Fallout 3, the RobCo Unified Operating System. The input is on the bottom, and the OUTPUT in in the middle, after the standard watermark thingy. This is what I have in autoexec.bat. All answers appreciated.Sorry, I don't know. - However, In the search box on the upper right, TYPE in ANSI and click the search bottom. This site has a collection of over 100 articles or threads on the use of ANSI for MAKING special console layouts or in in DOS. Including color, TEXT size and EVEN graphics. Like This... Also, have you looked over this resource? http://en.wikipedia.org/wiki/ANSI_escape_code Is this for some kind of presentation or prototype?Well, I have figured out my problem. When the prompt refreshes, it clears the screen with the $e[3l. I have removed that and it's working fine. And I had already read almost all documentation on ANSI. I was refered by another person on Tom's Hardware. |
|
| 8863. |
Solve : create an exact copy with date in batch file? |
|
Answer» Hi, use %date% variable wherever you want This is nonsense if %date% contains slashes. Like "03/06/2011". Which is what %date% says here. Quote should work, if not its something like that Please do not post wild guesses. Or "something like that". Just tested solutions. Ones that work. for /f "tokens=1-5 delims=/ " %%d in ("%date%") do robocopy "C:\Data" "E:\data-%%e-%%f-%%g" /MIR better?Quote from: a117yogi on June 03, 2011, 03:32:24 PM for /f "tokens=1-5 delims=/ " %%d in ("%date%") do robocopy "C:\Data" "E:\data-%%e-%%f-%%g" /MIR OK, but why don't you address the issue of differing local date formats? This getdate batch comes in handy to determine the date fields without having to read the REGISTRY: Here is my version of GetDate.bat. I've tried it in all the 'English' date formats in XP, Vista, Win7. If you pass the name of an environment variable ( no %'s in the argument) it will get set to the current date. yyyymmdd is returned in the errorlevel as a number but it can be used as %ymd% for an 8 digit date with no separaters. Code: [Select]@echo off&SetLocal EnableDelayedExpansion&goto :start :GetDate.bat [EnVar] echo.GetDate [EnVar] Sets date into environment variable, EnVar as: mm-dd-yyyy echo.Usage: GetDate mdy^&set ymd=%%errorlevel%%, ^(use %% rather than ^^! in command line) echo.Usage: GetDate mdy^&set ymd=^^!errorlevel^^!, ^(use ^^! rather than %% in script^) echo.If no argument passed it echo's the date in mm-dd-yyyy format echo.Returns yyyymmdd in errorlevel regardless if Envar is passed as argument or not echo.Works on any NT/2K/XP/Vista/Win7 machine independent of regional date settings EndLocal&exit /b :start set p1=%~1&if /i !p1! equ /? goto :GetDate for /f "tokens=1-4 delims=/-. " %%a in ("%date%") do call :s_fixdate %%a %%b %%c %%d if /i 1%yy% lss 20 set "yy=0%yy%" if /i %yy% lss 80 (set yy=20%yy%) else (if %yy% lss 100 set yy=19%yy%) if defined p1 EndLocal&call set "%~1=%mm%-%dd%-%yy%"&exit /b %yy%%mm%%dd% EndLocal&echo.%mm%-%dd%-%yy%&exit /b %yy%%mm%%dd% :s_fixdate if /i "%1:~0,1%" gtr "9" shift for /f "skip=1 tokens=2-4 delims=(-)" %%e in ('date^<nul') do ( set %%e=%1&set %%f=%2&set %%g=%3 ) exit /b I have some other groovy command line and script friendly date and date math routines if anyone is interested. carlsomoQuote from: Salmon Trout on June 03, 2011, 05:02:54 PM OK, but why don't you address the issue of differing local date formats? he said format is not a problem, read first postQuote from: a117yogi on June 04, 2011, 08:48:55 PM he said format is not a problem, read first post I'm talking about your "solution" which does not work for every local date format.Here is the updated solution to get the current date set in mm-dd-yyyy This is a batch file that does not have to read the registry if you pass a variable name as argument it gets set to the date in mm-dd-yyyy errorlevel is set to yyyymmdd It can now handle the 05-Jun-11 format with minor modifications to what i posted prior. Code: [Select]@echo off&SetLocal EnableDelayedExpansion&goto :start :GetDate [EnVar] echo.GetDate [EnVar] Sets date into environment variable, EnVar as: mm-dd-yyyy echo.Usage: GetDate mdy^&set ymd=%%errorlevel%%, ^(use %% rather than ^^! in command line) echo.Usage: GetDate mdy^&set ymd=^^!errorlevel^^!, ^(use ^^! rather than %% in script^) echo.If no argument passed it echo's the date in mm-dd-yyyy format echo.Returns yyyymmdd in errorlevel regardless if Envar is passed as argument or not echo.Works on NT/2K/XP/Vista/Win7 machines independent of most regional date settings EndLocal&exit /b :start set p1=%~1&if /i !p1! equ /? goto :GetDate for /f "tokens=1-4 delims=/-. " %%a in ("%date%") do call :s_fixdate %%a %%b %%c %%d if /i 1%yy% lss 20 set "yy=0%yy%" if /i %yy% lss 80 (set yy=20%yy%) else (if %yy% lss 100 set yy=19%yy%) if defined p1 EndLocal&call set "%~1=%mm%-%dd%-%yy%"&exit /b %yy%%mm%%dd% EndLocal&echo.%mm%-%dd%-%yy%&exit /b %yy%%mm%%dd% :s_fixdate if /i "%1:~0,1%" gtr "9" shift for /f "skip=1 tokens=2-4 delims=(-)" %%e in ('date^<nul') do ( set %%e=%1&set %%f=%2&set %%g=%3 ) if /i "%mm:~0,1%" gtr "9" call :month_convert mm exit /b :month_convert SetLocal set "months=Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec" call set "month=%%%~1%%" for /l %%a in (1,1,12) do ( set/a mon=%%a call :month_assign !mon! if /i !errorlevel! equ 0 ( if /i 1!mon! lss 20 set "mon=0!mon!" goto :out ) ) :out EndLocal&call set "%~1=%mon%"&exit /b :month_assign mnum set/a mnum=%~1 for /f "tokens=%mnum%" %%m in ("%months%") do if /i %month% equ %%m exit /b 0 exit /b 1 Quote @echo off&SetLocal EnableDelayedExpansion&goto :start Zowie! There is enough code here to launch a space shuttle. I was able to clean up the code and run it, but I'm unsure of my results or what to do with them. The code set an environmental variable with todays date (mm-dd-yyyy). With all due respect, can't this be done by parsing the %date% variable? Quote This getdate batch comes in handy to determine the date fields without having to read the registry: Why not use the registry? The registry serves as a database for all the system settings, so why not go the source for this information? The founder of KISS University must be spinning in his grave. Quote from: Sidewinder on June 06, 2011, 08:18:02 AM Why not use the registry? The registry serves as a database for all the system settings, so why not go the source for this information? You mean like this? Code: [Select]for /f "skip=2 tokens=3 delims= " %%A in ('reg query "HKEY_USERS\.DEFAULT\Control Panel\International" /v sShortDate') do echo %%A Quote The founder of KISS University must be spinning in his grave. But his alumni are still around... I was at the Advanced Studies School of that University, but I never abbreviate it. The above line returns this here in the UK: Code: [Select]dd/MM/yyyy Lots of other goodies... sCurrency, sLanguage, sTimeFormat, etcthe registry related satement: Code: [Select]for /f "skip=2 tokens=3 delims= " %%A in ('reg query "HKEY_USERS\.DEFAULT\Control Panel\International" /v sShortDate') do echo %%A certainly gives you M/d/yyyy or whatever format but let's say you wish to create 'yyyymmdd.filename.jpg' one still has to assign date variables once the format is known. Thus there is more code work to do. In the end I can put this in a script: Code: [Select]call getdate today_mdy&set today_ymd=!errorlevel! ren "filename.ext" "%today_ymd%.filename.ext" echo "filename.ext" was renamed to" %today_ymd%.filename.ext" on %today_mdy%>>file_rename.log this statement: Code: [Select]for /f "skip=1 tokens=2-4 delims=(-)" %%e in ('date^<nul') do set %%e=%1&set %%f=%2&set %%g=%3 where %1 thru %4 came from parsing %date% in whatever format the user has on their machine makes the assignments in all of the formats, excluding "Mon 06/06/2011" (and/11) and "06-Jun-2011" ie. mm=06 dd=06 and yy=2011 (or 11) regardless of MM/dd/yyyy, yy/MM/dd, or yyyy/MM/dd The 'shift' containing statement strips "Mon 06/06/2011" to "06/06/2011" in the M/d/yyyy and M/d/yy formats prior to the for loop. The 'if' statement following and the called code below it is necessary to change 'Jun' to '06' (and not '6') Since I am an admin I don't have a problem accessing the registry but limitted users may not in all cases. I was aware of the registry keys holding the date format but I decided to avoid it and I don't think that lengthened the overall code by much and the desired result pops out in less than a second (0.24 on my machine). I posted here because I had already written the batch code (that I use all the time) and I wished to help the fellow who made the original post. Then Salmon rightly pointed out the "06-Jun-2011" format wasn't covered so I covered it for completeness sake. Now I can run date related batch code on mutliple machines with differing operating systems and obtain the date (in the formats I use) without worrying about the regional setting or user preference on any given machine. Now it's my turn.... Please shorten the routine using registry keys or whatever to return the date in two USEFUL formats. My goal at the outset was not to write the shortest code possible but to get the job done as I have had routines blow up when running into differing formats everywhere I go. Respectfully, CarlAn alternative to using sShortdate would be using iDate and sDate in the HKCU\Control Panel\International registry key. The iDate defines three values and three date formats (0=mm/dd/yy, 1=dd/mm/yy, and 2=yy/mm/dd). The sDate value defines the separator which can be used as the delimeter in a for statement. The only roadblock is that some machines display the day of week with the date command. This can be determined by using a regular expression in the findstr command. Code: [Select]for /f "skip=2 tokens=3" %%a in ('reg query "HKEY_CURRENT_USER\Control Panel\International" /v iDate') do ( set idate=%%a ) for /f "skip=2 tokens=3" %%a in ('reg query "HKEY_CURRENT_USER\Control Panel\International" /v sDate') do ( set sdate=%%a ) :: If first CHARACTER of date is alpha, presume DOW :: echo %date:~0,1% | findstr /r "[A-Z]" > nul if errorlevel 1 ( for /f "tokens=1-3* delims=%sdate% " %%a in ('date /t') do ( if %idate%==0 (set year=%%c & set month=%%a & set day=%%b) if %idate%==1 (set year=%%c & set month=%%b & set day=%%a) if %idate%==2 (set year=%%a & set month=%%b & set day=%%c) ) ) else ( for /f "tokens=1-4* delims=%sdate% " %%a in ('date /t') do ( if %idate%==0 (set year=%%d & set month=%%b & set day=%%c) if %idate%==1 (set year=%%d & set month=%%c & set day=%%b) if %idate%==2 (set year=%%b & set month=%%c & set day=%%d) ) ) Once the date components (month, day, year) are isolated, it should be childs play to format them any which way. Just a thought. VBScript hybrid... Code: [Select]@echo off echo Wscript.echo eval(WScript.Arguments(0))>evaluate.vbs for /f "delims=" %%A in ('cscript //nologo evaluate.vbs "FormatDateTime(Now, 0)"') do echo FormatDateTime(Now, 0) %%A for /f "delims=" %%A in ('cscript //nologo evaluate.vbs "FormatDateTime(Now, 1)"') do echo FormatDateTime(Now, 1) %%A for /f "delims=" %%A in ('cscript //nologo evaluate.vbs "FormatDateTime(Now, 2)"') do echo FormatDateTime(Now, 2) %%A for /f "delims=" %%A in ('cscript //nologo evaluate.vbs "FormatDateTime(Now, 3)"') do echo FormatDateTime(Now, 3) %%A for /f "delims=" %%A in ('cscript //nologo evaluate.vbs "FormatDateTime(Now, 4)"') do echo FormatDateTime(Now, 4) %%A for /f "delims=" %%A in ('cscript //nologo evaluate.vbs "Year (Date)"') do echo Year(Date) %%A for /f "delims=" %%A in ('cscript //nologo evaluate.vbs "Month(Date)"') do if %%A lss 10 ( echo Month^(Date^) 0%%A ) else ( echo Month^(Date^) %%A ) for /f "delims=" %%A in ('cscript //nologo evaluate.vbs "Day (Date)"') do if %%A lss 10 ( echo Day^(Date^) 0%%A ) else ( echo Day^(Date^) %%A ) Code: [Select]FormatDateTime(Now, 0) 07/06/2011 08:20:15 PM FormatDateTime(Now, 1) 07 June 2011 FormatDateTime(Now, 2) 07/06/2011 FormatDateTime(Now, 3) 08:20:16 PM FormatDateTime(Now, 4) 20:20 Year(Date) 2011 Month(Date) 06 Day(Date) 07Thank you for the informative response. I've noticed that you give a lot of your time to help share your knowledge and respond to querries and conundrums. I wish more people had that attitude. |
|
| 8864. |
Solve : Batch file: find and delete? |
|
Answer» Hi, I need to WRITE a batch FILE that READS a txt file that contains a number of file PATHS, then it should remove the chosen string from each line and copy into a new file e.g. |
|
| 8865. |
Solve : .bat file to read a file,create a folder then move file into folder? |
|
Answer» I would really appreciate anybody's help here, What I'm trying to do is the following: |
|
| 8866. |
Solve : .bat file that reads from a existing .txt file and creates a new .txt file? |
|
Answer» Hello everyone. |
|
| 8867. |
Solve : Help!Extract content from .xml files? |
|
Answer» Hi, everyone, |
|
| 8868. |
Solve : Batch remove - and . fixed length many suffix? |
|
Answer» I have to rename thousands of ???files with the nonstandard characters "." and "-". Fixed length, nothing else in folder, only the number changes, same DATE & system per folder, can be folder specificic, and multiple suffix, ie: Do you think the FOR loop is appropriate for this? Thanks. Absolutely. What I would do is enable delayed expansion and in a loop, READ in each filename, then using the ~n and ~x variable modifiers, split it into base name and extension, take the base name and use string replace (twice, once to replace . with _ and again to replace - with _) then add the extension back and use the old name and new name in a REN command. Unfortunately it is 7 AM here and I am gong to work so I won't be able to actually post some example code until around 9 hours time. Maybe somebody else will beat me to the punch? (Not you, Bill!) Quote from: Salmon Trout Maybe somebody else will beat me to the punch? Nobody would dare!!! Ugh, I don't know why the little smiley faces showed up all over my post! Thanks, Salmon Trout, that is the solution. I actually posted the same question on another forum and code using the filename parameter extensions (ie, %~n and %~a) were used in an FOR loop. I'll have to brush up on the use of extensions. I give credit to Salmon Trout and the other person with code for the solution. I'd post the other person's website and username, but I don't know how kosher that is with you all or him/her. Either way, you all have created a true believer in DOS-Batch. Thanks again.Code: [Select]@echo off setlocal enabledelayedexpansion for /f "delims=" %%A in ( ' dir /b ' ) do ( set oldbasename=%%~nA set extension=%%~xA set newbasename=!oldbasename:.=_! set newbasename=!newbasename:-=_! echo Renaming "!oldbasename!!extension!" to "!newbasename!!extension!" REN "!oldbasename!!extension!" "!newbasename!!extension!" ) echo. echo All done pause Quote from: AndrewJW on June 13, 2011, 08:22:54 AM I don't know why the little smiley faces showed up all over my post! Unless you show text as code, this forum shows VARIOUS character combinations as EMOTICONS to all guests and all registered users who have not have selected "No Smileys" as the "Current Smiley Set" in their Profile Look and Layout Preferences. These are 3 question marks: If you see that as that *censored* stupid bewildered emoticon, that is why. This is a figure 8 and an end bracket I really hate emoticons. |
|
| 8869. |
Solve : batchfile to backup sharepoint web application? |
|
Answer» I am trying to write a batch file that will backup a WEB application, we have a multi-tennant farm so I WANT to promt the end user to type in the siteID |
|
| 8870. |
Solve : DOS batch file - not recognized as an internal command ...? |
|
Answer» This is all you really NEED. The rest is just BELLS and whistles. |
|
| 8871. |
Solve : shutdown batch script? |
|
Answer» I am trying to write a batch file that I can use to shutdown/restart computers in my domain REMOTELY. When I type this into the CMD prompt it will work. |
|
| 8872. |
Solve : ftpcmd with dynamic names? |
|
Answer» Hello, Is it also possible to give the file a suffix? So 20062011221.mp3 will be 20062011221-done.mp3 on my server? Why not try renaming the file? Code: [Select]ren C:\files\%dt%.mp3 %dt%-done.mp3 Suggest doing this after the ftp command is complete. If the ftp command returns an errorlevel you can condition the ren in case the upload fails. |
|
| 8873. |
Solve : Attempting to find hash? |
|
Answer» I'm trying to FIND the hash of my favourite minecraft server so I can automatically switch to it if it changes IP addresses without having to look through the server list and find it, but I'm running into a bit of an issue. When I go to http://www.minecraft.net/servers.jsp and look at the source, I see the server details like this:<BR>Code: [Select]<a href="play.jsp?server=79be7a5abc334f8ae4bcbcd235cd4141"><b>Neko-san. Nyan!</b></a> 8/50 Tried using PHP with cURL?How exactly kpac? There is no switch between --pass and --post301. I'm using the command line "Win32 2000/XP on i386 curl executable" version. you need to be logged in to join or even get links to multiplayer games. (if you log out and view the page you don't get links either). why can't you use view source from within the browser to acquire the link/hash?Quote from: BC_Programmer on May 24, 2011, 08:53:03 PM you need to be logged in to join or even get links to multiplayer games. (if you log out and view the page you don't get links either).So true BC, I completely forgot about that. I already answered that question in my first post however, I wish to do this all automatically. I run a bot for the server, which automatically rejoins except when the server IP changes. I tried using my cookie from internet explorer, but that didn't give desired results, so how would I log in with cURL and download the file? I tried using --user USERNAME:PASSWORD, but that ALSO didn't work. I tried to OBTAIN a cURL cookie by using Code: [Select]curl --cookie-jar newcookie.txt --data "username=USERNAME^&password=PASSWORD^&use_secure=false" http://www.minecraft.net/login.jsp but it tells me my username or password is incorrect, I've checked that they're right.Quote from: Helpmeh on May 24, 2011, 09:05:53 PM So true BC, I completely forgot about that. I already answered that question in my first post however, I wish to do this all automatically. I run a bot for the server, which automatically rejoins except when the server IP changes. youve put that secure=false, surely this needs to be set to true?Nope. I checked the POST data when I submit the form and that's what it is.I would try Denmark.... Sorry Helpmeh....couldn't resist. Quote from: patio on June 07, 2011, 05:37:12 PM I would try Denmark....*sigh* No actual advice though? It doesn't even technically need it to be batch...it just needs to put the hash in a file for the bot.Nobody has an answer...*sigh* BUMP |
|
| 8874. |
Solve : makefile and enviromental varriable confusion? |
|
Answer» Hi I'm trying define functions in a makefile such as echo and sed using the following code:- environmental variables Environment variables. |
|
| 8875. |
Solve : bat file to search a file and form new reports from the file? |
|
Answer» Hi i have a log.txt file which has multiple entries like below |
|
| 8876. |
Solve : Saving hard drive C: to portable hard drive via DOS? |
|
Answer» If possible, what WOULD the DOS command be to save the total contents of hard drive C: to portable hard drive E? Or will drag and drop do it?You can create an almost exact copy of C to E with DOS, but you will want to avoid trying to copy parts of windows such as SWAP files etc. Most use an image utility to BACKUP C: as an image to say E: external if you want a full system recovery option. If you are looking to just backup MUSIC, PICTURES, documents etc, then you can create a routine to do xcopy or robocopy those files/folders to E:Thanks David Lembke |
|
| 8877. |
Solve : Can i make those changes?? |
|
Answer» I have a book. I WANT to some CHANGES in this book. This book is in pdf format. Can I make those changes?YES. But you NEED to have a CONVERTER. I am not sure if there are any free PDF to MS Word converter out there. |
|
| 8878. |
Solve : Which is the best cli os?? |
|
Answer» can anyone tell me which one is the best & popular cli os in linux & unix?Are you REFERRING to the shell? |
|
| 8879. |
Solve : Need batch file to provide answers to prompts that come up after running the cmd? |
|
Answer» Hi |
|
| 8880. |
Solve : Need Help in appending a substring of previous line to next subsequent lines? |
|
Answer» You can right justify the file size in an (e.g.) 16 char wide column quite easily - then you can use sort /R /+N on the output file - N (starting column for sort) will depend on the date and time field widths which depend on local SETTINGS. and my expected output should be Forcing the size data into a 16 byte width seems unnecessary as does using the sort command. Excel with import it correctly. The new model of this snippet from *censored* has gone from I/O bound to to CPU bound. Is this an improvement? [that's a rhetorical question ST] Code: [Select]@echo off rem for /f "usebackq tokens=1" %%v in (`mountvol ^| find ":\"`) do ( for /f "tokens=* delims=" %%i in ('dir "%%v" /b /s /a-d /o:-s') do ( echo %%~ti,%%~zi,%%~nxi,%%~dpi >> Final_Master.csv ) ) Quote from: Sidewinder on July 17, 2011, 02:32:35 PM Based on the OP reply #1, the files are sorted correctly coming out of the dir command and require no further processing In a later post he says he WANTS a LIST of files in each folder, on each drive letter on his server, sorted in descending order of file size... Quote 1. I need to search each and directory and file in each drive and sort all the files according their size in descending order. i.e Largest file in the server to smallest file with path where it is existing. Dir sorts the files for each folder independently, so a further sort will be necessary. Quote Forcing the size data into a 16 byte width seems unnecessary as does using the sort command. Excel with import it correctly. I asked the OP whether he had Excel but got no reply. Quote The new model of this snippet from *censored* has gone from I/O bound to to CPU bound. Is this an improvement? [that's a rhetorical question ST] I'm not sure... Quote from: Sidewinder on July 17, 2011, 02:32:35 PM Forcing the size data into a 16 byte width seems unnecessary as does using the sort command. Excel with import it correctly. I just found that when importing a csv that Excel 2003 has a maximum number of rows limitation of 65,536 - Excel 2007 is 1,048,576 rows Anyhow, Powershell is much quicker than batch - I catalogued my whole computer in 2 minutes 35 seconds; using batch and dir took 50 minutes 51 seconds. 320,000 files approx in around 62,000 folders Found 25 GB of forgotten stuff to delete |
|
| 8881. |
Solve : .txt output of batch session? |
|
Answer» I am using batch to run a folder full of python scripts over the weekend |
|
| 8882. |
Solve : Echo vs. Echo to file (make file)? |
|
Answer» Hi, |
|
| 8883. |
Solve : Batch Generator? |
|
Answer» Hi |
|
| 8884. |
Solve : Programmes running? |
|
Answer» I have used this COMMAND many times in the PAST, but have now suddenly forgotten it. The command brings up, I think 3 tabs. Under one of them are listed the startup programmes, each with a tick box. If you want to stop a particular programme from starting, just remove the tick..I've just remembered, always the way...msconfig..Msconfig was designed to be a diagnostic utility. It should not be used to make permanent changes to startup processes. Instead you should use a 3rd party app designed for the purpose. One such app is Mike LIN's Startup Control Panel (http://www.mlin.net/StartupCPL.shtml). There are other, more comprehensive apps - but this one is simple and STRAIGHTFORWARD. |
|
| 8885. |
Solve : how to form a triangle on dos command?? |
|
Answer» i need the whole code to form a triangle... plss HELP Me!homework?Quote from: Allan on JULY 12, 2011, 06:19:28 AM homework? They give homework in summer school? If you don't do the ASSIGNMENT, do they punish you by sending you to regular school? I found this on the CH boards. The basic code is there, feel free to modify it. Quote from: Kay_IT23 on July 12, 2011, 06:18:17 AM i need the whole code to form a triangle... plss Help Me! -You didn't say what programming language -You didn't show what you have tried so farCode: [Select]@echo. ___ @echo. \ / @echo. V run that as a batch file..LOL |
|
| 8886. |
Solve : Use Batch to Stop a service that is in a state of starting?? |
|
Answer» Can someone confirm if stop or taskkill from a batch file will be able to stop/kill a service that is hung in a state of "starting"? I need to stop services across MULTIPLE servers in a particular order and then restart those same services in the reverse order. |
|
| 8887. |
Solve : batch to stop services on multiple servers and then restart same services? |
|
Answer» I've seen some different postings regarding stopping and starting services and dependencies between services. Here is my need. I have 3 servers with one or two services in question running on each server. I will always know which of the 2 services exist on each server, so that is not an issue. Here is what needs to happen: |
|
| 8888. |
Solve : Need help on file compare option? |
|
Answer» Hi Friends, fc file1 file2 The original poster desired to find which strings were present in the first file but not in the second. The FC command merely does a simple comparison. If we assume that the second file is just a copy of the first but with one or more lines deleted, then FC will flag every line after the missing one as a "difference", whether or not it is missing from the first file. Possibly by a diligent EXAMINATION ofthe output it might be possible to discover the required information, but ti WOULD not be very convenient. |
|
| 8889. |
Solve : .bat - looping through a text file? |
|
Answer» Hi, |
|
| 8890. |
Solve : Adding domain users to local group through command prompt? |
|
Answer» In computer management, when I add a domain USER group to the local ADMINISTRATORS group, I'm prompted for my Active Directory CREDENTIALS. |
|
| 8891. |
Solve : File Compare? |
|
Answer» Hello all, I did do a controlled test to see what returned. The real data return seems different and I don't understand the result. So, I'm not understanding what FC is supposed to return when one line differs. What do you mean "if one line differs"? Do you mean 2 files which have exactly the same number of characters, in the same number of lines, but one line is different in one of the files? At the beginning, in the middle, or at the end? Or two one-line files, each different from the other? Or what? The results below seem clear enough to me. Text1.txt Code: [Select]The prime minister, in Brussels for an EU summit where Greece's debt crisis is among items on the agenda, SAID: "Britain is out of the euro - I think we will stay out of the euro and certainly as long as I am doing this job there is no prospect of Britain even contemplating JOINING the euro." The Greek parliament has to pass fresh austerity measures next week before the country can gain vital bail-out funds to prevent it defaulting on its loan payments, due in mid-July. Mr Blair told BBC One's Politics Show, in an interview to be broadcast on Sunday, he had backed the idea of Britain joining the euro when he came to power - but had accepted that the conditions had to be right. Text2.txt - First line: lower case p changed to upper case. Code: [Select]The Prime minister, in Brussels for an EU summit where Greece's debt crisis is among items on the agenda, said: "Britain is out of the euro - I think we will stay out of the euro and certainly as long as I am doing this job there is no prospect of Britain even contemplating joining the euro." The Greek parliament has to pass fresh austerity measures next week before the country can gain vital bail-out funds to prevent it defaulting on its loan payments, due in mid-July. Mr Blair told BBC One's Politics Show, in an interview to be broadcast on Sunday, he had backed the idea of Britain joining the euro when he came to power - but had accepted that the conditions had to be right. Text3.txt - 7th line: July changed to july Code: [Select]The prime minister, in Brussels for an EU summit where Greece's debt crisis is among items on the agenda, said: "Britain is out of the euro - I think we will stay out of the euro and certainly as long as I am doing this job there is no prospect of Britain even contemplating joining the euro." The Greek parliament has to pass fresh austerity measures next week before the country can gain vital bail-out funds to prevent it defaulting on its loan payments, due in mid-july. Mr Blair told BBC One's Politics Show, in an interview to be broadcast on Sunday, he had backed the idea of Britain joining the euro when he came to power - but had accepted that the conditions had to be right. Text4.txt - Last line: had changed to Had Code: [Select]The prime minister, in Brussels for an EU summit where Greece's debt crisis is among items on the agenda, said: "Britain is out of the euro - I think we will stay out of the euro and certainly as long as I am doing this job there is no prospect of Britain even contemplating joining the euro." The Greek parliament has to pass fresh austerity measures next week before the country can gain vital bail-out funds to prevent it defaulting on its loan payments, due in mid-July. Mr Blair told BBC One's Politics Show, in an interview to be broadcast on Sunday, he had backed the idea of Britain joining the euro when he came to power - but Had accepted that the conditions had to be right. Code: [Select]C:\>fc Text1.txt Text2.txt Comparing files Text1.txt and TEXT2.TXT ***** Text1.txt The prime minister, in Brussels for an EU summit where Greece's debt crisis is among items on the agenda, said: "Britain is out of the euro - I think we will ***** TEXT2.TXT The Prime minister, in Brussels for an EU summit where Greece's debt crisis is among items on the agenda, said: "Britain is out of the euro - I think we will ***** C:\>fc Text1.txt Text3.txt Comparing files Text1.txt and TEXT3.TXT ***** Text1.txt country can gain vital bail-out funds to prevent it defaulting on its loan payments, due in mid-July. Mr Blair told BBC One's Politics Show, in an interview to be broadcast on ***** TEXT3.TXT country can gain vital bail-out funds to prevent it defaulting on its loan payments, due in mid-july. Mr Blair told BBC One's Politics Show, in an interview to be broadcast on ***** C:\>fc Text1.txt Text4.txt Comparing files Text1.txt and TEXT4.TXT ***** Text1.txt Sunday, he had backed the idea of Britain joining the euro when he came to power - but had accepted that the conditions had to be right. ***** TEXT4.TXT Sunday, he had backed the idea of Britain joining the euro when he came to power - but Had accepted that the conditions had to be right. ***** This is in the middle of the file. The two files differ: Nicole and NICOL Line 388 shows only the last 8 characters of the 136-char line above Line 390 shows the last 32 chars of the end of line 389 (I removed some spaces from its 160 chars for viewing) 388: 70126 F 389: CN 00003336163300276801 SMITH, NICOLE 20110510 007076730 319.45 390: F+000000000+000000000 So, it looks like lines are limited to 128 characters. The line above shows the tail end after the first 128. The line below shows the overflow beyond 128 chars of the line that differs. Rings a bell. It's been some time since I've used this but I do look at DOS text files well exceeding 128 character line lengths. Now I know what I'm looking at! Could not compute yesterday ; ) Thanks. |
|
| 8892. |
Solve : Batch file set /p not working? |
|
Answer» If I make a batch and place set /p=whatever? inside an if statement, it doesn't work. However, if it is outside of the if statement, it does. @echo offQuote from: Helpmeh on June 14, 2011, 03:33:31 PM Put a caret ^ before the brackets. Your code should be: As has been noted, ordinary brackets have a special meaning in batch scripts. I tend to use SQUARE brackets e.g. set /p answer="Do you want to dance [y/n]? " and I like to use quotes to space the console cursor away from the end of the prompt string. Salmon, I noticed that you put quotes around it. I found that using the quotes eliminates the need for the ^ even if I use (y/n). Thanks for the help.Quote from: Linux711 on June 14, 2011, 04:43:33 PM I noticed that you put quotes around it. I found that using the quotes eliminates the need for the ^ even if I use (y/n). Yes, I forgot to mention that. I do that with set /p user prompt messages because I like to not have the console blinking cursor straight after the end of the prompt. With quotes I can add a space. But quotes are useful in other ways too. You can get rid of a lot of special-character-in-string problems if you quote the string. Quotes aren't necessary to add the extra space, but like you said Salmon, it does eliminate special character issues.Quote from: Helpmeh on June 15, 2011, 05:40:02 PM Quotes aren't necessary to add the extra space What other way is there of addding the extra space? Quote from: Salmon Trout on June 15, 2011, 11:53:49 PM What other way is there of addding the extra space? I know about using a non-printing space (Hex FF or Alt+255) Just to summarize: The OP found that a structure of this TYPE didn't do what he expected: IF X=Y ( set /p blabla=Answer yes or no (/y/n) ) The reason was that the round brackets around "y/n" break the parenthetical (bracketed) multiline IF structure. The OP was offered a number of solutions:
Following this, the OP pronounced himself satisfied. Quote from: Salmon Trout on June 15, 2011, 11:53:49 PM What other way is there of addding the extra space? Adding a space at the end...:facepalm: Code: [Select]@echo off title BOTSAY echo Between: echo.^| ^| :loop set /p msg= echo %msg% > SAY.txt goto loopThe space does exist in the original code, it just gets eliminated by the forum software.Quote from: Helpmeh on June 20, 2011, 04:25:36 PM Adding a space at the end...:facepalm: What are you talking about exactly? This has nothing to do with the point I was making. Quote from: Salmon Trout on June 20, 2011, 11:59:55 PM What are you talking about exactly? This has nothing to do with the point I was making.Quote from: Salmon Trout on June 15, 2011, 11:53:49 PM What other way is there of addding the extra space?I answered the QUESTION. Batch files themselves don't need the quotes, the forum software does, because it truncates trailing spaces. |
|
| 8893. |
Solve : Actual MS-DOS? |
|
Answer» #1 Rule... The OP did not make it clear why he wants "actual DOS". Perhaps some users night believe that the old DOS has primitive utilities that can better manage the hard drive. Not so.Quite right, and I do agree with you here. I don't think I would ever say fdisk is easier to use- or understand- then SOMETHING like Disk Management or GParted, unless one has already had experience using it. Quote These utilities wee written before significant changes were made in Hared Drive geometry and do not perform as the user might wish."These utilities"; they only talk about fdisk, and there is no significant danger from running fdisk on a drive, since it will not rewrite the boot code of the MBR, only the partition table. Quote The MAR is not just an area one the hard drive where some address are stored.I never said it was. It is one area of the hard drive, though. the first sector of the drive, to be exact. Exactly 512 bytes. The offsets of important data are in fact standardized. All MBR's will have the Partition table (4 16-byte entries) at offset 446 within the sector. This is never different, regardless of the operating system. All that changes is the bytes before that, which determine the actual code used to start the boot loader itself. NT's boot loader differed from Win9x/MSDOS because it needed to have rudimentary support for NTFS to be able to find the boot loader, additionally it needed to know to look for NTLDR. Windows Vista's MBR boot code differs from XP and earlier in that they changed the boot loader to bootmgr, which has far more capabilities than NTLDR. Either way, the only task of the boot code in the MBR is to start this boot loader. That's it. It doesn't determine or change the "layout" of data on the drive, excepting of course the partition table. Quote There are rules as ton what can be placed there.Yes. That's what I've been saying. Quote The rules have changed.No they haven't. The code area of the MBR is still the first 446 bytes. the partition table is still 4 16 byte entries. the MBR signature that follows is still 2 bytes. What rules have changed with Vista? none- the only difference is that there is a different boot code to look for the new boot loader. Does the boot loader operate differently? Of course. But GRUB also operates differently from NTLDR and LILO operates different from BOOTMGR, but for some reason nobody is saying that a tool like GPARTED will cause the MBR to become "corrupted". Quote The rules are not consistentYes. they are really quite simple. Certain data is stored at specific offsets. 4 partitions per drive. the size of logical drives in the extended partition(which can be used to work past the "4-partition limit" are stored in EBR (Extended Boot Records) within the Extended partition. This has not changed with Vista. Quote The full set of rules is not seen by a casual examination of the area.Yes, they are. the fact that the Vista and XP MBR's both conform to the given standard for MBR layout sort of confirms that there is a full set of rules and they are being used by both operating SYSTEMS. Quote The rules have been a moving target.They were never a moving target. In fact, the layout of the MBR has been entirely unchanged since MS-DOS 2.00 when the original Hard disk support was added. Probably earlier. No Operating System that runs on a PC has used a on-disk format that didn't have an MBR. This includes Vista x64 when the drives are partitioned using GPT, since those drives also have a valid MBR- GPT acts as an extension. Quote That is why the GUID is now the way to go.GPT is the preferred choice over the longer course simply because it extends the limitations of MBR. with MBR, no one partition can exceed 2TB in size, and no one partition can have an offset larger then 2TB from the start of the disk. needless to say this causes problems when you have drives larger than 2TB, which are starting to become available on the consumer market. It also adds redundant partition tables to mitigate the issues with the MBR's partition table (which, to repeat, is always at offset 446 and is always 16*4 bytes in size), where there was only one copy and if it got corrupted for any reason the disk was pretty MUCH unsalvageable (without tools like MIRROR, of course). From the looks of things GPT merely brings to the lower level structures of the disk what file systems like NTFS, HPFS, Ext2/3/4 and so forth have been providing as file systems for years- that is, larger sized partitions, more partitions, and better resilience.I use Partition Manager 8 booted from a DOS floppy or a bootable USB drive. PM8 will see as much of the drive as your BIOS allows. PM8 will do just about anything you need to do a hard drive - partitioning, format FAT, FAT32, NTFS (all versions) etc. You can hide partitions, pick which partion you want active etc. Version 4 or 5 will format HPFS if you need it. If you have the Windows version you can create the 'rescue disks' if you have a 1.4 MB floppy drive. I use these disks to boot to Calerdra DOS. |
|
| 8894. |
Solve : Ping Command Crashing DOS? |
|
Answer» Quote from: H2O on July 11, 2011, 11:38:02 PM Also Linux, I tried to upload my pingpath and ping files but they weren't accepted by the site. Any ideas? Open in Notepad and copy and paste into a forum post. That's what most people do. I'm not exactly sure how to run it under 32-bit actually, and if Somebody knows then feel free to share. That time was for a picture but if I even just run the "ping" it closes. It even closes if I enter in "ping /?" which I find even more unnerving. Quote from: H2O on July 12, 2011, 05:58:50 PM I'm not exactly sure how to run it under 32-bit actually, and if Somebody knows then feel free to share. That time was for a picture but if I even just run the "ping" it closes. It even closes if I enter in "ping /?" which I find even more unnerving. your ping.exe file is corrupted. use sfc /scannow or a Repair install with the windows disc handy. (32-bit command prompt is cmd.exe; 16-bit is command.com. Salmon Trout already answered that question in an earlier post.) Also, what is a "pingpath" file?Thanks for clearing that up. I believe I will need to order a new disc as I haven't seen mine for over seven years I really don't know what pingpath is exactly. I did a search for "ping" on my system32 folder to find and run it from system32 as you recommended. It brought up my ping command as expected but also pingpath as well, which I thought seemed important. When I opened it, the same thing happens as when I ran ping- command box, randomness, TERMINATE. I'm thinking it's some outdated type of file associated with ping that might have become obsolete in newer models. If nobody else has it though I'll be a little suspicious.Quote from: BC_Programmer on July 12, 2011, 06:11:38 PM your ping.exe file is corrupted. use sfc /scannow or a Repair install with the windows disc handy. He means PathPing, I'm pretty sure, which is a network utility supplied in Windows NT and beyond that combines the functionality of ping with that of tracert, with additional information that neither of those tools provides. PathPing sends packets to each router on the way to a final destination over a period of time, and then computes results based on the packets returned from each hop. Since PathPing shows the degree of packet loss at any given router or link, you can pinpoint which routers or links might be causing network problems. http://technet.microsoft.com/en-gb/library/cc958876.aspx http://en.wikipedia.org/wiki/PathPing Example (My IP obfuscated): Code: [Select]C:\Users\Salmon>pingpath 'pingpath' is not recognized as an internal or external command, operable program or BATCH file. C:\Users\Salmon>pathping Usage: pathping [-g host-list] [-h maximum_hops] [-i address] [-n] [-p period] [-q num_queries] [-w timeout] [-4] [-6] target_name Options: -g host-list Loose SOURCE route along host-list. -h maximum_hops Maximum number of hops to search for target. -i address Use the specified source address. -n Do not resolve addresses to hostnames. -p period Wait period milliseconds between pings. -q num_queries Number of queries per hop. -w timeout Wait timeout milliseconds for each reply. -4 Force using IPv4. -6 Force using IPv6. C:\Users\Salmon>pathping www.google.com Tracing route to www.l.google.com [209.85.229.147] over a maximum of 30 hops: 0 Salmon-And-Tuna.cable.virginmedia.net [99.99.999.99] 1 10.15.176.1 2 aztw-geam-1a-ge134.network.virginmedia.net [80.1.242.49] 3 aztw-core-1a-ae0-0.network.virginmedia.net [80.1.241.9] 4 winn-bb-1a-as0-0.network.virginmedia.net [213.105.175.157] 5 manc-bb-1b-as7-0.network.virginmedia.net [212.43.163.189] 6 tele-ic-3-ae0-0.network.virginmedia.net [212.43.163.70] 7 158-14-250-212.static.virginmedia.com [212.250.14.158] 8 209.85.255.175 9 209.85.253.94 10 72.14.232.134 11 209.85.252.83 12 209.85.243.85 13 ww-in-f147.1e100.net [209.85.229.147] Computing statistics for 325 seconds... Source to Here This Node/Link Hop RTT Lost/Sent = Pct Lost/Sent = Pct Address 0 Salmon-And-Tuna.cable.virginmedia.net [82.33.185.47] 0/ 100 = 0% | 1 --- 100/ 100 =100% 100/ 100 =100% 10.15.176.1 0/ 100 = 0% | 2 17ms 0/ 100 = 0% 0/ 100 = 0% aztw-geam-1a-ge134.network.virginmedia.net [80.1.242.49] 0/ 100 = 0% | 3 15ms 0/ 100 = 0% 0/ 100 = 0% aztw-core-1a-ae0-0.network.virginmedia.net [80.1.241.9] 0/ 100 = 0% | 4 19ms 0/ 100 = 0% 0/ 100 = 0% winn-bb-1a-as0-0.network.virginmedia.net [213.105.175.157] 0/ 100 = 0% | 5 25ms 0/ 100 = 0% 0/ 100 = 0% manc-bb-1b-as7-0.network.virginmedia.net [212.43.163.189] 0/ 100 = 0% | 6 31ms 0/ 100 = 0% 0/ 100 = 0% tele-ic-3-ae0-0.network.virginmedia.net [212.43.163.70] 0/ 100 = 0% | 7 29ms 0/ 100 = 0% 0/ 100 = 0% 158-14-250-212.static.virginmedia.com [212.250.14.158] 0/ 100 = 0% | 8 27ms 0/ 100 = 0% 0/ 100 = 0% 209.85.255.175 0/ 100 = 0% | 9 26ms 0/ 100 = 0% 0/ 100 = 0% 209.85.253.94 0/ 100 = 0% | 10 32ms 0/ 100 = 0% 0/ 100 = 0% 72.14.232.134 0/ 100 = 0% | 11 37ms 0/ 100 = 0% 0/ 100 = 0% 209.85.252.83 0/ 100 = 0% | 12 37ms 0/ 100 = 0% 0/ 100 = 0% 209.85.243.85 0/ 100 = 0% | 13 33ms 0/ 100 = 0% 0/ 100 = 0% ww-in-f147.1e100.net [209.85.229.147] Trace complete. C:\Users\Salmon> Thank you once again Salmon. I appreciate your zeal in this forum. I just tried the PathPing command out on my computer and I'm please that it works just fine. I visited the links and it appears that PathPing can do what Ping does, but better (although it takes a bit longer). Would it make a difference if I forgot about Ping and use PathPing instead?Quote from: H2O on July 13, 2011, 08:46:44 PM Thank you once again Salmon. I appreciate your zeal in this forum. I just tried the PathPing command out on my computer and I'm please that it works just fine. I visited the links and it appears that PathPing can do what Ping does, but better (although it takes a bit longer). Would it make a difference if I forgot about Ping and use PathPing instead? I suggest you try both and SEE which one suits you best. |
|
| 8895. |
Solve : Why do we still use DOS today?? |
|
Answer» why do we still need DOS today?I boot into pure DOS to run PARTITION Magic 8 to set up all my hard drives. I find I get BETTER control over the drive without Windows around.Quote from: ymaldonado on June 27, 2011, 06:05:32 PM why do we still need DOS today?Who are "we" in this case. Many who use DOS will never come here hand tell you why.The just use it in their work and it never occurs to them that they should change it. To illustrate the point, consider vehicles. Autos the travel on highways must meet safety rules. Rules can change. But vehicles that do service off of any highway do not have to comply with new highway rules. Many business users continue to run their accounting software on a DOS based system. The use it the same way, DAY after day. They make backups. They make print outs. They post invoices. The system is a part of their business operation. They never get on the internet. They never let anybody PUT anything on the business computer. There are some very powerful implication programs the still run on DOS based SYSTEMS. As long as the stay away from the public internet, they will continue to benefit from those old systems until the wear out. And if they ever need replacement parts, they will pay extra just to get a 486 motherboard that fits the old case and runs they old software. No joke. |
|
| 8896. |
Solve : Trouble with Incrementing a Variable? |
|
Answer» I am attempting to WRITE a program that will ping a list of machines on our network and INCREMENT a variable based on whether or not a reply is received. The program reads the IP's from a host file and should ping each machine X amount of times. Then the variables for successes and failures will be compared (this part isn't written yet) and run some commands. However, I can not seem to get the counterOK and counterFailed variables to increment. I have been working on this for two days and I think I just need another set of eyes to point me in the right direction. This is the what I have so far. Humm. The batch command Yes, we know! Your point is? It's not just Windows - the OP's code is clearly Windows NT family batch scripting language. PC-DOS 7 has Rexx. Better to pipe the output of Ping into FIND and look for the text "TTL", because "Reply from" in the output of PING does not always indicate a positive response. You may receive a message from a router such as: Reply from 192.168.1.254: Destination Net Unreachable. Also no need for log.txt. Code: [Select]setlocal enabledelayedexpansion REM create a loop to go through the ip addresses in the host file for /f %%z in (%hostfile%) do ( set counterOK=0 set counterFailed=0 rem create a loop to ping each machine 10 times for /l %%i in (1, 1, %NrOfPings%) do ( echo this is attempt %%i for IP %%z ping -n 1 %%z | find "TTL=" > nul IF !errorlevel! equ 0 ( set /a counterOK+=1 ) else ( set /a counterFailed+=1 ) echo good:!counterOK! bad:!counterFailed! echo. PAUSE ECHO. ) )I made the changes suggested in the replies but the variables still refuse to increment. I should have mentioned this in the beginning but this batch file will be running in a Windows 7/Server 2008 environment. Here is what I have changed the code to @echo off setlocal enabledelayedexpansion title Network Monitor REM set variables for batch file set NrOfPings=3 set counterOK=0 set counterFailed=0 set dPath=c:\users\%username%\desktop\monitor\ set hostfile=%dPath%myhosts.txt REM create a loop to go through the ip addresses in the host file for /f %%z in (%hostfile%) do ( set counterOK=0 set counterFailed=0 rem create a loop to ping each machine 10 times for /l %%i in (1, 1, %NrOfPings%) do ( echo this is attempt %%i for IP %%z ping -n 1 %%z | find "TTL" > nul IF !ERRORLEVEL! equ 0 ( set /a counterOK+=1 ) else ( set /a counterFailed+=1 ) echo good:%counterOK% bad:%counterFailed% echo. PAUSE ECHO. ) ) pause exit Code: [Select]echo good:%counterOK% bad:%counterFailed% I told you already you need to use exclamation marks, not percent signs, with delayed expansion in loops. sorry I missed that line. It works now! Thanks!!Quote from: Salmon Trout on June 22, 2011, 03:43:43 PM Yes, we know! Your point is? Sorry Salmon. I don't see where in the OP posting he says he's using Windows: "..I am attempting to write a program that will ping a list of machines on our network and increment a variable based on whether or not a reply is received. The program reads the IP's from a host file and should ping each machine X amount of times. Then the variables for successes and failures will be compared (this part isn't written yet) and run some commands. However, I can not seem to get the counterOK and counterFailed variables to increment. I have been working on this for two days and I think I just need another set of eyes to point me in the right direction. This is the what I have so far." I guess since I'm a DOS guy I didn't consider Windows batch code. My main DOS is PC DOS 7 and I do use REXX on occasion but I never assume every DOS user has REXX available to them. Glad he's sorted it out. Quote from: aoresteen on June 27, 2011, 08:42:27 PM Sorry Salmon. I don't see where in the OP posting he says he's using Windows: In his code the use of for /f and for /l (absent in MS-DOS and Win 9x) confirm that he is writing for cmd.exe, the NT family command interpreter. In his revised code, the second line, where he invokes delayed variable expansion, identifies the environment as a Windows 2000 or later version of cmd.exe. |
|
| 8897. |
Solve : xml file rename problem? |
|
Answer» I have to rename a image file based on an xml file. Here is the xml. Posts removed. Never mind... it enlivened the thread a bit... The script I posted above will correctly process the xml file posted by the OP to isolate the TIF filename. It then proceeds to rename the TIF, and delete the xml file, which, as the OP says... Quote are in the same folder. I have tested this with an actual TIF from my scanned images folder. It works. It would work with any arbitrarily named file. Since a certain troll INSISTS on polluting this thread, I am disabling notification of replies to avoid recurrent annoyance from this character. This might be a BAD time to point out that I don't like your poetry.Quote from: BC_Programmer on June 27, 2011, 12:46:22 PM This might be a bad time to point out that I don't like your poetry. Did you mean me? Or the idiot? Quote from: Salmon Trout on June 27, 2011, 01:10:31 PM Did you mean me? Or the idiot?The latter of course. You mean you haven't read my poetry? I'll go out on a limb here and guess bill ain't real good at poetry...A good idea to lock this thread? done |
|
| 8898. |
Solve : How to enlarge the window "code included"? |
|
Answer» I have been messing around with the code bellow. How can you enlarge the WINDOW wihout draging with the mouse. I would like to set the size of the window within the code. How do i do it. @echo off @color 0a title Buddy Box :a cls echo ========================= echo Windows 7 64BIT BuddyBox echo ========================= echo. echo 1) Mozilla Firefox echo 2) Internet Explorer echo 3) Windows Media Player echo 4) Notepad echo 5) Regedit echo 6) Calculator echo 7) Wordpad echo 8) Command Prompt echo 9) Charactor Map echo 10) On-Screen Keyboard echo 11) Disk Cleanup echo 12) Command Prompt echo 13) Computer Management echo 14) Control Panel echo 15) Component Services echo 16) Disk Defragmenter echo 17) DirectX Diagnostic Tool echo 18) Privatee Character Editor echo 19) Event Viewer echo 20) Volume Mixer echo 21) Snipping Tool echo 22) Sound Recorder echo 23) Sticky Notes echo 24) Create Restore Point echo 25) Windows Task Manager echo 26) User Account Control Settings echo. set /p op=Choose which application to open: if %op%==1 goto 1 if %op%==2 goto 2 if %op%==3 goto 310 if %op%==4 goto 4 if %op%==5 goto 5 if %op%==6 goto 6 if %op%==7 goto 7 if %op%==8 goto 8 if %op%==9 goto 9 if %op%==10 goto 10 if %op%==11 goto 11 if %op%==12 goto 12 if %op%==13 goto 13 if %op%==14 goto 14 if %op%==15 goto 15 if %op%==16 goto 16 if %op%==17 goto 17 if %op%==18 goto 18 if %op%==19 goto 19 if %op%==20 goto 20 if %op%==21 goto 21 if %op%==22 goto 22 if %op%==23 goto 23 if %op%==24 goto 24 if %op%==25 goto 25 if %op%==26 goto 26 :1 start firefox.exe goto a :2 start iexplore.exe goto a :3 start wmplayer.exe goto a :4 start notepad.exe goto a :5 start regedit.exe goto a :6 start calc.exe goto a :7 start Wordpad.exe goto a :8 start cmd.exe goto a :9 start charmap.exe goto a :10 start osk.exe goto a :11 start cleanmgr.exe goto a :12 start cmd.exe goto a :13 start CompMgmtLauncher.exe goto a :14 start control.exe goto a :15 start dcomcnfg.exe goto a :16 start dfrgui.exe goto a :17 start dxdiag.exe goto a :18 start eudcedit.exe goto a :19 start eventvwr.exe goto a :20 start SndVol.exe goto a :21 start SnippingTool.exe goto a :22 start SoundRecorder.exe goto a :23 start StikyNot.exe goto a :24 start SystemPropertiesProtection.exe goto a :25 start taskmgr.exe goto a :26 start UserAccountControlSettings.exe goto aUse the mode command after the @echo off statement: MODE CON[:] [COLS=c] [LINES=n] Good luck. This is what i used. MODE CON:cols=50 lines=32 Thank you Much appreciated Ya know?..... I had never DONE that before, but I just tried it and it works great, but..... I had to use much higher numbers, due to the resolution of my screen. 150 and 65 worked great for me. Thanks for that helpful tip. This day has not been wasted! Now I'm going to the movies. Nice tip. thanx |
|
| 8899. |
Solve : creating batch file to start up programs after one another, not at the same time? |
|
Answer» Sorry I tried searching the forum and goggling this, but can't seem to get anything to work. But I am now trying to make it where one program starts after the one before it is finished. Quote /wait starts up the first program and won't start the rest of the programs unless I close the one before it. According to the first quote above, this is what you want, isn't it? Quote from: Salmon Trout on July 08, 2011, 01:02:14 PM According to the first quote above, this is what you want, isn't it? no I want program 1 to startup ... then once it has finished loading, I want to keep that program open and then program 2 starts up, and so on. I want all programs to be open, but in a sequence. is that possible?Use start "" "program 1.exe" PING 127.0.0.1 -n X >nul start "" "program 2.exe" PING 127.0.0.1 -n X >nul start "" "program 3.exe" PING 127.0.0.1 -n X >nul [etc] Replace X with a number, which is 1 more than the number of seconds delay you require, e.g. for 10 seconds delay replace X with 11. Quote from: Salmon Trout on July 08, 2011, 01:25:43 PM Use -AH! Thank you very much!! That worked! What does all that mean if you don't mind explaining? I wonder why I have to use PING for XP but Win7 reads it fine with timeout #? very confusing for me :p Much appreciated!Quote from: sehana on July 08, 2011, 01:30:46 PM What does all that mean if you don't mind explaining? When you use start like this ("title" can just be 2 quotes "" but cannot be left out) start "title" "program.exe" then the script starts program.exe and then returns at once, leaving program.exe running. So now you want to wait for a period of time before starting the next program. Ping can provide that delay and works with all versions of Windows. 127.0.0.1 is the IP address of the same computer that the script is running on. Its name is localhost. The ping command can take a parameter -n followed by a number which is the number of times to ping. The standard ping interval is 1 second. So ping -n 11 sends the first request and it gets a reply immediately, waits one second, sends the next request, gets an immediate reply, and so on – for the ten requests after the first. So to localhost those 11 times takes exactly 10 seconds. We redirect the output to nul so we don't see the ping command or its output on the screen. Quote I wonder why I have to use PING for XP but Win7 reads it fine with timeout #? The reason why you cannot use timeout with XP is that the timeout.exe program was not included with XP. It was first introduced in Vista. Thank You!! I understand it much better now I was wondering what the ping was for and didn't understand it, but now I understand, thank you Quote from: sehana on July 08, 2011, 02:36:11 PM I was wondering what the ping was for and didn't understand it, but now I understand, thank you http://en.wikipedia.org/wiki/Ping Reading the OP's request I'm wondering why nobody has given the answer yet. I've been doing the same thing in batch files for somewhere around 30 years, or so. This would be my SOLUTION: @Echo off cls call program1 call program2 call program3 Rem this batch file will close after program3 runs. The rule for the "Call" command is that it will maintain the entire batch file in memory till the last program being called closes. No line can execute till the previous line has completed. Without the call command, the batch file would close when the first program runs and the subsequent programs would never run at all. I do hope this helps. PS: Or more specifically...... @Echo off cls Call "C:\Program Files\GIMP-2.0\bin\gimp-2.6.exe" Call "C:\Program Files\iTunes\iTunes.exe" Call "C:\Program Files\Corel\Corel Paint Shop Pro Photo XI\Corel Paint Shop Pro Photo.exe" Call "C:\Program Files\CoreFTP\coreftp.exe" Quote from: TheShadow on July 09, 2011, 08:42:02 AM Reading the OP's request I'm wondering why nobody has given the answer yet. You APPEAR to be answering a question other than the one the OP asked. If you read the whole thread, you will see that he (or she) wishes to start a program, wait a short while, then start a second program, then wait a short while, then start a third program, and so on. He does not wish to run the programs in sequence, closing one before running the next. Quote Without the call command, the batch file would close when the first program runs and the subsequent programs would never run at all. This only applies to other batch files. You can start an executable program and depending on the syntax used for the start command, control will return to the batch script either at once or when the program has terminated. |
|
| 8900. |
Solve : Rename multiple folders using Dos commands? |
|
Answer» Hi There, (special character)(file type:png/bmp)(special character)[size](special character)(file type:png/bmp)(special character) Depending on the language, special characters need to be escaped, or not, depending on their usage. You're creating unneeded problems. Pattern matching and replacements can be accomplished by using regular expressions (RegEx). The RegEx engine in batch is next to useless, but VBScript, Powershell, Python, and Perl along with many UNIX utilities can handle most tasks. Is that a possibilty? The easiest solution of course would be to tell your vendors what format to supply their content in. Let use know. Hi, Thanks for the advice..i won't be WORRYING any of us..will go with the brute force as you mentioned..its easy..and more over..i am new to programming and interested to write scripts..so i wish to try.. anyways will stay connected to learn. Regards, Sravan Hello, I am also in the similar situation, trying to rename folders. I just need to get rid of "_den" suffix from folders' name. For e.g. I want to rename "Warde_den" to "Warde"; "Divide_NW_den" to "Divide_NW"; "Tripoli_NW_SE_den" to "Tripoli_NW_SE" etc... Should be easy..but I am new to programming and need help. Plz help.. Nav |
|