working on it ...

Filters

Explore Public Snippets

Sort by

Found 11 snippets

    public by cghersi  2035  1  6  2

    Sign a DLL with a strong name

    In some cases a DLL with strong name is required. If you need a third party library but this is not signed, the only way to avoid this problem is to deassembly and reassembly the DLL. Note: this can cause problems in licensing, so be sure that you are not infringing any license agreement!
    rem from a Developer Command Prompt, 
    rem go in the bin folder of your project, where is the dependent library (not signed).
    rem Assume your project depends on Foo, third party library not signed.
    
    rem 1) Optional, if Foo depends on Foo2, sign all the other dependencies like Foo2:
    ildasm /all /out=Foo2.il Foo2.dll
    ilasm /dll /key=Key.snk Foo2.il 
    
    rem 2) disassembly
    ildasm /all /out=Foo.il Foo.dll
    
    rem 3) Optional, if Foo depends on Foo2, add the new public token to Foo.il
    rem 3.1) Retrieve the public token (e.g. the result of this step will be publictoken=(6B 75 A8 06 B8 60 95 CD )
    sn -Tp Foo2.dll
    
    rem 3.2) Edit Foo.il file, changing
    rem .assembly extern /*23000005*/ Foo2
    rem {
    rem  .ver 2:1:12:0
    rem }
    rem
    rem  to
    rem
    rem .assembly extern /*23000005*/ Foo2
    rem {
    rem  .publickeytoken = (6B 75 A8 06 B8 60 95 CD )                     
    rem  .ver 2:1:12:0
    rem }
    
    rem 4) riassembly
    ilasm /dll /key=Key.snk Foo.il 
    

    public by lbottaro  2655  8  6  2

    How to detect your computer's RAM configuration via cmd prompt

    Using this simple WMI (Windows Management Instrumentation) command you can see how your RAM is configured on your pc. The output shows how many banks are used and their capacity. Output: Microsoft Windows [Version 6.3.9600] (c) 2013 Microsoft Corporation. All rights reserved. C:\wmic MEMORYCHIP get banklabel, devicelocator, caption, capaci
    C:\>wmic MEMORYCHIP get banklabel, devicelocator, caption, capacity

    public by cghersi  21948  168  9  4

    How to run unit tests created with MS Visual Studio without installing Visual Studio

    Do you want to run your unit tests on your staging server? Surely you don't want to make your staging environment "dirty" by installing Visual Studio. I'm also not comfortable with installing the Test Agent. And perhaps you don't have the resources to use Visual Studio Online Continuous Integration stuff... It's not a problem of licenses. We don
    1) From C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow (copy all content of the folder):
    Extensions (folder)
    ActivateApplication.exe
    EntityFramework.dll
    extension.vsixmanifest
    Microsoft.TeamFoundation.TestPlatform.Client.dll
    Microsoft.TestTools.Cpp.targets
    Microsoft.VisualStudio.MSTest.TestWindow.dll
    Microsoft.VisualStudio.TestPlatform.BuildTasks.dll
    Microsoft.VisualStudio.TestPlatform.Client.dll
    Microsoft.VisualStudio.TestPlatform.Common.dll
    Microsoft.VisualStudio.TestPlatform.Core.dll
    Microsoft.VisualStudio.TestPlatform.Fakes.dll
    Microsoft.VisualStudio.TestPlatform.ObjectModel.dll
    Microsoft.VisualStudio.TestPlatform.TestExecutor.Core.dll
    Microsoft.VisualStudio.TestPlatform.Utilities.AppContainer.dll
    Microsoft.VisualStudio.TestPlatform.Utilities.dll
    Microsoft.VisualStudio.TestPlatform.Utilities.PhoneAppContainer.dll
    Microsoft.VisualStudio.TestWindow.Core.dll
    Microsoft.VisualStudio.TestWindow.CppUnitTestExtension.dll
    Microsoft.VisualStudio.TestWindow.dll
    Microsoft.VisualStudio.TestWindow.Interfaces.dll
    Microsoft.VisualStudio.TestWindow.pkgdef
    Microsoft.VisualStudio.TestWindow.VSTest.dll
    msdia120typelib_clr0200.dll
    TestWindowProvideCodeBase.pkgdef
    vstest.console.exe
    vstest.console.exe.config
    vstest.discoveryengine.exe
    vstest.discoveryengine.exe.config
    vstest.discoveryengine.x86.exe
    vstest.discoveryengine.x86.exe.config
    vstest.executionengine.clr20.exe
    vstest.executionengine.clr20.exe.config
    vstest.executionengine.exe
    vstest.executionengine.exe.config
    vstest.executionengine.x86.clr20.exe
    vstest.executionengine.x86.clr20.exe.config
    vstest.executionengine.x86.exe
    vstest.executionengine.x86.exe.config
    
    2) From C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC:
    vcvarsall.bat (put this file into a sufolder named "vc")
    
    3) From C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PrivateAssemblies:
    Microsoft.VisualStudio.QualityTools.Sqm.dll
    
    4) From C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\ReferenceAssemblies\v2.0:
    Microsoft.VisualStudio.QualityTools.ExecutionCommon.dll
    
    5) For these files you need to use copy command from a DOS prompt, and then copy from c:/tmp to your staging folder: 
    copy C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.Resource\12.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.Resource.dll c:\tmp
    copy C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.Common\12.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.Common.dll c:\tmp
    copy C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel\12.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel.dll c:\tmp
    copy C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.UnitTestFramework\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll c:\tmp
    

    public by MatteoP  2604  1  6  1

    Batch merge txt files

    Short batch script to merge the txt file in a folder. The output file initially has a different extension to avoid the instance in which the for loop would find it and add it to itself. (another possible solution to this is making sure the output file is the first alphabetically and does not exist yet, so it is created after the loop has began rea
    @echo off
    for %f in (*.txt) do(
    type "%f" >> output.txx
    echo. >> output.txx
    )
    ren output.txx output.txt   

    public by cghersi  2279  0  5  0

    Update an existing JAR

    This command allows to add to the existing jar all the JAR files in the "folder1" folder
    jar -uf /path/to/myfile.jar folder1/*.jar

    public by cghersi  3204  2  5  0

    Create a JAR without a MANIFEST with jar command

    This is the command to create a jar with an autogenerated manifest.mf
    jar -cvf /home/boss/myfile.jar bin/myrootpackage folder1 folder2

    public by lbottaro  4457  0  7  0

    How to find and remove directories in windows batch command

    The script will search for a given path and returns the name of folders found. The script may remove the directory found (with or without prompt)
    @echo off
    set m_path="C:\Users"
    if exist %m_path% (
    cd %m_path%
    echo FOUND %m_path%
    REM pippo
    for /F %%i in ('dir obj /s /b') do (
    echo "dir %%i"
    REM Remove dir without prompt
    rmdir %%i /s /q
    REM Remove dir with prompt
    REM rmdir %%i /s
    )
    )
    
    pause

    public by cghersi  3241  1  5  0

    BATCH MS-DOS: Simulate network disconnection

    This command can be used to simulate a broken network connection towards a particular IP. In the example, 10.0.2.4 is the IP that we want to break the connection with; 10.0.3.52 is another IP of a physical machine present in the LAN.
    rem break the connection
    route add 10.0.2.4 mask 255.255.255.255 10.0.3.52
    
    rem re-establish the connection
    route delete 10.0.2.4

    public by cghersi  2851  0  6  0

    How to copy a folder and its content in BATCH

    This is the command line used to copy an entire folder named "mySourceDir" into "myDestDir". /i option means "If Source is a directory or contains wildcards and Destination does not exist, xcopy assumes destination specifies a directory name and creates a new directory. Then, xcopy copies all specified files into the new directory. By default, xco
    xcopy F:\mySourceDir C:\myDestDir /E /i /y

    public by mporru  2431  1  6  0

    Batch: save current path then move to the local path of the launched file

    Example: I'm here: C:\bar\ I launch C:\test\foo.bat (either with the full path or double clicking on the batch file). This batch file is made as below. This script will do the following: 1) save the current path 2) change directory to C:\test 3) execute the commands 4) go back to C:\bar\ before quitting
    :: save current path
    pushd .
    
    cd /d %~dp0
    
    REM put here the commands...
    
    
    :: restore original path
    popd
    • Public Snippets
    • Channels Snippets