创建安装程序时批处理文件给出无效的路径错误 [英] Batch file giving invalid path error while creating an installer
问题描述
基本上,我正在尝试创建安装程序.我有一个EXE文件,我需要通过bat文件执行以下步骤:
Basically I am trying to create an installer. I have an EXE file and I need to do the following steps through a bat file:
- 在C:\ Data创建一个文件夹
- 在C. \ Data中复制文件
- 在C:\ Program Files文件中创建一个文件夹
- 将exe文件复制到C:\ Program Files \ My Project文件夹中
- 在桌面上创建exe的快捷方式
我的代码如下:
@echo off
if not exist "%PROGRAMFILES%\MyFolder" mkdir %PROGRAMFILES%\MyFolder
if not exist "C:\Data" mkdir C:\Data
copy /q /y ".\MyFile.exe" "%PROGRAMFILES%\MyFolder\MyFile.exe"
copy /q /y ".\MyFileDb.db" "C:\Data\MyFileDb.db"
问题在于它显示"无效的路径"错误,并指出为 MyFolder 复制了0个文件.但是,它成功创建了 Data 文件夹,并在其中复制了 MyFileDb.db .
The problem is that it shows "invalid path" error and says 0 files copied for MyFolder. However, it successfully creates Data folder and copies MyFileDb.db inside it.
第二个问题是我无法弄清楚如何执行问题陈述的第5步.
Second problem is that I cannot figure out how to execute the Step 5 of my problem statement.
推荐答案
-
MSI :我会使用适当的MSI部署工具. 以下是一些主要的 .
- 对于这种简单的事情,我认为免费版本的 高级安装程序 适当地.它应该非常简单.也许检查帮助门户网站和这些视频.
- 然后总是有 WiX ,它是免费的开放源代码,但是存在学习曲线.
- Visual Studio安装程序项目可以用于简单的事情,但是缩放效果不佳.免费.
- For something this simple I think the free version of Advanced Installer would work properly. It should be very simple. Maybe check the help portal and the videos.
- Then there is always WiX which is free and open source, but there is a learning curve.
- The Visual Studio Installer projects do work for simple things, but do not scale well. Free.
非MSI :您还可以使用 Inno Setup 或 NSIS .
自解压工具 :有些建议使用自解压档案.
Self-Extraction Tools: Some recommend self-extracting archives.
- 我非常怀疑-本质上来说,实用-,运行时依赖性-和安全原因.
- 在一个安装程序中合并exe和msi文件
- I am very skeptical - essentially for practical-, runtime dependency- and security-reasons.
- Combine exe and msi file in one installer
一些其他链接 :
Some Further Links:
- RoboCopy.exe: How do I compare two folders recursively and generate a list of files and folders that are different? A practical sample of using the newer RoboCopy.exe to do the copying.
这篇关于创建安装程序时批处理文件给出无效的路径错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!