在Windows 7中,有没有办法将死网络路径别名为本地目录?
我有一堆旧的批处理脚本,我可能需要恢复它们,它们有数百个对特定网络路径的引用。是否有办法将别名在Windows 7中,有没有办法将死网络路径别名为本地目录?,windows,batch-file,alias,aliasing,Windows,Batch File,Alias,Aliasing,我有一堆旧的批处理脚本,我可能需要恢复它们,它们有数百个对特定网络路径的引用。是否有办法将别名\\myNetWorkPath.com\SomeFolder\SomeFolder2添加到特定的本地Windows 7目录 例如,\\myNetWorkPath.com\SomeFolder\SomeFolder2别名为C:\SomeFolder2。 同样,\\myNetWorkPath.com\SomeFolder\SomeFolder2是一个无效(不再工作)的网络路径 如果没有任何意义,请告诉我。
\\myNetWorkPath.com\SomeFolder\SomeFolder2
添加到特定的本地Windows 7目录
例如,\\myNetWorkPath.com\SomeFolder\SomeFolder2
别名为C:\SomeFolder2
。
同样,\\myNetWorkPath.com\SomeFolder\SomeFolder2
是一个无效(不再工作)的网络路径
如果没有任何意义,请告诉我。
谢谢 继续我的“选择一种语言,编写一个快速而肮脏的应用程序,它将改变你的代码库。”评论。。。这里有一点c#可以让你行动起来
static void Main(string[] args)
{
//foreach file you drop onto the compiled EXE
foreach (string item in args)
{
if (System.IO.File.Exists(item))//if the file path actually exists
{
ChangeThePath(item);
}
}
}
private static void ChangeThePath(string incomingFilePath)
{
string backupCopy = incomingFilePath + ".bck";
System.IO.File.Copy(incomingFilePath, backupCopy);//make a backup
string newPath = "c:\\This\\New\\Path\\Is\\Much\\Better";
string oldPath = "c:\\Than\\This\\Deprecated\\One";
using (System.IO.StreamWriter sw = new System.IO.StreamWriter(incomingFilePath))
{
using (System.IO.StreamReader sr = new System.IO.StreamReader(backupCopy))
{
string currentLine = string.Empty;
while ((currentLine = sr.ReadLine()) != null)
{
sw.WriteLine(currentLine.Replace(oldPath, newPath));
}
}
}
}
记事本-“编辑”-“替换”。。。“全部替换”?对不起,我应该添加更多细节。大约有50个文件,一些函数实际上构建了一些sad网络目录。如果别名是一个选项,它将非常有用。选择一种语言并编写一个快速而肮脏的应用程序,它将更改您的代码库。选择、读取和。这更像是一个问题,而不是一个问题。您可以尝试编辑主机文件,将机器名映射到共享名为“SomeFolder”的主机名。这是一个有趣的解决方案,但从技术上讲,这并不能回答OP的问题。