How to execute a Batchfile in a folder, by dropping the folder on the file











up vote
0
down vote

favorite












I have a small batch file that executes a few simple lines of code.



It works perfectly fine when I put it in the Folder and execute it.



However the file should be located on level above it and be able to get executed by having the folder being droped on to it.



When I currently drop the folder on to it, it just executes the code as if I would just double click it. However it should behave as if the file was located inside the folder.



@echo off

for %%a in (*.*) do @echo %%~na >> filenames.txt
)

pause


How would I do that?



I don't want to apply it to every folder just the one chosen by dropping it onto the file.



I want to generate a file from all the filenames inside the Folder.



which will then be compared to an other file created from an other folder.



@echo off
echo new additions > test3.txt
findstr /vixg:shots.txt shots2.txt >> test3.txt
echo removed >> test3.txt
findstr /vixg:shots2.txt shots.txt >> test3.txt


I assume I can|t automate the comparison, by dropping two folders onto the file, can I?










share|improve this question
























  • So.. how about posting the code of your batch file so we can see it and actually help you?
    – Gerhard Barnard
    Nov 8 at 11:35










  • thanks for the imput
    – Frezzley
    Nov 8 at 11:42










  • When dropping elements on another batch/script/exe they get passed as command line arguments, receivable in batch with %1 to %9 (or as %1 and looped with a shift in between). So it is possible, but you show fixed file names and expect ever changing file/folder names to be accessed how?
    – LotPings
    Nov 8 at 11:59

















up vote
0
down vote

favorite












I have a small batch file that executes a few simple lines of code.



It works perfectly fine when I put it in the Folder and execute it.



However the file should be located on level above it and be able to get executed by having the folder being droped on to it.



When I currently drop the folder on to it, it just executes the code as if I would just double click it. However it should behave as if the file was located inside the folder.



@echo off

for %%a in (*.*) do @echo %%~na >> filenames.txt
)

pause


How would I do that?



I don't want to apply it to every folder just the one chosen by dropping it onto the file.



I want to generate a file from all the filenames inside the Folder.



which will then be compared to an other file created from an other folder.



@echo off
echo new additions > test3.txt
findstr /vixg:shots.txt shots2.txt >> test3.txt
echo removed >> test3.txt
findstr /vixg:shots2.txt shots.txt >> test3.txt


I assume I can|t automate the comparison, by dropping two folders onto the file, can I?










share|improve this question
























  • So.. how about posting the code of your batch file so we can see it and actually help you?
    – Gerhard Barnard
    Nov 8 at 11:35










  • thanks for the imput
    – Frezzley
    Nov 8 at 11:42










  • When dropping elements on another batch/script/exe they get passed as command line arguments, receivable in batch with %1 to %9 (or as %1 and looped with a shift in between). So it is possible, but you show fixed file names and expect ever changing file/folder names to be accessed how?
    – LotPings
    Nov 8 at 11:59















up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have a small batch file that executes a few simple lines of code.



It works perfectly fine when I put it in the Folder and execute it.



However the file should be located on level above it and be able to get executed by having the folder being droped on to it.



When I currently drop the folder on to it, it just executes the code as if I would just double click it. However it should behave as if the file was located inside the folder.



@echo off

for %%a in (*.*) do @echo %%~na >> filenames.txt
)

pause


How would I do that?



I don't want to apply it to every folder just the one chosen by dropping it onto the file.



I want to generate a file from all the filenames inside the Folder.



which will then be compared to an other file created from an other folder.



@echo off
echo new additions > test3.txt
findstr /vixg:shots.txt shots2.txt >> test3.txt
echo removed >> test3.txt
findstr /vixg:shots2.txt shots.txt >> test3.txt


I assume I can|t automate the comparison, by dropping two folders onto the file, can I?










share|improve this question















I have a small batch file that executes a few simple lines of code.



It works perfectly fine when I put it in the Folder and execute it.



However the file should be located on level above it and be able to get executed by having the folder being droped on to it.



When I currently drop the folder on to it, it just executes the code as if I would just double click it. However it should behave as if the file was located inside the folder.



@echo off

for %%a in (*.*) do @echo %%~na >> filenames.txt
)

pause


How would I do that?



I don't want to apply it to every folder just the one chosen by dropping it onto the file.



I want to generate a file from all the filenames inside the Folder.



which will then be compared to an other file created from an other folder.



@echo off
echo new additions > test3.txt
findstr /vixg:shots.txt shots2.txt >> test3.txt
echo removed >> test3.txt
findstr /vixg:shots2.txt shots.txt >> test3.txt


I assume I can|t automate the comparison, by dropping two folders onto the file, can I?







batch-file






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 8 at 11:42

























asked Nov 8 at 11:19









Frezzley

125112




