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.
| 1051. |
Solve : Having issues with "CHOICE" command?!? |
|
Answer» Hi guys, if ERRORLEVEL == 1 goto Start There are 2 alternative errorlevel formats you can use: (a) Old MS_DOS IF ERRORLEVEL syntax, levels in descending order if ERRORLEVEL 2 goto Start if ERRORLEVEL 1 goto Options (b) Later NT command language format, levels in any order if %ERRORLEVEL%==2 goto Start if %ERRORLEVEL%==1 goto Options Salmon Trout is right. A descending order needed. Says descending order right in the help file. Quote from: Squashman on July 13, 2015, 09:31:47 PM Says descending order right in the help file.Thank you.Some clarification... this must be about the 10th time I have written this... The old (true) MS-DOS legacy way of checking for errorlevels was LIKE this If errorlevel X do_command This meant "if the errorlevel is equal to or greater than X, do_command". Do_command was USUALLY goto a label. This meant that if you wanted to check for more than one expected errorlevel you had to do stuff like this some_command if errorlevel 5 goto egg if errorlevel 4 goto bacon if errorlevel 3 goto cheese echo Errorlevel was 0, 1 or 2! goto end :egg echo Errorlevel was 5 or more! goto end :bacon echo Errorlevel was exactly 4! goto end :cheese echo Errorlevel was exactly 3! :end echo Finished... The errorlevel in MS-DOS and Windows before NT was held in a byte and hence could be from 0 to 255. In true MS-DOS, if you wanted to actually find out what errorlevel a program or command returned, you had to do something like this... some_command if errorlevel 255 echo 255 if errorlevel 254 echo 254 if errorlevel 253 echo 253 ... (snipped 251 lines) if errorlevel 1 echo 1 if errorlevel 0 echo 0 256 lines just to get the errorlevel. All this was very cumbersome, and in Windows NT a pseudo environment variable %errorlevel% was added, which you could test in one line e.g.: echo %errorlevel% Also you can use all the compare-ops like EQU NEQ LSS LEQ GTR GEQ. Probably as well to remember that NT errorlevels are held in a 32 signed integer and can be anywhere from -2147483648 to +2147483647 (that's right, you can have errorlevels below zero as well as above, so the old IF ERRORLEVEL might not always do what you expect.) Further reading: http://blogs.msdn.com/b/oldnewthing/archive/2008/09/26/8965755.aspx http://steve-jansen.github.io/guides/windows-batch-scripting/part-3-return-codes.html (I like Steve Jansen's tip about using powers of 2 for your own return codes, so you can use bitwise OR and test for multiple errors at once.) http://www.robvanderwoude.com/errorlevel.php |
|
| 1052. |
Solve : Batches as Functions? |
|
Answer» I thout about seperating code between files and use them as functions. |
|
| 1053. |
Solve : video files merge with ffmpeg batch ?? |
|
Answer» i have video files on diffrent format (wmv, mp4, mpg, flv) and parted files thx, you wanna help me but, The problem with my code is that your information was both wrong and lacking details. Even in your screen shot there are no extensions. You should have tried my CHANGED code... |
|
| 1054. |
Solve : run batch file every 3 weeks? |
|
Answer» I want to run a batch file every three weeks to do some cleaning on my computer. |
|
| 1055. |
Solve : Debian and Dos? |
|
Answer» For my school project we have been asked to talk about the similarities between Linux and Windows, and to relate some of the tasks we have done in school with Windows (both GUI and CL). Does anyone know anything that you can do on either Windows (GUI and CL) and on Debian CL? Also, are there any advantages for either one over the other, such as ease-of-use, or more complex things such as its being easier to create NEW users and assign them to groups? |
|
| 1056. |
Solve : If motherboard on DOS computer dies, can I caddy from another?? |
|
Answer» Hi The ROV has a direct comms link using RS232 on a serial port to this AWS unit which gives us feedback on the screen in its DOS program when it goes over something metallic. It is also useful to know that Dos comms software is traditionally configured to access a definite com port - and it must be using the same port address and IRQ that the original HARDWARE is set up with, or reconfigured with the port/IRQ on the replacement machine. What happens when you boot the machine you have? Is there a screen that displays text? Or does it beep in a sequence of short or long beeps? Where are the four red lights? It's possible that the machine's CMOS battery has passed away and the BIOS settings need to be reconfigured. At least that is a common fault, and your machine is obviously many years old - was the battery changed?Hey, thanks for the replies. FIRSTLY, is there any chance you could quickly bullet point how to install this HDD as a primary HDD on a normal computer? In answer to the other questions. Originally the computer booted fine, tested and worked great. Next time i went to turn it on I got an error message after the memory test saying 'Verifying DMI Pool Data' then 'Insert system disk and press any key'. Finally, after removing all the connectors and CLEANING them down thinking it could be communication to the HDD, I now boot and nothing on screen but instead 4 red lights which are right on the back of the motherboard in the top right hand corner. The beep code is one 1 second beep, every 3 seconds or so. I can't actually work out what the red lights are indicated. They just stay on constant and there is nothing on the motherboard i can see (from an awkward angle) to describe what they are. Could this be as simple as the CMOS? The HDD was replaced before it was donated to us but doubt a CMOS would be... but I should still get something on screen surely? Quote from: RPMNautical on July 26, 2015, 03:44:20 PM turn it on I got an error message after the memory test saying 'Verifying DMI Pool Data' then 'Insert system disk and press any key' That looks like a CMOS battery problem with the BIOS settings at default and it just doesn't know which boot device to use - and in some very old machines you needed to enter the cylinders/heads/sector values in the hard drive settings in the BIOS. Quote The beep code is one 1 second beep, every 3 seconds or so. But that one seems like a RAM error, if the BIOS is AMI. The first test to try and solve the RAM error is to remove and reseat the ram modules, as the connections may be a bit tarnished. Code: [Select] | 18. What do the AMI BIOS Beep codes mean ? | +--------------------------------------------+ Except for beep code #8, these codes are always fatal. 1 beep Refresh failure 2 beeps Parity error 3 beeps Base 64K memory failure 4 beeps Timer not operational 5 beeps Processor error 6 beeps 8042 - gate A20 failure 7 beeps Processor exception interrupt error 8 beeps Display memory read/write failure 9 beeps ROM checksum error 10 beeps CMOS SHUTDOWN register read/write error 11 beeps Cache memory bad If the machine then boots and the first error is back, replace the battery. It is still fails, then you can look at replacing the RAM module if you can find an old one. Having said that - you may be able to use any machine with a COM port and only transplant the actual software directory, inside of which may be a configuration file where the com port address and IRQ number can be changed to match the settings in the new machine. When booting the new machine and entering the BIOS you will see the com port settings with address and IRQ, and can even change them to match what is already in the config file. It's possible that the program will run under Windows. This assumes a few things - if you want better advice and you can zip up and post a link to the software folder then it may be clearer what steps to take. |
|
| 1057. |
Solve : FTP connection? |
|
Answer» Hi all, The files are retrieved with ws-ftp from Jan, I can't log in with those credentials. The connection fails.Hi foxidrive as in the screen print attached from ws-ftp>> gov.jpg you should GET gov-2.jpg default ftp - passive mode with anonymous the password is any e-mail account name (and of course without quotes...;-) [attachment deleted by admin to conserve space]1) So are you saying you want to add an FTP option to your existing batch file? 2) Why are you using a FOR command to rename all the files. Just use the rename command by itself!Answer-1:Yes Answer-2: each file name must have a reference with an UTC hour; these files are refreshed every hour on the server %time% generates single or double digit if it can be done simpler, let me know please. Thanks for your advice JanAnswer 2 does not make any sense to me.These two lines of code and the 22 before it make ABSOLUTELY no logical sense. Code: [Select]FOR %%f IN (23Z.TXT) do rename 23Z.txt 23.txt FOR %%f IN (metar.txt) do del /q c:\fsd\metar.txtYou do not need to use the FOR command to RENAME or DELETE these files! Quote from: klm149 on July 27, 2015, 10:51:29 AM Hi foxidrive It seems to have been a security software on my computer. Quote from: klm149 on July 27, 2015, 02:46:22 PM %time% generates single or double digit yes, you can generate time figures without the leading space. Use this and then reference the %t% variable instead of %time% Code: [Select]set t=%time: =0% Quote from: klm149 on July 27, 2015, 08:12:45 AM I wrote a batch for extracting the correct weather file from a weather server (see attached autometar.bat) Can you explain which weather file you need? Is it just the file from the current hour?the weather file from the current UTC hour e.g. 06Z.TXT is used and copied as metar.txt Windows FTP client can't be used on this server. I've investigated and Windows FTP.EXE can put the server into passive mode, which the tgftp.nws.noaa.gov server requires, but the FTP client itself doesn't work in passive mode (PASV). The FTP.EXE also has trouble with the PORT command, from what I have read. This script shows it connecting and the PASV command implemented, but the permission denied error when attempting to download the file is because the FTP.EXE is not also in passive mode. Code: [Select]echo off set "ftpHost=tgftp.nws.noaa.gov" set "ftpUser=anonymous" set "[email protected]" set "ftpRemoteDir=/data/observations/metar/cycles/" set "ftpLocalDir=%cd%" set t=%time: =0% set t=%t:~0,2% ( echo open %ftpHost% echo %ftpUser% echo %ftpPwd% echo quote pasv echo get %t%Z.TXT echo bye )>"%ftpLocalDir%\temp.ftp" ftp.exe -i -s:"%ftpLocalDir%\temp.ftp" del "%ftpLocalDir%\temp.ftp" pause Thank You! Do you know how to capture 227 Entering Passive Mode (205,156,51,233,128,29) (h1,h2,h3,h3,P1,p2) After setting the remote site to PASV mode the client should give a handshake, returning a port to access. When you add echo type ascii after quote pasv it will return with a port H1./.h4 (is the IPaddress of the server) p1, p2 p1*256+p2 gives the port number to listen on the client hence permission denied when RETR nnZ.txt 227 Entering Passive Mode (205,156,51,233,237,13 ftp> type ascii ---> TYPE A 200 Switching to ASCII mode. ftp> get 16Z.TXT ---> PORT 192,168,1,15,14,219 550 Permission denied. ---> RETR 16Z.TXT 550 Failed to open file. ftp> bye ---> QUIT 221 Goodbye. So far so good Quote from: klm149 on July 28, 2015, 11:05:55 AM hence permission denied when RETR nnZ.txt Did you follow my previous post? FTP.EXE can't use PASV mode and this is causing the error.I think this is the show stopper...thanks for your efforts Jan |
|
| 1058. |
Solve : batch file for copy folder? |
|
Answer» Hello |
|
| 1059. |
Solve : How to Find the File that is Causing the XCOPY Error? |
|
Answer» I use the xcopy command in a DOS batch file to backup my personal files and it works fine. However, when XCOPY encounters an error, the error message is displayed, but the offending filename is not. Only files that are successfully copied are displayed (to the screen or logfile) How do I pinpoint the file that is CAUSING the error? Sometimes it's a long path name and the error is "Insufficient memory", but I still have no way of FINDING the offending file. Other times, the error might be "File creation error - The file cannot be accessed by the system". Same problem, I do not know the filename that is causing the error. The error message itself is not what I need help with. It's pinpointing the file that is causing the error, whatever that error might be. I need a way to display the filename BEFORE the copy is attempted. Thank you. Show the code that you use. It will have to be modified The error message itself is not what I need help with. It's pinpointing the file that is causing the error, whatever that error might be. I need a way to display the filename BEFORE the copy is attempted. Thank you. This switch will give you a log if that is what you want. /F Displays full source and destination file names while copying. |
|
| 1060. |
Solve : DOS Command to Move Image Files to another Folder ?? |
|
Answer» I have numerous image files (JPG/PNG format) stored in a folder. I would like to filter out (move to another folder) images that does NOT contain any of the following TEXT : Sorry about, i am desperate to get an answer pretty soon. Homework due in today ? ? Quote from: foxidrive on August 11, 2015, 08:09:19 AM Untested: Thanks - what part of the code addresses the SOURCE location of the images ? And - what is the syntax path for "Another folder" ? Eg: C:\Temp\Folder\ ?? Quote from: patio on August 11, 2015, 08:13:57 AM Homework due in today ? ? Actually, it's a e-Comm Project i'm working on. If your images are in C:\images, you just put the BATCH file into that folder and execute it. It will create a sub folder called "C:\images\Another Folder" and put all the images in there. Change as needed. Quote from: Squashman on August 11, 2015, 09:03:10 AM If your images are in C:\images, you just put the batch file into that folder and execute it. OK - I put the images in a folder called 'image' & placed the folder on c:/ drive. I then opened c prompt & typed the command. Getting error: Access is denied ?! Am I doin' something wrong ?Squashman - what exactly do you mean by <>? How is different is it from typing out the command from MSDOS prompt ?You can execute a batch file one of two ways. 1) Double click on it with your mouse. 2) Open up a cmd prompt and navigate to the folder with the batch file and type the batch file name and hit enter. If you are getting errors when executing the batch file then copy and paste everything from the cmd window into a post here.Thanks - working !! Squashman - thanks for being patient. |
|
| 1061. |
Solve : Error execution batch file from 16-bit aplication on Windows 32-bit? |
|
Answer» I have installation files creation in NullSoft system 2.46. I have installation files creation in NullSoft system 2.46. [attachment deleted by admin to conserve space] Quote from: foxidrive on July 28, 2015, 01:14:25 AM What is the actual question that you have, and would like an answer for?Question - why when you start the installation of 16-bit applications running on Windows 32-bit installation does not correctly. Quote from: trikolka on July 28, 2015, 01:31:06 AM Question - why when you start the installation of 16-bit applications running on Windows 32-bit installation does not correctly. To repeat the problem, you have a 16 bit application and it is not installing properly on a 32 bit version of windows. What happens that is wrong when you install it in a 32 bit Windows? You SAID that there is a prompt on the screen - is a batch file running and the batch file is not doing the right thing? Or is the problem in the NullSoft script? In your screenshot you are showing Dosbox, and I don't see how that ties in with the question.1) When the update * .EXE running on 32-bit Windows, from Windows 64-bit or 16-bit application under DOSBox is working quite correctly. (When you start a Windows 64-bit, you start a 16-bit installer under DOSBox) 2) When the update * .EXE running on the same 16-bit applications under Windows 32-bit, will be a correct unpack the attached file is executed correctly generated * .BAT file, but instead run the 16-bit update program (UFAND.EXE) batch issues souvor message "type 'exit' to return to Fand". 3) NullSoft script is included because it includes creating batch files to run under DOSBox or outside of DOSBox. 4) Picture illustrates that the choice of 16-bit applications update file is called and executed. Is the same if 16-bit applications running under DOSBox or under Ntvdm Windows 32-bit. 1) When the update * .EXE running on 32-bit Windows, from Windows 64-bit or 16-bit application under DOSBox is working quite correctly. (When you start a Windows 64-bit, you start a 16-bit installer under DOSBox) 2) When the update * .EXE running on the same 16-bit applications under Windows 32-bit, will be a correct unpack the attached file is executed correctly generated * .BAT file, but instead run the 16-bit update program (UFAND.EXE) batch issues souvor message "type 'exit' to return to Fand". 3) NullSoft script is included because it includes creating batch files to run under DOSBox or outside of DOSBox. 4) Picture illustrates that the choice of 16-bit applications update file is called and executed. Is the same if 16-bit applications running under DOSBox or under Ntvdm Windows 32-bit. 5) If you want to test the behavior of the program is: a) the need to install software from u15_cd.exe www.ucto2000.cz/download.htm (as a demo without requiring a license). b) install the program from an external MODULE www.zetrozet.com/index.php?load=downtbl&modul=ucto15 example KURZY32.EXE (license data must be filled, you can enter any nonsense). c) then you can try the difference behavior when updating an external module running KURZY32.EXE of Windows 32-bit or by calling the open program option according to the previously inserted picture. d) If the program runs with U64.BAT place U.BAT, will be in 32-bit Windows running under DOSBox. In this case, the updated external module is updated correctly. (The program is designed to tax records according to Czech law, because it is only in Czech.) Quote from: trikolka on July 28, 2015, 06:46:14 AM 2) When the update * .EXE running on the same 16-bit applications under Windows 32-bit, will be a correct unpack the attached file is executed correctly generated * .BAT file, but instead run the 16-bit update program (UFAND.EXE) batch issues souvor message "type 'exit' to return to Fand". I understand that your mother tongue is not English, but you have included several things that confuse the question.
2) batch file for Windows 32-bit attach, it generates an installer according to user-selected directory. Because of the search for the cause was tried, the error manifests itself in exactly the same way, even if the row triggering UFAND.EXE not specify parameter. The procedure of generating the batch file is written line by line in the previously attached NullSoft script. Code: [Select]mode con: cols=80 lines=25 set fandovrb=80 set fandwork=D:\OVER2015\ set fandcfg=D:\OVER2015\ set fandres=D:\OVER2015\ cd D:\ cd OVER2015 D:\OVER2015\UFAND.EXE D:\OVER2015\INST_ZET.RDB set fandovrb= set fandwork= set fandcfg= set fandres= 3) Users installer sets accounting program run under DOSBox only in 64-bit Windows. Use DOSBox in Windows 32-bit installer program does not adjust. I myself run a program under DOSBox used solely for the purpose of testing the conditions under which the error occurs. I apologize for the English, I learned it only half a year in 1968, so now I use different compiler.This will solve a problem when the target folder contains a space or an & character etc and simplifies it a little but if you are using non-latin characters then that can be an issue as the codepage may need to be changed. It assumes that UFAND.EXE is capable of using long filenames Code: [Select]mode con: cols=80 lines=25 set "fandovrb=80" set "folder=D:\OVER2015\" for %%a in (fandwork fandcfg fandres) do set "%%a=%folder%" cd /d "%folder%" UFAND.EXE "%folder%\INST_ZET.RDB" for %%a in (fandwork fandcfg fandres fandovrb) do set "%%a=" Your problem can be in the Nullsoft script, which is not short and simple and I'm not familiar with the scripting language so somebody else may check that for you, Or it could be in the UFAND.EXE program and it fails in some way, when used in the way you are using it. and your use of Dosbox is complicating this - as the exact environment this is task is being run in is not clear. Quote 1) When the update * .EXE running on 32-bit Windows, from Windows 64-bit or 16-bit application under DOSBox is working quite correctly. (When you start a Windows 64-bit, you start a 16-bit installer under DOSBox)I do not think the above e is w an accurate statement, nor does it represent areal problem in the real world. It is not just my opinion, but the advice if many others that 16 bit program should not run on a MODERN computer if it can be avoided. Commercial and Industrial users who depend on 16 bit programs buy older equipment and maintain it for use on their in-house projects. This is more cost-effective. To illustrate. An experienced tech can assembly a legacy computer for old or surplus materials inside of a week. But a good programmer could spend weeks trying to GET an legacy 16 bit program to work a modern computer. legacy computers: http://www.makeuseof.com/tag/3-online-sources-finding-buying-computer-parts/ 1) I can not pick and choose which computer users will run the accounting program, the ten million Czech Republic it is still used by tens of thousands of accounts. I just am creating this program, additional modules and the authors of that accounting software to interact leave. 2) The attached NullSoft script contains the installation in Windows 32-bit control directories and convert them to DOS-names. 3) When searching for the cause of the error has been tested as a batch file, which contained the single word "UFAND". The result was the same - when starting from the choice of accounting software in Windows 32-bit error, when other methods of lowering correct commissioning.There is a massive language barrier that I doubt will be particularly easy to permeate here.Your proposed text batch file was successful. [attachment deleted by admin to conserve space]If choosing the 16-bit program, download the installer from the web-site and choosing the 16-bit program, then run crashes shown attached picture. If the setup option in 16-bit only download a program, but run from explorer or Totalcommnder held the entire installation correctly. The batch file generated NullSoft script in both cases is absolutely identical. NullSoft script checks the 16-bit program and batch file starts to generate up if the program is ended. |
|
| 1062. |
Solve : Program? |
|
Answer» Dear all, |
|
| 1063. |
Solve : I need to call a success or fail after a program finishes installing? |
|
Answer» is it possible to call a success or fail after installing a program from the .bat file? Here is a sample of what I have so far: |
|
| 1064. |
Solve : BAT file to open remote folders? |
|
Answer» Hey all |
|
| 1065. |
Solve : orginizing my swf files? |
|
Answer» i want to unzip my swf files in the root and then move them into there own directory in games folder. there is over 1000 of them its TAKING to long to do this manually on my lan. i would like to USE a .bat to do this. its been a while that i have tried doing my own batch files. |
|
| 1066. |
Solve : "Setup" not listed in help command?? |
|
Answer» There appears to be a command, or .exe file, called "setup." It works when I type "setup" in MS-DOS (6.22), but when I type in "help," I don't SEE it listed there. Does anyone have any idea why it's not listed? Or am I LOOKING in the wrong spot? I just don't understand why it wouldn't be listed...It's not listed because it is not PART of MS-DOS. |
|
| 1067. |
Solve : Windows 1.04 freezing and not working? |
|
Answer» When I try and press enter on something, it won't work. After I move the arrow keys around and try a couple more times it freezes. How do I fix this? I'm USING VMWare Fusion 7 and MS-DOS 6.22.Have you checked into this info here?: https://communities.vmware.com/thread/93983?tstart=0 Quote from: DaveLembke on July 21, 2016, 08:05:32 AM Have you checked into this info here?: https://communities.vmware.com/thread/93983?tstart=0Thank you very much! For anyone else having this problem, it was MS-DOS 6.22. MS-DOS 5.0 works fine. I don't know why... Maybe 6.22 is incompatible with 1.0? Quote from: Jacob42 on July 21, 2016, 01:03:53 PM Thank you very much!Isn't that what that thread was basically saying. Windows 1 was originally created to run on top of MS-DOS 2. Quote from: Squashman on July 21, 2016, 01:17:39 PM Isn't that what that thread was basically saying. Windows 1 was originally created to run on top of MS-DOS 2. Yeah, I'm a little amused that you're using MSDOS of a far later period to run Windows of that vintage. I haven't TRIED it myself mind you, but I would have expected EVEN MSDOS 5 to break many aspects of Win 1 |
|
| 1068. |
Solve : gwbasic writing to a file in a different directory.? |
|
Answer» i am re using one of my old gwbasic files but it save/writes to the wrong directory/folder i am re using one of my old gwbasic files but it save/writes to the wrong directory/folder The line above is a file your BASIC program is reading from, not saving to. Right click and open the properties of your shortcut. Look for a box with the name "Start in:" Type the path you want your file saved to in that box. Save and test that. Don't make any typing errors. That may or may not work - it depends on the script and aspects of your computer.i cant quote the actual line e.g. opening or writing as i am on a windows 10 computer at present away from home and cant replicate the line. the file is on this computer but windows says cant read due to this being 64 bit. will try your solution when i get home. thanksin further explanation. My gwbasic comes up on a shortcut. i then run the gwbasic file it then saves to a txt file. but i want the txt file to save in a different directory. assume. fred to be the current directory i want it to save to c:\harry how do i tell it in the open file line. Quote assume. fred to be the current directory i want it to save to c:\harry how do i tell it in the open file line. Enter the full path. Code: [SELECT]OPEN "C:\harry\file.txt" FOR OUTPUT AS #1 |
|
| 1069. |
Solve : split 1 folder with 160.000 files in 8 different folders with 20.000 files per f? |
|
Answer» currently i have the specific files (160.000) in 1 folder which is named ''PL'' |
|
| 1070. |
Solve : Marking folders for encryption services in DOS? |
|
Answer» I can create a new folder in DOS with the following command: |
|
| 1071. |
Solve : Extract contents from a string? |
|
Answer» I have a variable string that looks like the following: |
|
| 1072. |
Solve : Copying specific files across the network? |
|
Answer» Dear All, You called your batch file xcopy.batIf I had a dollar for every time someone named their batch file the same as a command in their batch file, I would be a little bit wealthier. Maybe middle class instead of lower middle class. Quote from: Squashman on September 14, 2016, 12:38:10 PM If I had a dollar for every time someone named their batch file the same as a command in their batch file, I would be a little bit wealthier. Maybe middle class instead of lower middle class. That's the way to riches! I should charge people for the advice. A PROBLEM that many of those people will not follow is when the batch file is called using a full path and not in the current directory. It will work then and they will think "Gee, that guy doesn't know the FIRST thing about batch files". |
|
| 1073. |
Solve : rename "%%~nG.xml" "%%~nG.ts" doesn't work? |
|
Answer» I want to change the FILENAME of all files in a folder where no TS file exist into XML file |
|
| 1074. |
Solve : On Screen Qwerty Keyboard for MS-DOS? |
|
Answer» Hi, |
|
| 1075. |
Solve : Extract specific filename from a text file into a new text file? |
|
Answer» Hi all, Code: [Select]echo off It's always easy to fiddle with code that's already written. This is a little bit of a hack, given the characteristics of the text. Code: [Select]echo off ( FOR /F "tokens=1,*" %%G IN ('find /I "received pdf" ^<abc.txt') DO ( FOR /F "delims=PDF" %%J IN ("%%H") DO echo %%%J) )>abc-out.txt Quote from: foxidrive on September 29, 2016, 02:52:24 AM
Yes Foxidrive. I had that idea as well but thought it might not be bullet proof. So I just stuck with the substring. Quote from: Squashman on September 29, 2016, 08:38:09 AM Yes Foxidrive. I had that idea as well but thought it might not be bullet proof. So I just stuck with the substring. It's pretty likely that the example isn't representative of the actual filenames and so your code is the only one that will work in the real situation Squashman. I amused myself by fiddling with your code in that way. I had noted at that point that it had been over 24 hours since his last POST and the OP hadn't been back to say 'thanks' to you. Doesn't that grind your gears?I like when you guys double-team....things get done...then the OP gets abducted by aliens... Quote from: patio on September 29, 2016, 09:04:51 AM ...then the OP gets abducted by aliens... That's the answer! How stoopid of me, and I USED to watch the X-Files documentary too! Triple Tag team matches are fun here... sorry Guys... I was just swamped by the issue... Just a quick word of thanks and I am trying to fiddle so there is a prompt of reply on my email Thanks again... I will run the code and see ...Hi Guys, I am back from running the codes... I tried saving both Squash and Fox version into a-test.bat and ran it (I hope this is correct way)... but have different results Squash code did not output abc-out.txt Fox code output abc-out.txt but 0kb inside will it help if I paste the redacted sample here ? I think we are in different timezone probably a minimum 8hrs different. so delay will be experienced unless... that is what those greenies wants me to think..... cheers guys Quote from: hdragon33 on October 03, 2016, 02:59:29 AM Hi Guys, I am back from running the codes...Well I TESTED my code with your exact examples before I posted my code. So if you changed it at all trying to fit it into some existing code then you need to post all your code.As they say. Proof is in the pudding. Code: [Select]C:\Users\squashman\Desktop>type so.bat echo off FOR /F "tokens=1* delims= " %%G IN ('find /I "received pdf" ^<abc.txt') DO ( set "fn=%%H" setlocal enabledelayedexpansion set "fn=!fn:~3!" echo !fn!>>abc-out.txt endlocal ) C:\Users\squashman\Desktop>type abc.txt connect connection established; transferring PDF123456-qwe.sts Received PDF123456-qwe.sts connection established; transferring PDF223456-qwe.sts Received PDF223456-qwe.sts connection established; transferring PDF128456-qwe.sts Received PDF128456-qwe.sts Connection stopped C:\Users\squashman\Desktop>so.bat C:\Users\squashman\Desktop>type abc-out.txt 123456-qwe.sts 223456-qwe.sts 128456-qwe.sts C:\Users\squashman\Desktop>Hi Squashman, I just realised that you are using "received pdf" as the search key... I made some modification. it is working somewhat. I am trying to learn coding, if it is not too much can you help explain the code line by line ? Thanks a million Quote from: hdragon33 on October 03, 2016, 06:46:09 PM I just realised that you are using "received pdf" as the search key... I made some modification. it is working somewhat.This TELLS me you are not providing an accurate example of your input text file. Not going to bother explaining the code if it is not working 100% because if you change the examples of your input and output, the code could change drastically and then I am wasting my time explaining even more code.Hi Squashman, I play around with few fiddles, and manage to get it work... below are some comments of how it works, correct me if I am wrong echo off FOR /F "tokens=1* delims= " %%G IN ('find /I "received pdf" ^ [HDragon] this line looks for "received pdf" line and execute a search for the first instance (token=1) it sees the delimiter default of question -> how to specify a delimiter of a full stop <.> set "fn=%%H" setlocal enabledelayedexpansion set "fn=!fn:~3!" echo !fn!>>abc-out.txt endlocal [Hdragon] can you explain the 5 lines above ? I know the <~3 > does some sort of spacing count I have been trying to look for a URL that give tutorials into all these command, do you have one to recommend ? ) |
|
| 1076. |
Solve : batch file moving files which contains 2 specific values to different folder? |
|
Answer» hi all, I would like to make a script for a batch file which move the files which contain the 2 numbers (e.g. 12345 and 56789) to be moved to a specific folder. MOVING files to a specific folder is easy. But writing a batch script that is less likely to mangle your files really requires specific details. |
|
| 1077. |
Solve : Rename and Move PDF Files to Folder? |
|
Answer» Hi, Starting in Windows 2000 (1999), Microsoft added to its scripting power by introducing the Windows Script Host (WSH) and two real, built-in, programming languages (VBScript and JScript--Microsoft’s version of JavaScript). WSH scripts rely on COM objects to interface with the operating system and applications. While WSH is extremely useful and powerful, it’s limited to COM objects that are installed on the computer and doesn’t provide a command-line interface.The article goes on to explain how PowerShell is now the preference for command line scripts. Batch files can support PowerShell scripting. Please understand my concern. Hi Geek, it is new for me to hear Powershell. I'm reading it now and its good to know that there are no addtl apps needed to install but just saving it to Name.ps1 instead of .bat. Does this mean that my query above can be done using powershell? ThanksI still can't figure out how to write it in batch or in powershell but anyone who can help me with this please. Here's the scenario of the code: Code: [Select]set $nameseries = What is your name series? ForEach *.pdf { $nameseries = $nameseries +1 rename $nameseries move C:\Invoices c:\Invoices\Moved_Files Thanks a lot in advance! Quote from: austinandreikurt on August 20, 2016, 11:39:42 PM Say the series input by user is "JENNY-0000" , then the pdf file names would be JENNY-0001, JENNY-0002, JENNY-0003 and so on until all the files where renamed say there are 20 pdf files to rename, then it would be JENNY-0020 for the last item. Your task isn't very clear at this point. You've said that the user types "JENNY-0000" but haven't said why they are typing the "0000" part. Batch file commands do precise things, and if the task isn't WELL laid out then the code you get may not work.Hi, the name series depends on the user but it will always state a 5 letter word, then a hypen "-" then four 0's that will represent the max of 9999 files to rename and move.but it is also ok to just ENUMERATE the 5letter word by the user's input and the script automatically put a 4 number series starting from 0001 to 9999. Also, the reason why it needs to be 0001 instead of just 1 is to be able to sort the items when moved because JENNY-1 will have JENNY-10 as the next one instead of JENNY-2. To avoid it, we need to have it like JENNY-0001, JENNY-0002, JENNY-0003 and so on. Quote from: austinandreikurt on August 21, 2016, 05:54:45 AM Hi, the name series depends on the user but it will always state a 5 letter word, then a hypen "-" then four 0's that will represent the max of 9999 files to rename and move.but it is also ok to just enumerate the 5letter word by the user's input and the script automatically put a 4 number series starting from 0001 to 9999.What do you expect to happen when Jenny already has backup files Jenny-0001.pdf to Jenny-0020.pdf and then Jenny has some more files to save?Jenny files should be 867-5309...Hi foxidrive.the batch will just overwrite them as it is regularly cleaned-up by the user so there should be no duplicates.Test this script and let me know how it goes. Code: [Select]echo off setlocal enabledelayedexpansion set /p "name=Enter your 5 character name: " set c=10000 set "folder=Moved_Files" md "%folder%" 2>nul for %%a in (*.pdf) do if exist "%folder%\" ( set /a c+=1 move "%%a" "%folder%\!name!-!c:~-4!%%~xa" ) pause I think Jenny works at a different phone number down here. Quote from: patio on August 21, 2016, 09:18:28 AM Jenny files should be 867-5309...Wow. exactly what I need. thanks a lot foxidrive! |
|
| 1078. |
Solve : Stderr output? |
|
Answer» Hi all, When redirecting output from an application using the ">" symbol, error messages still print to the screen. This is because error messages are often sent to the Standard Error stream instead of the Standard Out stream. Read the article for more details.multiple redirection operators specified this way only work on a single command; that is, in this case, the command is redirecting the standard output and standard error of the "echo test"; the redirection to standard error is not redirecting the standard error of the output from the redirection of the standard output. (Now there is a tongue twister...) You need to separate it like so: Code: [Select](echo test > "path for output file ") 2> "C:\test\output.err" This way you are saying to redirect the output of "echo test" to a file, and then redirecting the standard error of that redirection itself to another file.BC_Programmer is right.Started helping the user on destiny about an hour before they posted here. http://www.dostips.com/forum/viewtopic.php?f=3&t=7439 Quote from: Squashman on September 28, 2016, 10:51:24 PM Started helping the user on destiny about an hour before they posted here. Doesn't it get annoying! |
|
| 1079. |
Solve : Help with dos commands, lost admin password? |
|
Answer» I recently helped someone reset there lost admin PASSWORD on a local account Windows 10. I found this website and followed it successfully. Utilman.exe is a built in Windows application that is designed to allow the user to configure Accessibility options such as the Magnifier, High Contrast Theme, Narrator and On Screen Keyboard before they log onto the system. The link you gave is not the way MS recommends password recovery. The trick undermines the whole concept of having a password. Next time tell your people to use a code or name that is EASY to remember. Here is one: qwerty123 That is very easy to remember. And you will not have to resort to some kind of trick. For more info, just Google utilman.exe In Windows you can use accessibility options from the login screen and they use utilman.exe. By effectively having cmd.exe be utilman.exe you get a command prompt instead. It is undone by copying the renamed file back to utilman.exe.Two questions. 1. Geek-9pm What does MS recommend for password recovery? 2. BC_Programmer What I'm having trouble with is the mechanics of all the command lines. From what you are telling me the last command "copy utilhold.exe utilman.exe". Does that copy and rename the file back to utilman.exe? It looks to me like it just copy's utilhold to utilman but doesn't rename any thing. Mike Quote What I'm having trouble with is the mechanics of all the command lines. From what you are telling me the last command "copy utilhold.exe utilman.exe". Does that copy and rename the file back to utilman.exe? It looks to me like it just copy's utilhold to utilman but doesn't rename any thing. the commands are pretty much exactly as they appear. Code: [Select]X: Change current drive to drive X. Code: [Select]Cd windows\system32 change the current directory to \Windows\system32 on the current drive (X). Code: [Select]Ren utilman.exe utilhold.exe rename utilman.exe in the current directory to utilhold.exe. Code: [Select]Copy cmd.exe utilman.exe Make a copy of cmd.exe and call it utilman.exe And then undoing the action: Code: [Select]X:Change current drive to X. Code: [Select]Cd \windows\system32Change the current directory on the current drive to \Windows\System32. Code: [Select]Copy utihold.exe utilman.exe Copy the file utilhold.exe and call the copy utilman.exe.Your question was: "What does MS recommend for password recovery?" Microsoft does not have an explicit tool that will reset anybody's password anywhere at any time. Instead, Microsoft has built into the system a number of safeguards and utilities that should make it unnecessary for a person to reset the password using software alone. One of the tools is the ability of a Windows computer to have more than one user and each user to have his own password. Thus if you cannot login with one user password combination, you can use another. The second tool that is available is the use of hidden users. You have a hidden user with a name you would remember and a very easy or even nonexistent password. Hidden users are documented elsewhere. Third, a feature in Windows 10 is that the password can have an alias of a four DIGIT number. This allows a user to enter in to the system using a four digit number. However, this four digit number only works from the console and not from anywhere else. And the digits can be changed later and the password is the same. Another provision that Microsoft has made is service for a fee. If you have a very DIFFICULT problem, including password recovery, you can call into Microsoft and get telephone support for a fee. Yet another feature available is the use of the same password and user as for your Microsoft account. If you forget your password for some reason, you can go to another computer and access Microsoft and request that your password be reset. There are number of steps you take their to reset your password online. Once that is done, you can then go to the computer of the lost password and you should be able to sign in if there is an Internet connection. So there you have about 5 ways to recovery the password without using a hard core software hack. In short, there are a number of remedies that Microsoft has already provided without the need for an explicit piece of software that would just out right reset the password with minimal effort. Such a tool would only reduce the security of everybody else. As a reference, let me refer you to the issue that Apple had with the FBI. The FBI wanted Apple to find a way to easily break into an Apple iPhone that was in the position of a deceased terrorist. Apple refused on the GROUNDS that it would compromise the security of all the other Apple iPhone users in the whole world. From this, one could see that a company such as Microsoft, Apple or IBM or any of the big companies should never, ever publish a tool that would make it easy to change other people's passwords. And this is not just my idea. A large number of people have the same thought. You just cannot make it easy for people to crack passwords. Hopefully, this will clarify the position of myself and a number of others. Soapbox removed... Quote from: Geek-9pm on August 22, 2016, 12:10:22 PM without the need for an explicit piece of software that would just out right reset the password with minimal effort. Such a tool would only reduce the security of everybody else. There's a tool that can reset any password and all it needs is physical assess to the machine to boot up a CD or USB stick. I've had the need to help people with machines that with forgotten passwords and it's a simple matter to nuke the password and reboot the PC and you're in. I'd say what it is but I might get my wrists slapped. kinky, eh? Quote from: patio on August 22, 2016, 12:52:08 PM Soapbox removed...Bugger. I was looking forward to somebody else doing that for a change. Quote from: MIke50 on August 22, 2016, 10:37:57 AM What I'm having trouble with is the mechanics of all the command lines. From what you are telling me the last command "copy utilhold.exe utilman.exe". Does that copy and rename the file back to utilman.exe? It looks to me like it just copy's utilhold to utilman but doesn't rename any thing. That's not a clean bit of code because it leaves the utilhold.exe laying around. Either of these should be cleaner: Code: [Select]X: Cd \windows\system32 move utilhold.exe utilman.exe Code: [Select]X: Cd \windows\system32 Copy utilhold.exe utilman.exe del utilhold.exe rem ...the problem with using the del command is that if the line above was typo'd then the utilman.exe file could be gone. And this is more versatile code that handles any drive letter, rather than the first two lines of code in your examples. Code: [Select]pushd "%windir%\system32" Sorry for not getting back sooner. I have been very busy lately. Thanks for spelling that out for me. I was having a hard time getting my head into what that copy command was doing. Probably had some preconceived ideas because I use copy and past in the regular Windows UI. Thanks Again MikeThis has gone beyond Forum guidelines...Topic Closed. |
|
| 1080. |
Solve : Archive (PST) Mapping in outlook? |
|
Answer» Is there any tools, batch or script that would allow me to point the location where all a users PST files are kept and will map those Setting the default via Group PolicyIs there anyway to create a batch file or script or a program which can map all the users outlook email archive (.PST) at one time, instead of editing regedit and change the settings of outlookA batch would have to inject registry settings to alter each computer. And its way more involved and dangerous than group policy configuration.how about any softwares?Im not AWARE of any software that does this as for most people use the free or readily available methods. Only software I know of for PST files is a PST reader called PST Walker that allows reading of PST files without Outlook installed but thats NOT what you need. |
|
| 1081. |
Solve : how to create a bootable disk (CF card) under Windows 7?? |
|
Answer» I would like to format my CF card into a bootable media so that my system image file, VxWorks, can be started up by BIOS after power on. Long time ago, I did it by DOS command: "format f: /s". It's very simple. But now, it doesn't work at Windows 7. I even used Computer Management tool to format it, but I can't find the option of 'system'. The formatted CF card is not bootable even I copied my system image into it. Let me know how I can do it.You need to use a tool that creates a bootable USB drive. In November 2010, SanDisk, Sony, and Nikon presented a next generation card format to the CompactFlash Association. The new format has a similar form factor to CF/CFast but is based on the PCI Express interface instead of Parallel ATA or Serial ATA.[10][11] With potential read and write speeds of 1 Gbit/s (125 MByte/s) and storage capabilities beyond 2 TiB the new format is AIMED at high-definition camcorders and high-resolution digital cameras, but the new cards are not backward compatible with either CompactFlash or CFast. The XQD card format was officially announced by the CompactFlash Association in December 2011.[12]I'm assuming the OP meant traditional CF cards, which is what I use. I use mostly 256MByte, 1GByte, and 2GByte cards. I prefer FAT-32 for efficiency. I use these in PC104 format embedded systems and ICOP VortexDX boards. The ICOP boots off of USB, had a custom CF reader integrated into the custom computer. The PC104 WinSystems board comes with the CF reader built in. I also use Panasonic Toughbooks models CF-51 and CF-52, both can be configured to boot off the USB port- including the CF cards in a reader. My CF-52 now has a 512GByte Fat-32 SATA (not easy to do) drive that dual-boots DOS 7.1 (win98se realmode) and XP. Himem.sys gives DOS access to up to 3.4GBytes RAM, either booted off the hard-drive or the CF card. WinSystems sells an industrial grade CF card pre-configured to boot for their systems. Using the HP utility provides a large cost-savings compared with the Winsystems cards. The latter are spec'd for high-temperature operation, but I did not require the full temperature range. |
|
| 1082. |
Solve : Installing FreeDOS on a Thin Client? |
|
Answer» Hi, I've gotten an HP T5000 thin client from someone on eBay in the past, which had MS-DOS 6.22 on it. I wiped it and put FreeDOS on that one, and now it's got FAT32 USB support, making it incredibly easy to download DOS games, copy them to the flash drive and play them straight off of there. The only fault with it is that it's only got PC Speaker sound. So your making a second box like this then... but different manufacturer build... I personally would have stuck with the prior known working HP model for what your doing as for there is no guarantee that there are the needed USB DOS drivers for the Wyse. Additionally you can get an Intel Atom mini computer like the thin client but not a thin client and have better support for the kind of thing your doing. If it were me wanting to make a miniature DOS system, I'd go with something like this and then DOS BOX the DOS environment within Windows or Linux with WINE http://www.newegg.com/Product/Product.aspx?Item=N82E16856205007&ignorebbr=1 A mini computer like this has so much more potential to play far more games and both DOS games and somewhat modern games that are not too heavy on graphics. You could lay games about as graphically intense as Diablo II on this mini computer linked above. I have run Diablo II on my Intel Atom Netbook with n280 1.66Ghz and while you can see the APU chugging on it and working to maintain the game, its not that bad of an occasional barely noticeable slow down, and this Atom in this mini computer is more powerful than the n280. I have a desktop with the D510 Atom and its able to play World of Warcraft on lowest video quality for example with 2 cores with hyper threading that act like 4. *I dont play wow on it, but did so to push the hardware and test its limits. I was getting 12-20 fps on the Atom D510 with World of Warcraft on lowest quality and 1024x768. World of Warcraft on netbook with Atom n280 is like 2-4 fps and pretty much unplayable with lowest settings as a comparison. With the Wyse since you already own it, give it a try and see if it works. Hopefully it wasnt money wasted. |
|
| 1083. |
Solve : Pass Variable and a Variation to a batch file? |
|
Answer» I'm just ... brain dead. Here is what I would like to do. Microsoft Windows [Version 6.1.7601] What does your batch look like and is this the problem your running into? My guess is this is the issue with the extra .ts which is part of the file name so wildcard is passing filename.ts Quote from: RBraverman on October 06, 2016, 05:46:56 PM a .info extension that I need to rename I edited my reply after I re-read your question. Hmm, then I re-read it another time and my head imploded. You asked for two different things, didn't you? You said to rename the file and then wanted to have two copies of the .info file. Based upon your details this should copy the info file to an mp4 extension. Code: [Select]copy "%~dpnx1.info" "%~dpn1.mp4.info" and this will rename it. Code: [Select]ren "%~dpnx1.info" "%~n1.mp4.info" Quote from: foxidrive on October 06, 2016, 10:56:35 PM I edited my reply after I re-read your question. MANY THANKS for replying, I just knew I'd make this more complicated .... You are right, convert a file with the passed video.ts (to video.mp4) and copy a file associated with it with the name of video.ts.info (separate text file) to video.mp4.info. I have tried what you suggested before and now again and this is what I get (which is driving me crazy, I might add), which is why I put it away for a week or two: [attachment deleted by admin to conserve space]Alot easier and quicker to copy and paste from the cmd window to the forum then making a screenshot. You can see from your file listing that the file you are trying to copy does not exist. So I am confused as to what you are trying to do.I see what you are doing now. You are trying to run the batch file with just the ts.info file. The code you were given assumed you were processing the base .ts file and the copy code would find the ts.info file and rename it based on the .ts file name. Quote from: Squashman on October 07, 2016, 08:21:33 AM A lot easier and quicker to copy and paste from the cmd window to the forum then making a screenshot. I tried but couldn't. Sorry. Quote from: Squashman on October 07, 2016, 08:21:33 AM You can see from your file listing that the file you are trying to copy does not exist. So I am confused as to what you are trying to do. Ok, I knew I wasn't going to be clear - the inuithighkick.ts.info does exist - that is the file that is to be copied to inuithighkick.mp4.info Quote from: Squashman on October 07, 2016, 08:31:47 AM I see what you are doing now. You are trying to run the batch file with just the ts.info file. The code you were given assumed you were processing the base .ts file and the copy code would find the ts.info file and rename it based on the .ts file name. I didn't use the processing of the video.ts file as that will take 20 minutes - just to see if the info file copies. Ok, lemme try the full batch. Again sorry - I should have seen that. DANDY. I didn't use %~dpnx1, I was trying to use %~n1 - and, needless-to-say - I got a copy of the video with a info extension. Can you explain what's happening here? My understanding of %~dpnx1 wouldn't WORK here.You can read about all the variable modifiers by opening up a cmd prompt and typing for /? Here is the snippet you want to look at. Code: [Select]In addition, substitution of FOR variable references has been enhanced. You can now use the following optional syntax: %~I - expands %I removing any surrounding quotes (") %~fI - expands %I to a fully qualified path name %~dI - expands %I to a drive letter only %~pI - expands %I to a path only %~nI - expands %I to a file name only %~xI - expands %I to a file extension only %~sI - expanded path contains short names only %~aI - expands %I to file attributes of file %~tI - expands %I to date/time of file %~zI - expands %I to size of file %~$PATH:I - SEARCHES the directories listed in the PATH environment variable and expands %I to the fully qualified name of the first one found. If the environment variable name is not defined or the file is not found by the search, then this modifier expands to the empty string The modifiers can be combined to get compound results: %~dpI - expands %I to a drive letter and path only %~nxI - expands %I to a file name and extension only %~fsI - expands %I to a full path name with short names only %~dp$PATH:I - searches the directories listed in the PATH environment variable for %I and expands to the drive letter and path of the first one found. %~ftzaI - expands %I to a DIR like output line Quote from: RBraverman on October 07, 2016, 10:03:24 AM I didn't use the processing of the video.ts file as that will take 20 minutes - just to see if the info file copies. A way to test it could have been to use a video file that was 2 seconds long. Ask direct questions if you still have trouble understanding the info Squashman has shown you. |
|
| 1084. |
Solve : Bat file FOR statement referencing file-set with embedded blanks.? |
|
Answer» How do I use the MS-DOS FOR COMMAND to parse a file whose name contains a blank? How do I use the MS-DOS FOR command to parse a file whose name contains a blank?Hi John, In this thread and your previous thread you mentioned you are using DOS. Be advised that cmd.exe is not DOS if you are using a variant of Windows NT (2000,XP,Vista,7,8,10). If you really NEED help with a specific command in regards to DOS then you need to specify what version of DOS you are using. Quote from: Squashman on October 11, 2016, 07:29:50 AM you are using a variant of Windows NT (2000,XP,Vista,7,8,10) You nailed it there Squashman. No version of MSDOS can parse the contents of a file using the FOR command. The only way a filename can have a space in MSDOS is by using a disk editor and shoving one in that way. I believe I'll have another glass of medicine. Jack Daniels is medicine, right?? No? What about Johnny Walker?? The DOS FOR command has a lot of FEATURES that are not bedded in a simple loop. One can create a simple loop that calls another BAT file taught will compare contents of a file. A list of file scan be made with Code: [Select]DIR /B >LIST.TXTNo FOR loop needed. Some of the work will be done manual. But once you have a valid method, you can find some way to make it take parameters are work automatically. Cant OP give a basic outline of the task? What is the purpose? How much data? What kind input? What would be the output? Quote from: Geek-9pm on October 11, 2016, 03:32:51 PM not bedded in a simple loop. It seems that your speech-to-text converter needs a grease and oil change, geek. It seems pretty clear that the op was abducted by aliens. This is becoming a serious problem. The problem has been duly noted. Today I received a brand-new microphone and hopefully the dictation will be more accurate in the future. Also, filenames with blanks can be a problem and makes me wonder why not just not use planks on all and reduce the trouble. A common practice is to use the_in place of a blank . In most cases that should not be a problem. Well, so far the new microphone is working good. Quote from: Geek-9pm on October 15, 2016, 05:10:21 PM The problem has been duly noted. Today I received a brand-new microphone and hopefully the dictation will be more accurate in the future.ahhh, a new tech toy. I have a liking for new tech toys. The gain setting will likely have an effect on speech recognition, but of course within the good range and not just high for the sake of high gain. I've seen that background noise is a particular issue that can make wurds rong, so make sure the cat isn't too noisy when she's playing with the PLASTIC bags. |
|
| 1085. |
Solve : delete xml Files in folder when corresponding TS files doesn't exist? |
|
Answer» Hi, It's me again. As I wrote already the Batch is working. But now I want to clean all subfolders too. Someone an idea?Look at USING the /R OPTION with the FOR command. You will need to change the FOR variable modifiers as well. Quote from: olli14 on October 20, 2016, 01:31:55 AM But now I want to clean all subfolders too. Someone an idea? Do you want to remove every file in a Subdirectory tree? This is easy as Squashman SAYS but it's a dangerous script to have laying around - as it could find itself in another place and then all files can be removed where it's not supposed to run. The solution is to include the correct path so it can only operate in the correct folder. Code: [Select]del /s /q /f "c:\your folder tree\and at the\right\folder\*.*" Ocalabob who gave you your script was a good friend to me, and he passed away from Cancer on 2 November 2013 Here's a pic from happier times. I'm not so sure that the fish was too happy, but Bob had a ball. His home base was in Florida.R.I/P/ So 2 months after the post above... Thanx for the pic. |
|
| 1086. |
Solve : how to do division and rounding within the string?? |
|
Answer» Hi all, |
|
| 1087. |
Solve : Use a batch file as a midwife to a playlist.? |
|
Answer» Introduction. Locked out of editing last post, but did some quick searching and found this: for f in *.md; do mv "$f" "test - $f"; doneThis is BASH. Unless Geek is running Windows 10 with the Linux Subsystem installed, this is not going to work.I need to clarify. The3 MP3 player is super dumb. The only things it does is identify files as being audio files by the extension My goal was to exclude a large block of files, not change the order The player does not have a way to go to a specific starting point. Expect by pressing the forward key N times. Larger example, There are 100 audio files that a re just reading. Another 100 fioles are dance music. Another 100 are relaxing music. So when I want to listen to the reading, I woulds exclude the music files. So I I want to dance, I would exclude the files not in the category. The order is not important. What matters is the kind of stuff I want to hear. As for folders, the player does not respect folders. It plays anything that looks like a MP3 file. That is why I am think only the type matters. Of curse, to make the change I have to plug the card into my PC, do a command, them put it back. The should not take 30 seconds. As mentioned , the obvious solution is to just buy a lot of SD memory cards. But that just seems to be such a waste to have a bunch of chips that are mostly empty. So I am looking for a batch program that can just change the type for blocks of files The files can be in folders. Windows sees folders, the player only sees files.Lets say there are five folders. \voice \rock \classic \western \soft If I want the classic group., change the type of all the others. Is that doable? Gimme Shelter should be # 1...no matter what you guys figure out...I wonder if the player can see folders & files that have the hidden file attribute set. This way you would not have to screw around with renaming files.OK, I will test that now. I have already found that it only knows MP3 and it does not care about sort order. It plays files b y the order they weer save. It does not stopwith folder boundaries. It just plays everything I am going to try a test in Audacity.I will make a MP3 of my voice, write it to a USB drive and then make it hidden. NO. The player ignores the hidden bit. It plays the file as if the hidden thing did not matter. Also, it only does MP3. It does not play WAV files or even see them. Given the l imitations of the device, as you've noted the extension is probably the way to go here- rename files to MP3 to make them "visible" rename them back to make them invisible to the player. My thinking is using extensions pl0, pl1, pl2, etc to .pl9. You would rename the files intending to be on each playlist with the appropriate extension, EG the first playlist to the pl0 extension, the second to the pl1 extension, etc. you would have a batch file for performing the operation, and it is provided the desired playlist extension. It's first task would be to find out the "current" playlist, since it would need to rename existing mp3 files back to the appropriate extension to hide them and tag them as part of that psuedo-playlist. I'm sure one of the more proficient batch guru's could do something more specific (maybe save it to a file for retrieval) but my thinking is to just brute force it to find the missing playlist extension, then rename all the mp3 files present back to that playlist extension. After that, the SD Card will have no files with the mp3 extension and the task is to rename the selected playlist files to Mp3 to make them "visible". At that point we'd have the SD Card with no files with the mp3 extension, and the batch would just need to rename the selected playlist to "mp3" to make it active: Code: [Select]for %%p in (0 1 2 3 4 5 6 7 8 9) do if not exist *.pl%%p rename *.mp3 *.pl%%p rename *.%1 *.mp3 At which point your "selected" playlist is enabled. with the selected playlist being provided as a command LINE argument. But of course having to open a command prompt and such doesn't make it particularly straightforward. If the player ignores all files that don't have a .mp3 extension, we can utilize that to make it a bit easier, and even make it somewhat machine independent. Let's say the above batch file is named "setplaylist.bat" and is saved on the SD Card. For easy selection you could create empty files with no extension where the name matches the playlist extension- for example there would be files pl1, pl2, pl3, etc. Then you could make use of the batch by dragging those files over the batch file in Windows Explorer. For adding additional playlists beyond 10, it would require altering the "cleanup" logic in such a fashion as to recognize what playlist is "active" if there is one so it can rename the files back. Of course you can use longer than 3 characters so you could just go on with 10, 11, 12, etc and add it in there. (I'm sure there's room for a "for" command trick to iterate through say 100 numbers and have as many playlists as you want, too, but I'm lazy and couldn't be bothered to look into that!) It looks like you on to something here. I will have to think hard and see if I get it. Meanwhile, here is a picture of the little MP3 player. It has better sound than my smartphone. But is not smart. It is very dumb. |
|
| 1088. |
Solve : How to read Floppy 1.44 compressed with Doublespace (1.8MB)? |
|
Answer» Hi to everyone, Microsoft's decision to develop DoubleSpace and add it to MS-DOS was probably influenced by the fact that DOS-based operating systems from other manufacturers (IBM and Novell) had started including disk compression software in their products.[citation needed]If you run into some troubles hard to understand, consult the above article. Because of some legal issue, the product could not continue to be offered by Microsoft. This lead to some problems. In worst case, you will need the exact version number of MS-DOS and use that version to recover the data. However, the article above CLAIMS that you should not have any issue if you use Windows 95. Myself, I don't know if that is true. The article also states the Windows 98 can read the compressed files. Another article about read files from a compressed floppy using Windows xp. http://www.tomshardware.com/forum/81262-45-compressed-floppy BTW: Older programs to handle compression wee written in the Real Mode. And that means you can not use them in 64 bit versions of Windows. Don't let this detail confuse you. What files are on the disk? A Doublespace or Drvspace compressed diskette/disk will contain files such as DBLSPACE.001 or DRVSPACE.001. If it doesn't contain files like this it is not compressed. Quote "1.8MB". Unfortunately who compressed floppy can not help me anymore. I have MS DOS 6 and 6.22 (bought in a flea market) Curious what you expect to find on the disk if and when you access the data and what you PLAN to do with the information?How does it show in Explorer when you open it ? ? |
|
| 1089. |
Solve : Type CMD in Explorer address bar? |
|
Answer» ... to open a COMMAND window. I have been using Windows NT family since 1998 and I only just found out about this today! I am using Windows 10; how many versions back has this been possible? Now I can go both ways! (...I should probably delete that comment...)Fine by me, honey! Quote from: Squashman on November 19, 2016, 12:00:47 PM I always knew I could open up explorer from a cmd prompt by typing start .You have saved me some typing because I have been using start "" "." for the last nearly 20 years. From cmd prompt. Open Explorer to the root of the current drive letter. Code: [Select] start \or Code: [Select]explorer \ |
|
| 1090. |
Solve : Configure FreeDOS so I don't have to press Enter and choose drivers?? |
|
Answer» Hello, How do I install FreeDOS?Booting from a CD will prevent changes being made to the image. |
|
| 1091. |
Solve : Adapt a bat script? |
|
Answer» something I am doing bad : Is it killing your first instance of ditto? Kind of confused as well to this... I can see someone putting in a goto and making a nasty kill/launch loop with this. However hopefully its just a reset for some reason we are not aware of. I'll try and comment. The purpose is a little bug i am suffering with Ditto and fast shortcuts Control+1 to 0 for the prior clips. I loose the order. So I need to reiniatate the program sometimes to recover. Goes fine. But then I convert the bat file to an exe file. the bat file execute the reopening opening and closing the console from ms-dos. But the exe doesn't . How can i solve this Perhaps an exit command under the last line ? Best Regards Quote from: Fielding on NOVEMBER 12, 2016, 12:55:26 PM But then I convert the bat file to an exe file.Why? This is unsupported, undocumented and likely to fail in many situations. Why do you need to do this? Using which third-party tool? Are you running the exe as administrator? Is this squall? Nahh...thankfully he never got as far as attempting coding...he concentrated on rescuing ancient equipment he found on tree lawns dumpsters etc... However this may be his cousin.The batch scripting language is exactly that - designed so that text files containing commands are run by the interpreter in a carefully designed process (3 stages I( believe). Batch-to-exe converters have a bad reputation and are mainly used by script kiddies, not serious programmers. All they do is package the actual text of the script with an .exe stub. In my opinion, asking "why does my batch script work as a script but not when compiled by the BatWiz compiler?" takes one outside the SUPPORT zone for batch. I try to explain. I need to attach this script to the task bar. The program i am using is : BAT2EXE from codeplex. The more confusing this for me is that the script goes well under windows 7-64 Modifications I observe : the path now have space. Quote from: Fielding on November 13, 2016, 12:13:36 PM I need to attach this script to the task bar.I wonder if you did this Google Search. Which finds this as its first search RESULT.Squashman, you beat me to it! I thought of a shortcut to cmd.exe /c batchfile while I was in the shower. Quote from: Squashman on November 13, 2016, 02:13:50 PM I wonder if you did this Google Search. Sure that is not there some time ago when I use an old exe to pin to the task bar. Thanks a lot Best Regards |
|
| 1092. |
Solve : Cant run .bat while cmd itself works fine? |
|
Answer» Hello everyone, first of I have to say that English is not my mother language so there could be some mistakes. Im using win7 x64 sp1 piratedUh-oh. Quote from: Salmon Trout on November 25, 2016, 04:40:03 PM Uh-oh.Wanted to say that Im not using a legit windows, it just downloaded version that is licensed, at least thats what it shows up on system info.Thee is not any reason to use a pirated version of Windows. (Except for a pirate.) https://www.pcsteps.com/45-download-windows-7-iso-legally-free-digital-river/ A legal product key can be obtained at a very low costs for students and others who have special need. In some cases it might be free. Did you save the .bat file as a Unicode file by accident? Quote from: Squashman on November 25, 2016, 08:54:00 PM Did you save the .bat file as a Unicode file by accident?Thank you so much! Yes, that was the problem! Im using cyrilic latter and sometimes when I write a document it removes 'special latters' so I set unicode by default. I was also tempted to reinstall OS because I really thought that's the problem.... Once more THANKS A LOT Squashman!The SCREEN shot you took was the dead give away because of the character before the . |
|
| 1093. |
Solve : Remove header from multiple csv files using batch file? |
|
Answer» I have TWO files in a FOLDER file1.csv and FILE2.csv that contain the data. file1.csv with column names name and sal and file2.csv with the same column names name and sal. required header columns are present in headerfile.csv in the same folder and the column names are ename and esal. My requirement is to replace headers in file1 and file2 with headers from headerfilePlease provide a real WORLD example of your input and how you want the OUTPUT to look like. |
|
| 1094. |
Solve : batch file for tracert? |
|
Answer» Hi, Your question doesn't have all the details but see if this works for you:I know its an old thread, but for me it didn't worked untill I did this: Code: [Select]echo off cd A:\NY\Directories\You\Want\Your\results\In :loop for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a" set "YY=%dt:~2,2%" & set "YYYY=%dt:~0,4%" & set "MM=%dt:~4,2%" & set "DD=%dt:~6,2%" set "HH=%dt:~8,2%" & set "Min=%dt:~10,2%" & set "Sec=%dt:~12,2%" set "datestamp=%YYYY%%MM%%DD%" & set "timestamp=%HH%%Min%%Sec%" set "fullstamp=%YYYY%-%MM%-%DD%_%HH%-%Min%-%Sec%" tracert www.google.com >"%fullstamp%.txt" goto :loop With the original code, it created about 3-4 empty files PER seconds in the same directory. I am on Windows 7 64bit. |
|
| 1095. |
Solve : Problem using batch script? |
|
Answer» hi, i am new user of windows batch script. I am having problem to write a script to automate the repetitive programme. In the batch script, I need to the replace the input filename by another filename, can it be read directly from the filename itself or we do need to specify in the script? Because there are a lot of files, I can't specify ONE by one. Anyone can help? |
|
| 1096. |
Solve : PASSING VARIABLES BETWEEN BAT FILES? |
|
Answer» I'm attempting to execute a bat file which SETS a variable and then have that I have no idea what your reference to 'fix your capslock 1st' means...He means it is bad manners to type all in capital letters, as you did in the thread title. Doing that is the web equivalent of shouting (e.g. for attention). This has been so for around 20 years if not more. |
|
| 1097. |
Solve : CDR101 not ready reading on DOS 6.22? |
|
Answer» Hello, May I ask why he wants to have a CD with DOS 6.22? he's not attempting to run DOS from CD...re-read the Post. Patio, id did read and re read. He stated his project on the left foot. He should have stated on the right foot. The right foot would be to use a OS that has CD-ROM support already. DOS 6.22 on a CD has built-in CD om support. On version I have used boots DOS 6.22 from a CD and does not use any hard drive space. No drivrs needed, not install needed, no hassle. But then, the OP did not say what he had in mind as a objective. Maybe he wanted to make something easy into something hard. Here is how to run DOS from a CD with not hard drive install needed. http://www.computing.net/answers/windows-xp/how-to-create-bootable-msdos-622-cd/185071.html The above is a set of post from some who say you can't do it that way. But you can. It was done some time ago and documented and everybody forgot about it. Do you mean booting with a CD to install DOS 6.22? Or do you merely want to create a DOS 6.22 bootable CD? This is where every body gets stuck. No, it is about running DOS from a bootable CD, not about installation. He has DOS up and running...he needs to get the CDROM working for an app that needs it... I read that entire link and didn't see where anyone made a DOS bootable CD with built in CDROM support BTW... 2 of the alternate links within that link you posted are dead ends BTW.Smatthew...just thought of something... If after trying the OakRom drivers the drive didn't work...correct ? ? If a Work enviornment it's possible the drive is on it's way out... Quote I am only able to copy some of them to the hard drive, it stops at a point and the prompt "CDR101 not ready reading" comes up, this is followed by a question to abort, fail, or end? This is what got me thinkin along those lines...You can make a CD that has two partitions, a small one is an image of an MS-DOS, FreeDOS etc boot floppy with CD-ROM support, and would appear as Drive A:, the larger one is what MS-DOS sees as the CD-ROM drive letter. of course this depends on the TARGET machine BIOS being able to support floppy emulation. Typical guide here using the "El Torito" method http://www.styma.org/bootcdrom/bootcdrom.shtml https://en.wikipedia.org/wiki/El_Torito_(CD-ROM_standard) |
|
| 1098. |
Solve : How i can compress subdirectory and move to other disk?? |
|
Answer» HEY guys i am using RAR.exe and cobian backup program.. cobian running hourly my batch file for backup copy (my DBF files and index files) to created backup dir with timestampped backup directory is... c:\Backup\Data my sub directory name style SUB1_2016_%date%_%time% SUB2_2015_%date%_%time% ... cobian creating new backup hourly with my batch copy files.. why copying? cant create compressed files with cobian on users working (24h program working) what i will do? i will add new session to cobian daily. i will do all subdirectory will compress with RAR.exe and i will move to all rar files to external disk is path e:\Data\ and i will delete subdirectory after move rar files... or if i can do delete compressed subdirectory will be good.. but dont know rar parameters on command lines todays i am making everythings with manual after cobian hourly backup thxSo you want to have hourly backups of your database and store them compressed to save space, and people are using this database while you want to back it up at the same time. THATS tricky. I have worked with mySQL before and its best that no database transactions be happening while the database is being backed up. Reason behind this is that you could be backing up a partial transaction. Partial transaction is when the database is being backed up and at the same time someone is making CHANGES to it, adding entries, changing values etc, and the backup and transaction of the user conflict to where only some of the data that they entered or changed is saved under that backup interval. For whatever transaction is happening during the backup you have the potential for corruption if you ever went to restore the database from this saved state in which there is only a partial of all data that was manipulated during that transaction and backup overlap. Safest method would be to have a MIRROR database going on at the same time, the mirror database that clones the data of the actual database at a timed interval where you create your hourly backups off of. This other database does not have transactions with users and so the only time transactions happen are when it calls to replicate its database with that of the master database that everyone interacts with. This is the method I would go with to avoid a transaction occurring while the backup is happening. Transactional databases are pretty bulletproof but a backup at the same time that its in use, I try to avoid personally. When i worked for a food store I had a setup like this where a mirror of the database updated every 15 minutes so that the maximum data loss was for a 15 minute span. I never went with hourly backups but could have if I wanted to. We just ran a daily backup after midnight for the start of the next day. We had the master go down hard when RAID set broke once and I was able to restore the master from the mirror in under 10 minutes over 100mbps network connection. Ran a SQL DUMP and then pushed the AllDatabases dump file to the fixed master. http://mysqlserverteam.com/creating-and-restoring-database-backups-with-mysqldump-and-mysql-enterprise-backup-part-1-of-2/Hello Dave using foxpro dos dbf files... mean... cant do export.. only copy... or disconnect all users for backup i am copying files with copy command on dos screen after i need auto compress files and wanna move to external usb disk weekly i am changing disk for security but... only hourly copy auto with cobian program others.. compress and move doing manuely i need new batch for compress after move to usb i am not coder.. sorrySub-directory backup may be the issue here... |
|
| 1099. |
Solve : Echo file date? |
|
Answer» Modifying some code I found. Basically I am parsing a directory and subdirectory filelist out after a date and writing the INFO to a text file to use as input into 7 zip. I was going to use forfiles when I found out that one can not exclude directories when using -s. My problem is echoing out the file date using echo %%~tF. I get a BLANK line. or with other variants I get the colon . I am missing something here. I got stuck on the echo. |
|
| 1100. |
Solve : Select files and enter? |
|
Answer» I want to automate opening multiple files. |
|