| 1. |
Solve : md multiple folders window 7? |
|
Answer» Hi all, But what does (1,1,10) mean? I guess it means 1 to 10 but what is the other digit for? You can take a look at the full documentation by typing in for /? Essentially, when using the /l switch, the first number describes the start point, the last number the end point, and the middle digit designates by how much the step is. So (1,1,10) will end up throwing 1, 2, 3, 4...10, while (4,2,16) will throw 4, 6, 8, 10...16. That's the basic explanation.I thought so, just wanted to check. Last question on this TOPIC is; what if I wanted to use A to Z instead of numbers for example Appendix A, B, C etc. thank you for all your help I'm not sure how this works with batch, but I know how to do it with VBScript. In fact, this works great with a hybrid script. See below: Code: [Select]echo off setlocal enabledelayedexpansion echo dim oArgs >ASCII.vbs echo set oArgs=wscript.Arguments >>ASCII.vbs echo wscript.echo CHR(oArgs(0)) >>ASCII.vbs for /l %%I in (65,1,90) do ( for %%J in ('cscript /nologo ASCII.vbs %%I') do set end=%%J mkdir "Appendix !end!" ) del ASCII.vbs exit This will go from A to Z, so you will have to do some manual math if you want to change the LETTERS that are used at all. Code: [Select]echo off set "chars=ABCDEFGHIJKLMNOPQRSTUVWXYZ" setlocal EnableDelayedExpansion for /l %%a in (0,1,25) do echo !chars:~%%a,1! Quote from: oh-dear on January 19, 2012, 11:04:20 AM But what does (1,1,10) mean? (start, step, end) Quote from: Raven19528 on January 19, 2012, 12:00:48 PM I'm not sure how this works with batch, but I know how to do it with VBScript. In fact, this works great with a hybrid script. See below: Did you try it? I tried that code out, I could only make it work if the FOR line that calls the VBSCript has the /f switch, and you can reduce the VBScript to one line, and the convention is that script engine switches such as //nologo have 2 slashes (so cscript or wscript can distinguish between switches intended for the engine and those for the script) Code: [Select]echo off setlocal enabledelayedexpansion echo wscript.echo CHR(wscript.arguments(0)) > ASCII.vbs for /l %%I in (65,1,90) do ( for /f %%J in ('cscript //nologo ASCII.vbs %%I') do set end=%%J mkdir "Appendix !end!" ) del ASCII.vbs in fact you can do it in one line of batch Code: [Select]for %%A in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do mkdir "Appendix %%A" Quote from: Salmon Trout on January 20, 2012, 12:01:27 AM in fact you can do it in one line of batchDoh! I just had a Homer moment. Not sure why I over complicated it. Quote from: Squashman on January 20, 2012, 05:44:51 AM Doh! I just had a Homer moment. Not sure why I over complicated it. Well, I had one too as you can see. Quote from: Salmon Trout on January 20, 2012, 05:13:01 AM Well, I had one too as you can see.And me makes us Amigos Three. |
|