125112












  • So.. how about posting the code of your batch file so we can see it and actually help you?
    – Gerhard Barnard
    Nov 8 at 11:35










  • thanks for the imput
    – Frezzley
    Nov 8 at 11:42










  • When dropping elements on another batch/script/exe they get passed as command line arguments, receivable in batch with %1 to %9 (or as %1 and looped with a shift in between). So it is possible, but you show fixed file names and expect ever changing file/folder names to be accessed how?
    – LotPings
    Nov 8 at 11:59




















  • So.. how about posting the code of your batch file so we can see it and actually help you?
    – Gerhard Barnard
    Nov 8 at 11:35










  • thanks for the imput
    – Frezzley
    Nov 8 at 11:42










  • When dropping elements on another batch/script/exe they get passed as command line arguments, receivable in batch with %1 to %9 (or as %1 and looped with a shift in between). So it is possible, but you show fixed file names and expect ever changing file/folder names to be accessed how?
    – LotPings
    Nov 8 at 11:59


















So.. how about posting the code of your batch file so we can see it and actually help you?
– Gerhard Barnard
Nov 8 at 11:35




So.. how about posting the code of your batch file so we can see it and actually help you?
– Gerhard Barnard
Nov 8 at 11:35












thanks for the imput
– Frezzley
Nov 8 at 11:42




thanks for the imput
– Frezzley
Nov 8 at 11:42












When dropping elements on another batch/script/exe they get passed as command line arguments, receivable in batch with %1 to %9 (or as %1 and looped with a shift in between). So it is possible, but you show fixed file names and expect ever changing file/folder names to be accessed how?
– LotPings
Nov 8 at 11:59






When dropping elements on another batch/script/exe they get passed as command line arguments, receivable in batch with %1 to %9 (or as %1 and looped with a shift in between). So it is possible, but you show fixed file names and expect ever changing file/folder names to be accessed how?
– LotPings
Nov 8 at 11:59














1 Answer
1






active

oldest

votes

















up vote
1
down vote













I am not 100% sure what you want, but I am assuming you want to match shots.txt which is in folder1 with shots2.txt in folder2. Something like this should work if that is the case:



@echo off
echo new additions > test3.txt
if exist "%1shots.txt" (findstr /vixg:"%1shots.txt" "%2shots2.txt" >> test3.txt)
if exist "%2shots.txt" (findstr /vixg:"%2shots.txt" "%1shots2.txt" >> test3.txt)
echo removed >> test3.txt
if exist "%1shots2.txt" (findstr /vixg:"%1shots2.txt" "%2shots.txt" >> test3.txt)
if exist "%2shots.txt" (findstr /vixg:"%2shots2.txt" "%1shots.txt" >> test3.txt)


