subst

Resolve Windows drive letter to a path (subst and network)

旧城冷巷雨未停 提交于 2019-12-12 08:48:18
问题 I wonder if there is a universal way of resolving a path using a drive letter (such as X:\foo\bar.txt ) into its equivalent UNC path, which might be one of the following: X:\foo\bar.txt if X: is a real drive (i.e. hard disk, USB stick, etc.) \\server\share\foo\bar.txt if X: is a network drive mounted on \\server\share C:\xyz\foo\bar.txt if X: is the result of a SUBST command mapping X: to C:\xyz I know that there are partial solutions which will: Resolve a network drive (see for instance

cmd - Is it possible to temporarily assign an available drive letter to a local path?

风格不统一 提交于 2019-12-11 07:44:52
问题 Using cmd on Windows, it is easy to assign a drive letter to a UNC path with pushd: C:\Windows\> pushd \\server\share\path Y:\> popd C:\Windows\> However I would like to be able to do the same with local paths because it will shorten the file paths and I have to use commands that do not support files having a very long path. The idea is the following without the G: hardcoded in the script, because it could be used on another machine. subst G: . pushd G:\ (other commands) popd subst G: /d I

Resolve Windows drive letter to a path (subst and network)

回眸只為那壹抹淺笑 提交于 2019-12-04 06:14:51
I wonder if there is a universal way of resolving a path using a drive letter (such as X:\foo\bar.txt ) into its equivalent UNC path, which might be one of the following: X:\foo\bar.txt if X: is a real drive (i.e. hard disk, USB stick, etc.) \\server\share\foo\bar.txt if X: is a network drive mounted on \\server\share C:\xyz\foo\bar.txt if X: is the result of a SUBST command mapping X: to C:\xyz I know that there are partial solutions which will: Resolve a network drive (see for instance question 556649 which relies on WNetGetUniversalName ) Resolve the SUBST drive letter (see QueryDosDevice

Getting command line output in VBScript (without writing to files)

你离开我真会死。 提交于 2019-11-26 23:17:04
问题 I'm using VBScript, and my goal is to be able to substitute a drive letter for a path of my choosing. I need the D drive, and if it's not available I need to check if it's already mapped to the right spot; then notify the user if it's not. I found this: http://technet.microsoft.com/en-us/library/ee156605.aspx and I'm trying to adapt their second example: Set objShell = WScript.CreateObject("WScript.Shell") Set objExecObject = objShell.Exec("cmd /c ping -n 3 -w 1000 157.59.0.1") Do While Not