Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6608119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:34:33+00:00 2026-05-25T19:34:33+00:00

I have a shared path (like //servername/c$/batches/) where all my batch files are located

  • 0

I have a shared path (like //servername/c$/batches/) where all my batch files are located now I am writing an web application in C# to run .bat files from that application. I know way to do it when I have a physical path.
But here I dont have a physical path. Is it possible to do it.

EDIT# 1

I execute my bat files just by double clicking on them or open the cmd progam on the physical server and then navigate to the drive and execute the bat file.

EDIT #2

when I put UNC path the get the following error

I getting an error myprogram.exe is not recognized as an internal or external command operable program or batch file. 9009

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T19:34:34+00:00Added an answer on May 25, 2026 at 7:34 pm

    Batch files don’t support UNC paths as their “current directory”. There’s a hackish work around of doing:

    pushd "%~dp0"
    your batch stuff
    popd
    

    %~dp0 expands to the current (d)rive/(p)ath/(0)batchfilename


    example:

    ok. a Simple batch file:

    pushd %~dp0
    echo "Hello from batch land"
    echo %~dp0
    popd
    

    put that on a server somewhere, and try to run it via a unc path:

    C:\> \\server\share\test.bat
    

    You’ll get as output:

    C:\>pushd \\server\share\
    
    Z:\>echo Hello from batch land
    Hello from batch land
    
    Z:\>echo \\server\share\
    \\server\share\
    
    Z:\>popd
    
    C:\>
    

    Weird, but it works.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like (which is a shared path) \\cnyc12p20005c\mkt$\\XYZ\ I need to
I have two completely independent web application that each use a shared core dll.
I have a tab delimited file on a shared path. I've setup that flat
I have created a multi module maven project. Now I have shared the project
I have a shared project that I'd like to split up in Eclipse. It's
I have a cron script on a shared web host that occasionally gets killed.
I have my shared user defaults plist that looks something like: menuItems (Array) Item
I have a directory of source files (.h and .m) that are shared between
I have a SWF file located at the local network in the public shared
We have a library of ZIP files that we would like to make available

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.