You can then select 2 folders containing the files and drop them both onto the batch file.






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53206708%2fhow-to-execute-a-batchfile-in-a-folder-by-dropping-the-folder-on-the-file%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote













    I am not 100% sure what you want, but I am assuming you want to match shots.txt which is in folder1 with shots2.txt in folder2. Something like this should work if that is the case:



    @echo off
    echo new additions > test3.txt
    if exist "%1shots.txt" (findstr /vixg:"%1shots.txt" "%2shots2.txt" >> test3.txt)
    if exist "%2shots.txt" (findstr /vixg:"%2shots.txt" "%1shots2.txt" >> test3.txt)
    echo removed >> test3.txt
    if exist "%1shots2.txt" (findstr /vixg:"%1shots2.txt" "%2shots.txt" >> test3.txt)
    if exist "%2shots.txt" (findstr /vixg:"%2shots2.txt" "%1shots.txt" >> test3.txt)


    You can then select 2 folders containing the files and drop them both onto the batch file.






    share|improve this answer

























      up vote
      1
      down vote













      I am not 100% sure what you want, but I am assuming you want to match shots.txt which is in folder1 with shots2.txt in folder2. Something like this should work if that is the case:



      @echo off
      echo new additions > test3.txt
      if exist "%1shots.txt" (findstr /vixg:"%1shots.txt" "%2shots2.txt" >> test3.txt)
      if exist "%2shots.txt" (findstr /vixg:"%2shots.txt" "%1shots2.txt" >> test3.txt)
      echo removed >> test3.txt
      if exist "%1shots2.txt" (findstr /vixg:"%1shots2.txt" "%2shots.txt" >> test3.txt)
      if exist "%2shots.txt" (findstr /vixg:"%2shots2.txt" "%1shots.txt" >> test3.txt)


      You can then select 2 folders containing the files and drop them both onto the batch file.






      share|improve this answer























        up vote
        1
        down vote










        up vote
        1
        down vote









        I am not 100% sure what you want, but I am assuming you want to match shots.txt which is in folder1 with shots2.txt in folder2. Something like this should work if that is the case:



        @echo off
        echo new additions > test3.txt
        if exist "%1shots.txt" (findstr /vixg:"%1shots.txt" "%2shots2.txt" >> test3.txt)
        if exist "%2shots.txt" (findstr /vixg:"%2shots.txt" "%1shots2.txt" >> test3.txt)
        echo removed >> test3.txt
        if exist "%1shots2.txt" (findstr /vixg:"%1shots2.txt" "%2shots.txt" >> test3.txt)
        if exist "%2shots.txt" (findstr /vixg:"%2shots2.txt" "%1shots.txt" >> test3.txt)


        You can then select 2 folders containing the files and drop them both onto the batch file.






        share|improve this answer












        I am not 100% sure what you want, but I am assuming you want to match shots.txt which is in folder1 with shots2.txt in folder2. Something like this should work if that is the case:



        @echo off
        echo new additions > test3.txt
        if exist "%1shots.txt" (findstr /vixg:"%1shots.txt" "%2shots2.txt" >> test3.txt)
        if exist "%2shots.txt" (findstr /vixg:"%2shots.txt" "%1shots2.txt" >> test3.txt)
        echo removed >> test3.txt
        if exist "%1shots2.txt" (findstr /vixg:"%1shots2.txt" "%2shots.txt" >> test3.txt)
        if exist "%2shots.txt" (findstr /vixg:"%2shots2.txt" "%1shots.txt" >> test3.txt)


        You can then select 2 folders containing the files and drop them both onto the batch file.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 8 at 12:40









        Gerhard Barnard

        6,45531130




        6,45531130






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53206708%2fhow-to-execute-a-batchfile-in-a-folder-by-dropping-the-folder-on-the-file%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            鏡平學校

            ꓛꓣだゔៀៅຸ໢ທຮ໕໒ ,ໂ'໥໓າ໼ឨឲ៵៭ៈゎゔit''䖳𥁄卿' ☨₤₨こゎもょの;ꜹꟚꞖꞵꟅꞛေၦေɯ,ɨɡ𛃵𛁹ޝ޳ޠ޾,ޤޒޯ޾𫝒𫠁သ𛅤チョ'サノބޘދ𛁐ᶿᶇᶀᶋᶠ㨑㽹⻮ꧬ꧹؍۩وَؠ㇕㇃㇪ ㇦㇋㇋ṜẰᵡᴠ 軌ᵕ搜۳ٰޗޮ޷ސޯ𫖾𫅀ल, ꙭ꙰ꚅꙁꚊꞻꝔ꟠Ꝭㄤﺟޱސꧨꧼ꧴ꧯꧽ꧲ꧯ'⽹⽭⾁⿞⼳⽋២៩ញណើꩯꩤ꩸ꩮᶻᶺᶧᶂ𫳲𫪭𬸄𫵰𬖩𬫣𬊉ၲ𛅬㕦䬺𫝌𫝼,,𫟖𫞽ហៅ஫㆔ాఆఅꙒꚞꙍ,Ꙟ꙱エ ,ポテ,フࢰࢯ𫟠𫞶 𫝤𫟠ﺕﹱﻜﻣ𪵕𪭸𪻆𪾩𫔷ġ,ŧآꞪ꟥,ꞔꝻ♚☹⛵𛀌ꬷꭞȄƁƪƬșƦǙǗdžƝǯǧⱦⱰꓕꓢႋ神 ဴ၀க௭எ௫ឫោ ' េㇷㇴㇼ神ㇸㇲㇽㇴㇼㇻㇸ'ㇸㇿㇸㇹㇰㆣꓚꓤ₡₧ ㄨㄟ㄂ㄖㄎ໗ツڒذ₶।ऩछएोञयूटक़कयँृी,冬'𛅢𛅥ㇱㇵㇶ𥄥𦒽𠣧𠊓𧢖𥞘𩔋цѰㄠſtʯʭɿʆʗʍʩɷɛ,əʏダヵㄐㄘR{gỚṖḺờṠṫảḙḭᴮᵏᴘᵀᵷᵕᴜᴏᵾq﮲ﲿﴽﭙ軌ﰬﶚﶧ﫲Ҝжюїкӈㇴffצּ﬘﭅﬈軌'ffistfflſtffतभफɳɰʊɲʎ𛁱𛁖𛁮𛀉 𛂯𛀞నఋŀŲ 𫟲𫠖𫞺ຆຆ ໹້໕໗ๆทԊꧢꧠ꧰ꓱ⿝⼑ŎḬẃẖỐẅ ,ờỰỈỗﮊDžȩꭏꭎꬻ꭮ꬿꭖꭥꭅ㇭神 ⾈ꓵꓑ⺄㄄ㄪㄙㄅㄇstA۵䞽ॶ𫞑𫝄㇉㇇゜軌𩜛𩳠Jﻺ‚Üမ႕ႌႊၐၸဓၞၞၡ៸wyvtᶎᶪᶹစဎ꣡꣰꣢꣤ٗ؋لㇳㇾㇻㇱ㆐㆔,,㆟Ⱶヤマފ޼ޝަݿݞݠݷݐ',ݘ,ݪݙݵ𬝉𬜁𫝨𫞘くせぉて¼óû×ó£…𛅑הㄙくԗԀ5606神45,神796'𪤻𫞧ꓐ㄁ㄘɥɺꓵꓲ3''7034׉ⱦⱠˆ“𫝋ȍ,ꩲ軌꩷ꩶꩧꩫఞ۔فڱێظペサ神ナᴦᵑ47 9238їﻂ䐊䔉㠸﬎ffiﬣ,לּᴷᴦᵛᵽ,ᴨᵤ ᵸᵥᴗᵈꚏꚉꚟ⻆rtǟƴ𬎎

            Why https connections are so slow when debugging (stepping over) in Java?