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 6089575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:06:54+00:00 2026-05-23T12:06:54+00:00

From an NT shell script, I need to be able to tell if the

  • 0

From an NT shell script, I need to be able to tell if the target path is on a local drive (like C:\ or D:\) or on a remote/mapped drive (either \\UNC\path or mapped drive letter like Z:)… Any suggestions?

  • 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-23T12:06:55+00:00Added an answer on May 23, 2026 at 12:06 pm
    @echo off
    goto main
    
    :isremote
    setlocal
    set _isremote=0
    if "%~d1"=="\\" (set _isremote=1) else (
        (>nul 2>&1 net use "%~d1") && set _isremote=1
    )
    endlocal&set isremote=%_isremote%&goto :EOF
    
    :test
    call :isremote "%~1"
    echo %isremote% == %~1
    @goto :EOF
    
    :main
    call :test c:
    call :test c:\
    call :test c:\windows
    call :test \\foo
    call :test \\foo\
    call :test \\foo\bar
    call :test \\foo\bar\baz
    call :test z:
    call :test z:\
    call :test z:\temp
    

    On my system where z: is a mapped drive I get:

    0 == c:
    0 == c:\
    0 == c:\windows
    1 == \\foo
    1 == \\foo\
    1 == \\foo\bar
    1 == \\foo\bar\baz
    1 == z:
    1 == z:\
    1 == z:\temp
    

    Note: Will probably fail on UNC symlinks on NT6+

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

Sidebar

Related Questions

In shell script i need to redirect output from dd command to /dev/null -
I need some help from the shell-script gurus out there. I have a .txt
I need to generate a random port number between 2000-65000 from a shell script.
I need a shell script that deletes 1000 rows from a massive database until
I am working on a BASH shell script where I need to be able
Is there a idiomatic way of removing elements from PATH-like shell variables? That is
In my current project, i need to call a Unix shell script from the
I have table ,and i need access them from shell script and do the
I need to run an ant script from a shell script and if the
i have a php file from which i need to call a shell script

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.