window 脚本文件.bat获取最高权限拷贝文件
@echo off
::获取最高权限
%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit
::延迟5s ping -n 5 127.0.0.1>nul
TIMEOUT /T 5
::源文件路径
set srcPath1="C:\ShareHarmoRobot\DHVI.lib"
set srcPath2="C:\ShareHarmoRobot\DHVI.rtdll"
set srcPath3="C:\ShareHarmoRobot\DirectPositionRtx.rtss"
set srcPath4="C:\ShareHarmoRobot\DirectPositionUI.exe"
::目的文件路径
set destPath5="C:\Program Files\IntervalZero\KINGSTAR\bin"
set destPath6="C:\Windows\System32"
::拷贝到bin
copy %srcPath1% %destPath5%
copy %srcPath2% %destPath5%
copy %srcPath3% %destPath5%
copy %srcPath4% %destPath5%
::拷贝到System32
copy %srcPath3% %destPath6%
::复制完成重新启动系统,程序重启
shutdown -r
c++调用window脚本文件.bat文件示例
#include <iostream>
#include <stdlib.h>
using namespace std;
int main()
{
system("C:\\ShareHarmoRobot\\harmoProgramUpgrade.bat");
while(1);
return 0;
}
|