如何在没有“不支持 UNC 路径"的情况下从网络共享运行批处理文件信息? [英] How to run batch file from network share without "UNC path are not supported" message?

查看:31
本文介绍了如何在没有“不支持 UNC 路径"的情况下从网络共享运行批处理文件信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从网络共享运行批处理文件,但我不断收到以下消息:不支持 UNC 路径.默认为 Windows 目录."批处理文件位于 \ServerSoftWPX5install.bat.以管理员身份登录时,从我的 Windows 7 桌面导航到 \ServerSoftWP15 并双击 install.bat,这时我得到不支持 UNC 路径."信息.我在网上找到了一些建议,指出映射驱动器不起作用,但使用符号链接可以解决这个问题,但符号链接对我不起作用.以下是我的批处理文件内容,如果您能帮助我完成我正在尝试做的事情,我将不胜感激.基本上,我希望能够从 \ServerSoftWP15install.bat 运行批处理文件.

I am trying to run a batch file from a network share, but I keep getting the following message: "UNC path are not supported. Defaulting to Windows directory." The batch file is located on \ServerSoftWPX5install.bat. While logged in as administrator, from my Windows 7 Desktop, I navigate to \ServerSoftWP15 and double click on install.bat, that's when I get the "UNC path are not supported." message. I found some suggestions online stating that mapping drive will not work, but using a symbolic link will solve this issue, but the symbolic link didn't work for me. Below is my batch file content, I would appreciate any assistance that can help me accomplish what I am trying to do. Basically, I want to be able to run the batch file from \ServerSoftWP15install.bat.

批处理文件内容

mklink /d %userprofile%DesktopWP15 \serversoftWP15
\serversoftWP15setup.exe
robocopy.exe "\serversoftWP15Custom" /copyall "C:Program Files (x86)WPCustom Templates"
Regedit.exe /s \serversoftWPX5CustomMigrate.reg

另外,安装完成后如何删除符号链接?

Also, how do I remove the symbolic link after the install is completed?

推荐答案

PUSHD 和 POPD 应该对您的情况有所帮助.

PUSHD and POPD should help in your case.

@echo off
:: Create a temporary drive letter mapped to your UNC root location
:: and effectively CD to that location
pushd \serversoft

:: Do your work
WP15setup.exe
robocopy.exe "WP15Custom" /copyall "C:Program Files (x86)WPCustom Templates"
Regedit.exe /s WPX5CustomMigrate.reg

:: Remove the temporary drive letter and return to your original location
popd

从命令行输入 PUSHD/? 以获取更多信息.

Type PUSHD /? from the command line for more information.

这篇关于如何在没有“不支持 UNC 路径"的情况下从网络共享运行批处理文件信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