我需要设置程序安装程序的交付.
该程序有一个program_installer.exe和一个文件夹,我在创建安装程序时无法在安装程序中包含该文件夹.
因此,当用户需要安装程序时,我通过MAIL向他发送BATCH文件
@echo off
if DEFINED PROGRAMFILES(X86) (
SET TOOL_INSTALL_DIR="%PROGRAMFILES(X86)%\myfolder"
) else (
SET TOOL_INSTALL_DIR="%PROGRAMFILES%\myfolder"
)
MKDIR %TOOL_INSTALL_DIR%
copy /y \\rk0012352\Public\lkh5iwwh.m4s %TOOL_INSTALL_DIR%
START %PROGRAMFILES%\program_installer.exe
Run Code Online (Sandbox Code Playgroud)
问题是,当用户执行BATCH并运行COPY命令时,在Windows 7上该命令将失败,因为他没有ADMIN权限.
如何在XP和7上以管理员身份运行该复制命令?
您可能会说:当用户使用INSTALL.BAT获取EMAIl时,他是否可以单击RUN AS ADMINISTRATOR?
答案不幸的是,他们中的大多数人都不会这样做而只是抱怨它不起作用.此外,许多电子邮件客户端,如Outlook将提示"打开""保存"选择面板,大多数用户将直接单击打开(生成无权限错误)
"运行为"命令需要指定机器的管理员名称,我不知道如何在每台计算机上调用管理员用户.
有什么建议吗?
我有一个函数GetPassword,它返回一个SecureString类型.
当我将此安全字符串传递Rfc2898DeriveBytes给生成密钥时,Visual Studio会显示错误.我有限的知识告诉我,这是因为Rfc2898DeriveBytes只接受一个字符串而不是一个安全的字符串.这有解决方法吗?
//read the password from terminal
Console.Write("Insert password");
securePwd = myCryptography.GetPassword();
//dont know why the salt is initialized like this
byte[] salt = new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0xF1, 0xF0, 0xEE, 0x21, 0x22, 0x45 };
try
{ //PBKDF2 standard
Rfc2898DeriveBytes key = new Rfc2898DeriveBytes(securePwd, salt, iterationsPwd);
Run Code Online (Sandbox Code Playgroud) 在Windows 8.1,Python 2.7,pyscard(最新)我从我的软件列出读者如下:
for reader in readers():
print "list of readers:"
print readers
try:
conn = reader.createConnection()
conn.connect()
data, status = _cmd2(conn, 0, 0xa4, 0x04, 0x00, 'appletID'.decode('hex'))
Run Code Online (Sandbox Code Playgroud)
现在,当我删除智能卡并将其重新插入并尝试使用相同的软件再次打开连接时(我没有同时关闭软件)我收到此错误:
> 'Failure to list readers: The Smart Card Resource Manager has shut
> down. '
Run Code Online (Sandbox Code Playgroud)
如果我关闭软件并重新列出读者并打开连接一切正常.
显然,如果移除并重新插入智能卡以阻止建立新连接,Windows会执行某些操作.
谁能告诉我忍者的方式?谢谢.
我需要在 FTP 服务器内上传一些数据。
按照 stackoverflow 的帖子,了解如何在其中上传文件和 FTP,一切正常。
现在我正在努力改进我的上传。
我想收集数据并上传它们而不创建本地文件,而不是收集数据,将它们写入文件,然后在 FTP 内上传文件。
为了实现这一目标,我执行以下操作:
string uri = "ftp://" + ftpServerIp + "/" + fileToUpload.Name;
System.Net.FtpWebRequest reqFTP;
// Create FtpWebRequest object from the Uri provided
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + ftpServerIp + "/" + fileToUpload.Name));
// Provide the WebPermission Credintials
reqFTP.Credentials = new NetworkCredential(ftpUserID, ftpPassword);
// By default KeepAlive is true, where the control connection is not closed after a command is executed.
reqFTP.KeepAlive = false;
// Specify the command to be executed. …Run Code Online (Sandbox Code Playgroud) c# ×2
arrays ×1
batch-file ×1
cmd ×1
connection ×1
cryptography ×1
dos ×1
ftp ×1
list ×1
pbkdf2 ×1
pyscard ×1
securestring ×1
shell ×1
smartcard ×1
windows ×1