CMD. EXE: IS IT POSSIBLE TO USE TWO COMMANDS INSIDE OF THE COMMAND CMD 'FOR '?

HAY EVERYONE.
I WROTE A PROGRAM TO CMD. EXE.
AND I WANT TO SET A VARIABLE TO THE NUMBER OF FILES PRESENT IN A DIRECTORY.
THE PROBLEM IS THAT I DON'T KNOW HOW TO USE THE TWO COMMANDS INSIDE OF THE COMMAND.
HERE IS THE EXAMPLE OF MY PROBLEM INSIDE THE BAT FILE:

OFF @ECHO
FOR /F %%D IN (' DIR/W/D / N / L ' "C:\WINDOWS\SYSTEM32\*." ") DLL | TROUVER/C/I/N 'B' ') SET FILES_NUMBER = % Y
ECHO: % FILES_NUMBER %
BREAK
OUTPUT

I EXPECT THAT THIS PROGRAM WAS TELLING ME HOW MANY DLL FILES THAT BEGIN WITH THE LETTER B, I HAVE IN MY SYSTEM32 DIRECTORY.
HOWEVER, THIS PROGRAM HAVE A MISTAKE DURING ORDERING.

| WAS NOT PLANNED AT THIS TIME.

"WHEN I USE IT JUST COMMAND DIR/W/D O:N: C ' C:\WINDOWS\SYSTEM32\*. "DLL" | " FIND/C/I/N "B" WITHOUT THE FOR ORDER THIS ORDER WRITE A NUMBER ON THE SCREEN. THE NUMBER OF DLL FILES THAT BEGIN WITH THE LETTER B IN MY SYSTEM32 DIRECTORY.
IF THESE TWO COMMANDS (DIR AND FIND) COMBINED ALL WORK OK.

BUT I WANT TO REDIRECT THE OUTPUT OF THESE COMMANDS IN A VARIABLE. FOR THIS I USE THE COMMAND FOR.

WHEN I USE JUST A COMMAND INSIDE THE ORDER, HE DIDN'T THERE WAS NO ERROR.
BUT WHEN I USE PIPES, A MISTAKE SE PRODUCT.

SO, MY QUESTION IS: HOW TO USE TWO COMMANDS INSIDE OF COMMAND? OR HOW TO USE A PIPE TO COMMAND INSIDE.

YBY

A slightly different method, but will set the Files_Number variable to what you want:

Off @Echo
C:
cd\Windows\System32
Dir B *. DLL | FindStr.Exe 'File (s)' > Temp.Txt
FOR /F "Tokens = 1-4" %% IN (Temp.Txt) Set Files_Number = %% a
Echo number of records Files_Number is %

Note: You can add a Temp.Txt DEL if you want, but it is not necessary because the > causes the replaced every time that you run this. (If we had used > as our redirector, it adds to the Temp.Txt file, which we don't want.)

In addition, when you use the / w with the DIR command that calls the large format so you get 1 account per line regardless of the number of files has the letter B in them. Also, your search for the letter B in each line through FIND counted the Bs if they're the first letter.

My method deliberately DIRs for only these DLLs that begins with the letter B. FindStr allows us to give us only the row that contains the number of files. In the FOR-IN-DO we know that this line will have four elements of the text, so we settled our chips to 1-4. They will be placed in temporary variables a, b, c & d.

Given that the actual number of files, that's what we want, we have Files_Number = %% a.  Had we wanted to know the total number of bytes of the file, WE Set Total_Bytes = % c.

You can do both if you want to do like this:

Off @Echo
C:
cd\Windows\System32
Dir B *. DLL | FindStr.Exe 'File (s)' > Temp.Txt
FOR /F "Tokens = 1-4" %% IN (Temp.Txt) Set Files_Number = %% a
FOR /F "Tokens = 1-4" %% IN (Temp.Txt) define Total_Bytes = %% c
Echo number of records Files_Number is %
Echo Total number of bytes is Total_Bytes % %

Tags: Windows

Similar Questions

  • Is it possible to use two different computers with the same adobe - ID and the same adobe license?

    Is it possible to use two different computers with the same adobe - ID and the same adobe license?

    Hi Morten,

    Yes, you can have your subscription or your license installed on two different computers with the same adobe id, however use one at a time.

    Please let us know if you have any questions, more about it.

  • Is it possible to use iCloud shares photos with the two opening and Photos at the same time?

    Is it possible to use iCloud shares photos with the two opening and Photos at the same time?

    Non - PEAK is not a feature of iPhoto or Aperture - this is new with Photos

    LN

  • How to use two different versions of the stub of Web Services SDK files in a single project (5.5 and 6.0)

    Hello

    I have a project that uses the vSphere 5.5 management SDK (I built the stub files according to the documentation) and have these in my c# Solution. Everything works beautifully. My class files that interact with vSphere all have a use statement as follows:

    using Vim25Api;

    All fine so far.

    Now, I want to be able to provide support for a user to connect to vSphere 5.5 and 6.0 vSphere environments. I built the stub files for vSphere Management 6.0 SDK and those in my solution presented in a separate project. Each project is based on a different class library and I have each set of files for each version of vSphere stub in different NuGet packages. However, when I select to use a vSphere 5.5 connection, it seems that internally the 6.0 files stub are used, or vice versa.

    I tried to separate things out by giving the Vim25Service.dll and Vim25Service.XmlSerializers.dll files for each version of alias names (alias by default for all assemblies is "global", but I changed it to vSphere5 and vSphere6 for each version. Then at the top of each class file before all with what I'm doing:

    extern alias vSphere5;

    or

    extern alias vSphere6

    (According to what project I'm in). Then, use the using statement for each class file that interacts with vSphere using vSphere5::Vim25Api; or using vSphere6::Vim25Api; to use the files to correct/stub namespace for each version I support.

    However this still doesn't seem to work, and things seem to be getting confused upwards somehow. I take a guess that internal files make calls and somehow have crossed.

    Is it possible to use two stub version of vSphere together different files in the same project? How should I handle my script? I thought of just upgrading to use the version of vSphere 6 (I can always connect to vCenter 5.5 using these, but some of the properties on the object have changed, (for example some dynamic properties on AlarmObjects and other items have been removed and code breaks if I delete the references to the stub vSphere 5.5 files.) So, I want to keep two different versions and use each of them separately in the same solution, so I support vSphere 5.5 and vSphere 6.

    Solved - this using wsdl.exe and just by specifying a different namespace to use in the proxy class that is generated by using the /n switch.

    for example using PowerShell to build automatically, the value $VimApi and do:

    WSDL.exe/n:$ VimApi...

  • Is it possible to use < af:message > to display the validation model adf instead of the default note window

    For any component input, validation that we created at the level of the entities attribute are executed and if any validation fails, the messge is displayed in a window of default note on the component of the.

    Is it possible to use < af:message > to display the validation model adf instead of the window of default note for the corresponding component in a fragemnt jsff page?

    I use JDev 11.1.1.6.0.

    Thank you

    Jean Bayard

    Michelle,

    I have good news. I was able to reproduce, locate and bypass your problem.

    The problem is the following:

    works very well in JSF pages, but it does not work in JSF fragments (which are part of a glued TaskFlow, what is included in a page parent as a ) because ADF when executing a miscalculation of the value of of 'for' - attribute when it is part of a region BTF. For example, suppose that the has id = "it1" (as it is in your JSF fragment above) and this TaskFlow defined in included as a with id = "r1" in a parent page. Then the internal ID of the input text field will be 'r1:0:it1', but at runtime, the framework will set the value of 'for' - attribute to the 'r1:it1' (which is wrong) instead of "r1:0:it1" (which is the correct value).

    You can work around this bug by specifying:

    Instead of

    in your code above. In this way the framework will make up the correct value for the 'for' - attribute at run time and will not work correctly. Don't worry the caveat against a non-existent ID in the JDev source code editor.

    You must do this trick only in fragments JSF and you should not do in JSF pages.

    Dimitar

  • is it possible to fill two paths opened by the pen tool and the two paths open close the other?

    is it possible to fill two paths opened by the pen tool and the two paths open close the other?

    You should find the forum for any product it is and post your questions there.

    Here is a link to a page that provides links to all of the Adobe forums...

    The Forum links page: https://forums.adobe.com/welcome

  • Is it possible to use Dreamweaver with WordPress (has the classes by Joseph Lowery) only uses a test server AWS and not an environment local localhost?

    Is it possible to use Dreamweaver with WordPress (has the classes by Joseph Lowery) only uses a test server AWS and not an environment local localhost?

    Yes, I want to talk and EC2 instance and I am able to do Dreamweaver to easily connect using SFTP which I believe is a SSH protocol. See the image below. This method works.

    I currently have a test instance and will finally have an instance of production when the site is finished.

    Local environment is not installed on my workstation and my thought was that put it on the server would allow transparent operation including scripts on the server side. The testing station is not public.

  • EMail address added to &lt; &lt; my device name &gt; &gt; &lt; &lt; my device name &gt; &gt; now using &lt; &lt; my mailadress (identical to the Apple ID) &gt; &gt; for FaceTime and IMessage.

    My iPod touch get now and then next alert message due to change on my iPhone.

    EMail address added to < < my device name > > < < my device name > > now using < < my mailadress (identical to the Apple ID) > > for FaceTime and iMessage.

    Why I get this message? iPhone is disabled due to my work offshore for two weeks, but the use of the iPod touch is allowed.

    What is my apple ID used on other devices with the same name as my iPhone?

    I would be happy if anyone has an explanation of why I feel this strange behavior.

    When you connect to FaceTime or Messages on another device, another peripheral other device using this same ID will get the message that has been signed to. Some iOS (and OSX) update log for other devices will get the message when that happens.

    You said "by reason of change on my iPhone"

    What has changed on the iPhone?

  • Is it possible to edit Firefox context menu to the standard address for the displayed Web pages?

    Is it possible to edit Firefox context menu to the standard address for the displayed Web pages? Often, I want to save an image on a page. Sometimes I "slip" and press "Send Image" when I want to "Save Image under" and sit and wait for the default page - send an email to come, then shut up, juggling its dialog boxes "are you sure". It is a way of trying to manage a blunder. Basically I want an element directly from a page by email. Is it possible that I can simply remove "Send Image" from the context menu?

    It is possible with the Menu Editor extension:

    https://addons.Mozilla.org/en-us/Firefox/addon/710

  • is it possible to use two external LDAP and authentication of external Table?

    Hi, is it possible to use both external LDAP and authentication of the external table?

    they all need two initialization blocks to access a session system variable, USER?

    Thank you

    Hello
    I don't think it's possible to impliment the LDAP authentication both extenal together. The reasons are,
    1. we cannot define two sources (LDAP and Extenal DB) in the same blocks of justine initialization user information.
    2. If two different (one for LDAP) initialization blocks and one for extenal DB are used, we cannot use variable USER twice it's a defined system variable.

    Thank you
    Swami

  • I have a late model Intel iMac. Is it possible to have two browsers Firefox at the same time? Currently, I have Safari and Firefox. I prefer Firefox. Thank you!

    I have an Intel iMac. I use Safari 5.0.5 and Firefox 9.0.1. I would use two browsers Firefox, is it possible? With Firefox, I'm not followed. I like my privacy! I followed with Safari. I have a new app called 'Cookie', and I discovered how rampant the follow-up is with Safari. What happened to privacy? Is this too much to have a little bit of life private? In any case, thanks!

    JPVG78

    See also:

  • Can I use two hard drives in the Qosmio G40-10th

    Anyone know if it is possible to install two hard drives in this laptop. I read simewhere that it had to be two slots hard drive in it?
    If so where is it located?
    Ther would be all issues around extra heat that could be generated etc.?

    I have had mine for about 5/6 months and have had a screen replaced (defective backlight).
    Many other people have had problems?

    I wonder if its worth buy the extended warranty.

    See you soon.
    Sunil

    Hello

    As far as I know this laptop takes support only a single HARD disk.
    Check the underside of the laptop. Do you see a second slot (cover) the second HDD?
    I imagine that it has a single HARD drive Bay, and so only a single HARD disk can be used.

    I m not a G40 owner and, therefore, I cannot comment on any other issue.
    But each computer technology may start to malfunction it is why I always recommend buying an extended warranty.

    Best regards

  • How to run two 'County of buffered edge' using two different counters at the same time?

    Hello

    I try to use two counters at the same time count the TTL pulses for a fixed period (lets say 10 ms). I have the card PCI-6251 and PCI-6601. I am currently using PCI 6601 as counters and running a self updated the ' stamped edge County - reset.VI. Here, I have attached my VI.

    Now, during the execution of this VI, I get an error saying "error-200251 occurred at Task.vi:4 DAQmx Start" and the possible reasons are, "measures: no USB or DMA channels in loose ends are available.»

    Either stop other tasks which might be using these resources or are considering changing your mechanism for transfer of data to the interruptions if supported.

    Device: Dev2

    Task name: _unnamedTask<80>. »

    What I realized is I'm trying to use two buffers for two meters with ten samples each and this is probably not allowed. I don't know how to solve this out and bad looking for your suggestions.

    Thanks in advance.

    Hi all

    I found a solution too. This is the VI updated the "County of edge stamped" which can simultaneously run two entries-meter using a single source of door and it also uses the DMA and interrupts to save two pads.

    Have a nice weekend.

  • Double desktop screen "stacked" on first office on a single monitor after using two monitors Netflix to the TV

    Double "stacked" on first desktop on one monitor - desktop screen came just after using two monitors (Netflix on TV extended

    My computer kept crashing after I had hung a dual monitor.  The second monitor was my television, playing a Netflix movie while I also used my computer to work on.  After splitting the two, I kept crashing for a few days.  I tried to delete the second monitor in the display settings, but does not know how to do this, if it's possible, but I think it's the problem and the cause of the double view of the desktop on my computer now.

    Does anyone know how to confirm what the problem is for some, and/or instructions how to solve this problem if you already know what can cause this problem.  No assistance at all would be greatly appreciated.  I tried to understand this two days...

    Note, in the heat of the Las Vegas area, I thought this may be due to overheating, but I actually he cooled in the refrigerator for a short time and restarted, but still have the problem.  Thank you.

    You have a Nvidia 8600 M GS graphics chip located on the motherboard, the drivers for it are provided by your manufacturer, HP, PC-specific to your model and NOT of the site MSUpdate or Nvidia.

    http://www.nvidia.com/object/notebook-Win7-WinVista-258.96-WHQL-driver.html see the following"However, please note that your notebook original equipment manufacturer (OEM) provides certified for your mobile drivers specific to their Web site. NVIDIA recommend you check with your OEM laptop on the software updates recommended for your laptop. The OEM cannot stipulate support technical issues raised by the use of this driver. »

    Since you apperently have a laptop / Notebook, you get all pilots that manufacturers of PC and NOT of MSUpdate site system. Driver version numbers shown on the MSUpdate site cannot be relied on as correct

  • Is it possible to use "recently closed" tabs in the new firefox without a mouse?

    In the old firefox, you had the option of clicking ONCE in the upper left corner and then using the arrow keys to navigate the menu of recently closed tabs, extremely fast and go to the tab you want. Now you klick three times, and you have to search the history button because there is no list more, and there is no possibility of using the arrow keys. Is it possible to use the arrow keys on the keyboard as before or is there anyway of downgrading my version to the old version of firefox?

    You can also access this data via the menu of tory His(Alt + S)

    • Press the ALT key, or press F10 to display the Menu bar.

Maybe you are looking for