Create a script to list all the .bat and .cmd files with the dir command &

Hello

Im trying to create a script that will list all the .bat and .cmd files in a specific folder and add the data to a new file (file.txt) - example below:

dir c:\>desktop\file.txt/OD
dir d:\>>desktop\file.txt
dir f:\jobs\*.bat>>desktop\file.txt/OD

IM able to search the F drive and the list of all the .bat files using a generic parameter, but ideally id like to search for .bat and .cmd files, but whenever I have it try does not work. Any ideas?

I tried the following:

dir c:\>desktop\file.txt/OD
dir d:\>>desktop\file.txt
dir f:\jobs\*.bat,*.cmd>>desktop\file.txt/OD

Any help is appreciated, the reason for which I need to check all the .bat and .cmd files is to ensure that the scripts on a cluster are all data, so need them all listed in a doc if possible

Thank you

Hello

Thank you for visiting the Microsoft answers community site. Your question of Windows 7 is more complex than what is generally answered in the Microsoft Answers forums. It is better suited for guys official script Forum. Please ask your question in the official Scripting Guys Forum.

http://social.technet.Microsoft.com/forums/en-us/iTCG/threads

Tags: Windows

Similar Questions

  • Trying to create a script that lists all clusters in a data center

    Hello

    I am trying to create a script that exports a vCenter configuration essentially and imports it in a new vCenter. I want the script to run without specifying a center of data manually. All the scripts I've seen you need to manually enter the data center.

    So, how to do a list of all the data centers with clusters in each of them? I also want to create a variable that contains the groups for the respective data centers. Here's a basic idea of what I want to do:

    $Datacenters = get-data center

    foreach ($Datacenter to $Datacenters)

    {

    $cluster = get-Cluster-location $Datacenter

    Write-Host "list of clusters in $Datacenters.

    Write-Host "$Cluster".

    }

    Who will give me the output like this:

    List cluster Datacenter1

    cluster2 CLUSTER1

    List cluster Datacenter2

    cluster3 cluster4

    But I don't know how I can get so I have variable like this:

    $datacenter1 = cluster1, cluster2

    $datacenter2 = cluster3, cluster4

    Did you mean something like this?

    Get-data center | %{

    New-Variable - Name $_. Name - value ([string]: join ("," (Get-Cluster-location $_ | % {$_.}))) Name})))

    }

  • Script to list all the VMS and their scsi controller

    Hey guys,.

    New to scripting and my boss is looking for me to get a list of all the vm in our environment and the type of scsi controller they have. It seeks to go to paravirtual controller and need to know what vm, he needs to hit. I saw there is a script to change the paravirtual but he won't do it again, just the list including vm has what. Any help would be greatly appreciated.

    Thank you

    Rich

    Something like that?

    Get-VM | Select Name,@{N="Controller Type";E={Get-ScsiController -VM $_ | Select -ExpandProperty Type}}
    
  • PowerCLI script to list all the material

    Greetings,

    I'm looking for a script that will display all the material parameters for disk including my vm, USB, series and parallel ports, etc...

    Found this script for serial ports:

    $vms = get - VM

    {foreach ($vm to $vms)

    Notice-EEG - ViewType VirtualMachine. %{

    if($_.) Config.Hardware.Device | where {$_.} GetType(). Name - eq

    {'VirtualSerialPort'})

    $_. Name

    }

    }

    }

    However how to change it for all material or I need to specify each potential device?  How can I get a list of options, for example, where I find that 'VirtualSerialPort' is an option?

    Also how I got out to a csv file.

    Try this

    Get-View -ViewType VirtualMachine | %{
         $vm = $_
         $_.Config.Hardware.Device | Select @{N="VM name";E={$vm.Name}},@{N="HW name";E={$_.GetType().Name}},@{N="Label";E={$_.DeviceInfo.Label}}
    } | Export-Csv "C:\VM-HW.csv" -NoTypeInformation
    

    ____________

    Blog: LucD notes

    Twitter: lucd22

  • PowerCLI script to list all the streams

    Hello

    Want to know if there is a way to list all inbound and outbound connections with IP and port of a vcenter infrastructure.

    Try it with scale and dvs but looks delicate, as navigator of Vmware infrastructure can perhaps do.

    But for sure, I think we can do it with powercli just want to confirm if there already exists.

    Thank you!

    Hello

    Check if that shell commands can help you

    https://KB.VMware.com/kb/2051814

    https://KB.VMware.com/kb/2020669

    Or with (command shell and PowerCli)

    http://technodrone.blogspot.com/2011/09/netstat-for-ESXi.html

    I hope this can help

  • How to create a value to select all the dashboard command prompt values

    Dear Sir/Madam,
    OBIEE version is 10g.
    I create a dashboard promt to act as a filter option. It includes all the values in the target column. I wonder how to add value to this prompt to select all of the values in this column?

    For example:
    Table has a column 'product '. Total of 3 values in this column: "product produced b","", "product c '. When I create a dashboard command prompt to include all the choice of 'product '.
    Show sql result: I press "select A product".
    Ok. This message now includes "product produced b","", "product c ' fall down meun. But the problem also. If the user wants to choose all the values in this column? How he/she can do that? I would also add a value 'All products' to include ' product produced b "," "," product c "drop menu drop-down. If the user choose this option. Displays all the results of the product?
    Thank you.

    June wrote:
    I'm sorry that I have no idea about this idea.
    Do you mean the dash prompt has a functional to the list of the values of all options as check boxes? Please would you give me a simple example if you are convenient?
    Thanks anyway.

    When you create the dashboard, as David T say, simply leave the values at all rather than send the SQL query. This will give you the list of all values for the prompt. When the user wants to run the report with all values, it will need check all the boxes in the list, to get the report with all products.

    Kind regards
    -Laurence.

  • Script to list all the warehouses of data in a cluster, the virtual machines on the data store and the host of the virtual machine is on

    We have warehouses of data which are seen by more than one cluster. I need a script that will display:

    all stores of data seen by a cluster

    the virtual machines on the data store

    the host of the virtual machine is on

    the cluster the host is in

    The output I want is

    name of the store of data, the VM name, host name, the name of the Cluster

    any help would be appreciated

    Pretty sure this will do what you need:

    $report = @()
    Foreach($cluster in Get-Cluster){
        $datastores = $cluster | Get-VMHost | Get-Datastore
        foreach($datastore in $datastores){
        $vms = $datastore | Get-VM
        If ($vms.count -ge 1){
            foreach($VM in $vms){
            $object = New-Object -TypeName PSObject -Property @{
                  Datastore = $datastore.Name
                  VM = $VM.Name
                  HostName = $VM.VMhost
                  Cluster = $cluster
                }
            $report += $object
            }
    
        }
        }
    }
    $report | Export-Csv C:\Temp\VMs.csv -NoTypeInformation -UseCulture
    

    If you only want to shared data warehouses you can then use

    $datastores = $cluster | Get-VMHost | Get-Datastore | Where {$_.Extensiondata.Summary.MultipleHostAccess -eq $True}
    

    Hope this helps

  • I need a script to perform a specific action and save file with the SAME name of document .jpg

    I have all my PSD master files registered as follows: mydocument_PSD.psd. I want to run a custom action to sharpening and then save the file as mydocument.jpg (note the part "_PSD" should be removed).

    I found this Photoshop-export-PSD-script/Export - PSD.jsx to edwardloveall/Photoshop-export-PSD-script master · · GitHub that gets me close to there, but that's a png and is the name of the document to the right and there is no action ran.

    Any ideas?

    This gives a try...

    #target photoshop;   
    
    main();
    function main(){
    if(!documents.length) return;
    try{
        var path = activeDocument.path;
        }catch(e){
            alert("This document has not been saved");
            return;
            }
    if(activeDocument.name.toString().toLowerCase().search(/_psd\.psd$/) == -1){
        alert("Filename is not in the correct format");
        return;
        }
    var fileName = activeDocument.name.toString().match(/[^_]*/);
    var savedState = activeDocument.activeHistoryState;
    doAction("savelarge","Action Set");
    //////////////////////////////////////////////////////////////////////
    SaveJPEG(File(path + "/" + fileName + "_large.jpg"),10);
    activeDocument.activeHistoryState = savedState;
    savedState = activeDocument.activeHistoryState;
    doAction("savesmall","Action Set");
    //////////////////////////////////////////////////////////////////////
    SaveJPEG(File(path + "/" + fileName + "_small.jpg"),10);
    activeDocument.activeHistoryState = savedState;
    };
    function SaveJPEG(saveFile, jpegQuality){
    jpgSaveOptions = new JPEGSaveOptions();
    jpgSaveOptions.embedColorProfile = true;
    jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
    jpgSaveOptions.matte = MatteType.NONE;
    jpgSaveOptions.quality = jpegQuality;
    activeDocument.saveAs(saveFile, jpgSaveOptions, true,Extension.LOWERCASE);
    };
    
  • How to list all the files in a backup job?

    User GreyGnome:

    I would like to get a list of all the files on a file system backup task. Is this possible?

    Through the CLI, if possible. On Linux.

    Thank you.

    Posted by AdrianMoir

    Hi GreyGnome,

    You can actually set this via the user interface on the backup options for employment. See attached picture.

    This will allow you to define a path and file name of a text file that lists all the files that are backed up by work, when the work is performed.

    Once the option set is saved under a name, if you create jobs through the CLI, with nvjobcreate, you can specify the selectionoptionsetname - , by using the name of the set option that you created with the entry 'Path to Backup Log'.

    The text file will display the name of the file in the following attributes...

    Backup Path, State, Type, size (bytes), Timestamp, attributes.

    Thank you very much

    Adrian.

  • Need a PowerShell Script to list all my stores of data, capacity and VMFS format.

    All,

    I need a script to list all my stores of data, capacity and VMFS format.

    That's what I have so far but its does not give me the results I need.

    Get-Datastore - Datacenter MN_PROD | where {$_.} Type - eq "VMFS"} | Select-Object Name,@{N="VMFS version. {E = {$_.Info.Vmfs.Version}}

    Try like this

    Get-Datastore -Datacenter MN_PROD | where {$_.Type -eq "VMFS"} | Select-Object Name,CapacityGB,    @{N="VMFS version";E={$_.FileSystemVersion}}
    
  • How to create a script which gives all depedencies an object in 11g

    How to create a script which gives all depedencies an object in 11g

    You can use dba_dependencies for this... go through the manual.

    I don't know in this thread, someone will come up with the query for you, but there is another approach is:

    in sqlplus:

    SET SERVEROUTPUT ON SIZE 1000000
    EXEC  dbms_utility. get_dependency ('TABLE','SCOTT','EMP');   -- object_type,user,tablename as parameters
    

    See you soon,.
    Manik.

  • How to list all the system user directories?

    Hi all


    last month I create the directory for export (data pump). The problem is that I didn't put it in the documentation. I would like to know how I can list all directories (granted and which are created in sqlplus) by simply using the sql statement.

    Is there any command for this SELECT * FROM ALL_USERS?;



    would be great if someone can help me

    easy:
    SELECT * from all_directories

    HTH, Urs

  • y at - it a web page that lists all the supported versions of Firefox?

    We wish to state our user doc recommended Firefox versions. So it is the web page that lists all the supported versions of Firefox and can also, we have a list of dates to drop support for versions currently supported?

    Yes, it has changed a bit since this thread was started 9 months ago. Support for Firefox 3.6.x continues and versions 4 + lose support at the next new version is available. Support for Firefox 7 ended when Firefox 8 came out yesterday 11 / 08.

    Support for 3.6.x will likely end early next year when the proposed new ESR (Extended Support Release) comes to massive institutional facilities / corporate. ESR is proposed for a week 42 version support cycle timetable of a 'standard' of the week quick release 6.

  • List all the songs?

    Hi, I have a quick beginner question:

    I just finished all my music on my new SanDisk Sansa clip + loading, and I've encountered a problem. In the individual sections for each of the artists, there seems to be no way to list all of the songs from this particular artist in my library. Instead, there are only folders for each album and the "Play All" option. Now if I want to play a song in particular of this artist, I have to go to the respective album folder and select the song. It works fine if I remember the album for every song I want to play, but if I don't remember, I go through each folder.

    What I saw before with portable mp3 players is a way to list all of the songs from a particular artist in alphabetical order, regardless of the album sound in. Is it possible to do this with my device? I've been looking in the menus on the camera itself and on this forum, but so far without success.

    Thank you!

    You can see all the songs by an artist when choosing the artist, play together, and then pressing the button at 6 oclock and choosing back to the music list. The song list will however in alphabetical order. They will be in order, based on the album order, IE. first albumm 1 (based on the number of track), the song2 song, song 3,... Finally, the second song on the album 1, 2, song etc.

    Would be nice if they could be presented in alphabetical order. I guess as a workaround you could try to put all the songs by an artist in one folder, then by browsing the folder using music files. Lists all the songs by an artist alphabetically (asuming the file name is the name of the song). I guess this could become unmanigable but when you have a large number of songs of an artist. Having too many songs in a single folder can bog down the player.

  • How to display this window that lists all the devices of storage connected to my PC?

    How to display this window that lists all the devices of storage connected to my PC? It lists each device, how much space is used and how much is free? I sometimes open it by accident, but I can never find it when I'm looking for it.

    original title: storage devices

    Beginning

    Control Panel

    If you the small icons view do the following:

    Administration tools

    Computer management

    Storage

    Disk Managment

    If you have the category view do the following:

    System and security

    Administration tools

    Computer management

    Storage

    Disk management

Maybe you are looking for