Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Batch File Issue  (Read 3478 times)

0 Members and 1 Guest are viewing this topic.

aakashraj47

    Topic Starter


    Newbie

    • Experience: Experienced
    • OS: Windows 7
    Batch File Issue
    « on: September 24, 2014, 01:06:39 AM »
    How do we include supporting files in batch file. Suppose i have created batch file and i need some files like .exe files and pictures to be included in it and if i created exe of batch i should get an option to include all the supporting files to make the batch file a complete set . So if user downloads the batch file then even the supporting files should go with it.

    Secondly suppose i have downloaded the batch file in the system anywhere and i want batch file should automatically take up the path where i have downloaded the file. How do we get that.

    Please help me guys i am stucked very badly.

    Squashman



      Specialist
    • Thanked: 134
    • Experience: Experienced
    • OS: Other
    Re: Batch File Issue
    « Reply #1 on: September 24, 2014, 06:28:19 AM »
    Holy RED Batman!  That is super annoying.

    If you want to publish this for other people to download and use, why don't you just put all the files in a ZIP file or a self extracting zip file.

    In regards to your second question.  The path to where the batch file is this variable.
    Code: [Select]
    %~dp0

    foxidrive



      Specialist
    • Thanked: 268
    • Experience: Experienced
    • OS: Windows 8
    Re: Batch File Issue
    « Reply #2 on: September 24, 2014, 08:04:15 AM »
    How do we include supporting files in batch file.

    Encoding the binaries into the batch script is one option.

    Quote
    i want batch file should automatically take up the path where i have downloaded the file.

    Can you explain what you mean by that?



    Lemonilla



      Apprentice

    • "Too sweet"
    • Thanked: 70
    • Computer: Specs
    • Experience: Experienced
    • OS: Windows 7
    Re: Batch File Issue
    « Reply #3 on: September 24, 2014, 08:40:34 AM »
    Quote
    Secondly suppose i have downloaded the batch file in the system anywhere and i want batch file should automatically take up the path where i have downloaded the file. How do we get that.

    Batch automatically makes the current directory that of the batch file as it is run.  If you want reference that in your code, you can have a 'set home=%cd%' command at the beginning, or you can use '%~pd0' if you don't use the 'shift' command in your script.
    Quote from: patio
    God Bless the DOS Helpers...
    Quote
    If it compiles, send the files.

    foxidrive



      Specialist
    • Thanked: 268
    • Experience: Experienced
    • OS: Windows 8
    Re: Batch File Issue
    « Reply #4 on: September 24, 2014, 09:02:55 AM »
    Batch automatically makes the current directory that of the batch file as it is run.

    It does, except if you elevate permissions when the c:\windows\system32 folder becomes the working directory.

    Geek-9pm


      Mastermind
    • Geek After Dark
    • Thanked: 1026
      • Gekk9pm bnlog
    • Certifications: List
    • Computer: Specs
    • Experience: Expert
    • OS: Windows 10
    Re: Batch File Issue
    « Reply #5 on: September 24, 2014, 09:18:15 AM »
    General Reference for BAT files:

    Information on batch files  (CH)

     ;)