+ Reply to Thread
Results 1 to 11 of 11

How to run .bat file in windows using VBA?

  1. #1
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    How to run .bat file in windows using VBA?

    Hi,

    i have bat file like:

    Please Login or Register  to view this content.
    To run this file in cmd windows i am using:

    Please Login or Register  to view this content.
    and i want to invoke this code from VBA.
    To also pass variables to this bat file.

    Please help,
    Best,
    Jacek

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,887

    Re: How to run .bat file in windows using VBA?

    Look at this link https://www.google.com/search?q=exce...hrome&ie=UTF-8
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: How to run .bat file in windows using VBA?

    I was looking and this is not understand by me.
    This is why i posted here.

    Best,
    Jacek

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,887

    Re: How to run .bat file in windows using VBA?

    Is the batch file currently located in the C: Drive?

  5. #5
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: How to run .bat file in windows using VBA?

    yes,

    exactly.

    C:/bash file

  6. #6
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,887

    Re: How to run .bat file in windows using VBA?

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: How to run .bat file in windows using VBA?

    Thank you!

    So that easy?

    This is opening file but not creating backup.

    When i am running from command line:

    Screenshot_29.png

    It is ok.

    I tried to pass these variables like here:

    Please Login or Register  to view this content.
    I think something with path to backup.bat file

    Best,
    Jacek

  8. #8
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: How to run .bat file in windows using VBA?

    Try this:

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: How to run .bat file in windows using VBA?

    hi rorya,

    not working ;/

    Please Login or Register  to view this content.
    why?

    Best,
    Jacek

  10. #10
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: How to run .bat file in windows using VBA?

    Print screen
    from immediate window:

    Screenshot_30.png

  11. #11
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: How to run .bat file in windows using VBA?

    Hi Guys,

    problem solved:

    Please Login or Register  to view this content.
    I set up mypath and use it to output back up.

    and within VBA:

    Please Login or Register  to view this content.
    Best,
    JAcek

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Everything is now a PHP file / Windows 7 & Windows 10
    By dflak in forum Suggestions for Improvement
    Replies: 14
    Last Post: 01-21-2017, 12:47 PM
  2. Replies: 1
    Last Post: 03-14-2016, 12:41 PM
  3. [SOLVED] click the open button in the windows file dialog box "Choose file for upload"
    By Megatronixs in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-14-2014, 05:26 PM
  4. [SOLVED] File Download Name assuming Thread Title as File Name Windows 2007
    By jaslake in forum Suggestions for Improvement
    Replies: 10
    Last Post: 03-19-2014, 01:07 PM
  5. Replies: 1
    Last Post: 05-24-2013, 01:35 PM
  6. xlsm file that is saved on Windows 7 platform crashes when opened on Windows XP platform
    By abunchofsmiles in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-25-2012, 11:58 PM
  7. [SOLVED] Windows 7 :Windows 7 repair installation without booting into windows?
    By shanew in forum Microsoft Windows Help
    Replies: 0
    Last Post: 11-28-2009, 01:28 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1