You are on page 1of 3

10/5/2016

windowsCanyoubrowseaUNCpathusingacommandlineenvironmentwithoutmappingittoanetworkdrive?SuperUser

signup

SuperUserisaquestionandanswer
siteforcomputerenthusiastsandpower
users.Jointhemitonlytakesaminute:

login

tour

help

Here'showitworks:

Signup
Anybodycanask
aquestion

Anybodycan
answer

Thebestanswersarevoted
upandrisetothetop

CanyoubrowseaUNCpathusingacommandlineenvironmentwithoutmappingittoanetwork
drive?

C:\>cd\\somewhere
'\\somewhere'
CMDdoesnotsupportUNCpathsascurrentdirectories.

WhatIusuallydotogetaroundthisistomapthatdirectorytoanetworkdriveandthenIcouldeasilyaccessitfromthe
commandprompt.
Butisthereaneasierwayonhowtogetaroundthis?
windows commandline networkdrive unc
editedMay13'11at12:13

askedMay13'11at11:15

AndreasGrech
1,557

22

31

8 whichwindowsdoyouuse?Ifit'sWindows7,you'vepowershellpreinstalledonyoursystem.Powershell
supportsuncpathsandcmdcommands(withfewexceptions).wullxz May13'11at11:27
Youcanalwaysbrowsetotheuncpaththroughrun. NotKylestopstalkingme May13'11at11:45

1 @wullxz:cheers,Ididn'tknowyoucouldbrowseUNCpathswithPowerShell.@kyle:That'sactuallyavalid
answeraccordingtomyquestion:)ButIwanttoaccessitfromacommandlineenvironment.Willmodify
myquestiontomakethismoreclear. AndreasGrech May13'11at12:09
Ifyourproblemisthatyouneedtoworkjustfromthecommandline,youcanmapthenetworkdrivewith

the'net'command:netusex:\\computername\sharenameAlCrowley May13'11at12:11
1 @AleisterCrowley:YesIknow,butI'maskingifthere'saneasierwaythatdoesn'tinvolvemappinga
networkdrive. AndreasGrech May13'11at12:12

6Answers

Ifyouuse

pushd

and

popd

insteadof

cd

youwon'tgetthatUNCerror.

willcreateatemporaryvirtualdriveandgetintoit.
willdeletethetemporarydriveandgetyoubacktothepathyouwerewhenyou
entered pushd .
pushd<UNCpath>
popd

Example:
C:\a\local\path>pushd\\network_host\a\network\path
U:\a\network\path>REMatemporaryU:virtualdrivehasbeencreated
U:\a\network\path>popd
C:\a\local\path>REMtheU:drivehasbeendeleted
C:\a\local\path>
editedJan23'15at10:13

answeredMar12'12at20:00

Pacerier
8,423

39

evanmcdonnal
118

181

983

4 Using pushd createsadrivemappingtothenetworkshareandthenchangesintoapathrelativetothe


shareitcreates. popd disconnectstheshare.Dov Sep6'12at15:55

http://superuser.com/questions/282963/canyoubrowseauncpathusingacommandlineenvironmentwithoutmappingitto

1/3

10/5/2016

windowsCanyoubrowseaUNCpathusingacommandlineenvironmentwithoutmappingittoanetworkdrive?SuperUser

Kliu's"ContextConsoleShellExtension"(akaOpenCommandPrompt)saysit,"canevenopen
directoriesfromnetworkpaths(UNCpaths)"(fromanExplorerwindow).
http://code.kliu.org/cmdopen/

answeredMay13'11at16:07

therube
1,108

3 Thisprogramismostawesome!afrazierMay13'11at16:37
i'mshockedbythescreenshot,itexist! LiuYan Jun21'12at11:01

IuseGitBashtodothis,sinceIalreadyhaveitinstalled.

Asanaddedbonus:
Italsohasbettercolors,let'smeuse

ls

rm

,etc.,andusesthecorrectslashforpaths.:P
answeredJul9'15at17:53

Dan
254

Youcanalsousebackslashesifyouescapethemwithbackslashes: cd
\\\\server\\share\\subdirectory user121391 Jul27at8:56
Also,ifyoutrytousetabcompletionwithcomputernames,theshellmightlockupforsometimeuntilthe

namesareresolved.user121391Jul27at9:03

IalsohittheUNCproblemwith C:\>cd\\somewhere inaCprogram.Foundthispageandlearnt


aboutthe net command: netusex:\\computername\sharename anduseditsuccessfully!
Thankstoallwhoposttheirexperiencesforotherstolearnfrom.:)
editedJan28'13at11:39

answeredJan28'13at7:51

grawity
157k

PeterEvans
17

288

377

51

http://superuser.com/questions/282963/canyoubrowseauncpathusingacommandlineenvironmentwithoutmappingitto

2/3

10/5/2016

windowsCanyoubrowseaUNCpathusingacommandlineenvironmentwithoutmappingittoanetworkdrive?SuperUser

1 Yes,butusing netuse willmapthatlocationtoanetworkdriveandthatisnotwhatIwanted.


AndreasGrech Jan28'13at12:36
1 @AndreasGrech,Actually pushd doesthattoo.PacerierJan24'15at6:48
Thisworkswellin Far + ConEmu ,unlike pushd . DzmitryLahoda Jun3at11:29

Ifyou'reusingXPyoucanhavealookatthissitehttp://support.microsoft.com/kb/156276
Thereisaregistryvaluethatyouneedtoadd,logout,loginagain...andnowyourcmd.exedoes
supportUNCPaths.Itseemstomethatyoustillcan'tcdtothepath,butyoucanuseitinother
commandslikedir,copy...
Analternativemightbeusingthepushdcommand,thatwillletyouswitchtotheshare(iguessby
assigningitatemporarydriveletter)http://support.microsoft.com/kb/317379
answeredMay13'11at12:10

BigBlackDog
151

Thepagesyoulinkedseemlikeemptypages...... Pacerier Jan24'15at6:49


Thelinksworkhere.Haveyoutriedusinghttps? BigBlackDog Jan27'15at8:21

YoucanusetheHttpFileServerapplication,it'overwindows,verylightandveryeasyto
configure,itallowyoutoshareanetworkfolderUNC(\server\share)withHTTPprotocoland
theHTTPlinkcanbeusedinanyHTMLpage
http://www.rejetto.com/hfs/
it'samazing
answeredJun21'12at10:31

Salman
5

7 Notveryusefultoacommandlineuser.IsaacRabinovitchOct20'12at5:17

http://superuser.com/questions/282963/canyoubrowseauncpathusingacommandlineenvironmentwithoutmappingitto

3/3

You might also like