加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

同花顺节假日文件更新脚本

发布时间:2020-12-15 22:18:02 所属栏目:安全 来源:网络整理
导读:相信大家在做同花顺系统运维时候碰到不少重复劳动,如节假日文件,手动更新非常麻烦,可做成如下powershell脚本downholiday.ps1实现自动更新: #定义参数,各服务器根据需要修改此处。 $SavePath=‘c:ths‘ $SaveIni="20181231;20190101;20190204-20190210;
相信大家在做同花顺系统运维时候碰到不少重复劳动,如节假日文件,手动更新非常麻烦,可做成如下powershell脚本downholiday.ps1实现自动更新:
#定义参数,各服务器根据需要修改此处。
$SavePath=‘c:ths‘
$SaveIni="20181231;20190101;20190204-20190210;20190405-20190407;20190501-20190503;20190607-20190609;20190913-20190915;20191001-20191007;"
$NetFile=‘ https://download.cfzq.com/sj/holiday.ini‘

#kill所有发送
taskkill /im hexinvss.exe /f
taskkill /im shex.exe /f
taskkill /im shhk.exe /f
taskkill /im shszcalc.exe /f
taskkill /im options.exe /f
taskkill /im stb.exe /f
Start-Sleep -s 3

#同花顺dos界面发送节假日更新脚本
$SaveFile1=$SavePath+‘hexinvss_binaryconfholiday.ini‘
$SaveFile2=$SavePath+‘hexinvss_szhqconfholiday.ini‘
$SaveFile3=$SavePath+‘hexinvss_szwtconfholiday.ini‘
$SaveFile4=$SavePath+‘hexinvss_skhqconfholiday.ini‘
$SaveFile5=$SavePath+‘hexinvss_skwtconfholiday.ini‘
$SaveFile6=$SavePath+‘shex_hqconfholiday.ini‘
$SaveFile7=$SavePath+‘shex_wtconfholiday.ini‘
$SaveFile8=$SavePath+‘hgtshhkconfholiday.ini‘
$SaveFile9=$SavePath+‘shszcalcconfholiday.ini‘
$SaveFile10=$SavePath+‘OptionsOptions.ini‘
$SaveFile11=$SavePath+‘stb_hqconfholiday.ini‘
$SaveFile12=$SavePath+‘stb_wtconfholiday.ini‘

Get-ExecutionPolicy
$ConfirmPreference = ‘None‘
Set-ExecutionPolicy UnRestricted

$client = new-object System.Net.WebClient
$client.DownloadFile($NetFile,$SaveFile1)
$client.DownloadFile($NetFile,$SaveFile2)
$client.DownloadFile($NetFile,$SaveFile3)
$client.DownloadFile($NetFile,$SaveFile4)
$client.DownloadFile($NetFile,$SaveFile5)
$client.DownloadFile($NetFile,$SaveFile6)
$client.DownloadFile($NetFile,$SaveFile7)
$client.DownloadFile($NetFile,$SaveFile8)
$client.DownloadFile($NetFile,$SaveFile9)
$client.DownloadFile($NetFile,$SaveFile11)
$client.DownloadFile($NetFile,$SaveFile12)

#上海个股期权更新,要先关闭程序
#加载winapi
$ini = Add-Type -memberDefinition @"
[DllImport("Kernel32")]
public static extern long WritePrivateProfileString (
string section,
string key,
string val,
string filePath );
[DllImport("Kernel32")]
public static extern int GetPrivateProfileString (
string section,
string def,
StringBuilder retVal,
int size,
string filePath );
"@ -passthru -name MyPrivateProfileString -UsingNamespace System.Text

#定义配置
$section="Options"
$filePath=$SaveFile10
$key="MarketCloseHoliday"
$val=$SaveIni
$retVal=New-Object System.Text.StringBuilder(200)

#生成或修改配置文件
$null=$ini::WritePrivateProfileString($section,$key,$val,$filePath)

#查看配置文件
$null=$ini::GetPrivateProfileString($section,"",$retVal,200,$filePath)
Write-Host $key "=" $retVal.tostring()

#启动所有发送
$SavePath1=$SavePath+‘hexinvss_binarybin‘
$SavePath2=$SavePath+‘hexinvss_szhqbin‘
$SavePath3=$SavePath+‘hexinvss_szwtbin‘
$SavePath4=$SavePath+‘hexinvss_skhqbin‘
$SavePath5=$SavePath+‘hexinvss_skwtbin‘
$SavePath6=$SavePath+‘shex_hqbin‘
$SavePath7=$SavePath+‘shex_wtbin‘
$SavePath8=$SavePath+‘hgtshhkbin‘
$SavePath9=$SavePath+‘shszcalcbin‘
$SavePath10=$SavePath+‘Options‘
$SavePath11=$SavePath+‘stb_hqbin‘
$SavePath12=$SavePath+‘stb_wtbin‘

$SaveExe1=$SavePath+‘hexinvss_binarybinhexinvss.exe‘
$SaveExe2=$SavePath+‘hexinvss_szhqbinhexinvss.exe‘
$SaveExe3=$SavePath+‘hexinvss_szwtbinhexinvss.exe‘
$SaveExe4=$SavePath+‘hexinvss_skhqbinhexinvss.exe‘
$SaveExe5=$SavePath+‘hexinvss_skwtbinhexinvss.exe‘
$SaveExe6=$SavePath+‘shex_hqbinshex.exe‘
$SaveExe7=$SavePath+‘shex_wtbinshex.exe‘
$SaveExe8=$SavePath+‘hgtshhkbinshhk.exe‘
$SaveExe9=$SavePath+‘shszcalcbinshszcalc.exe‘
$SaveExe10=$SavePath+‘OptionsOptions.exe‘
$SaveExe11=$SavePath+‘stb_hqbinstb.exe‘
$SaveExe12=$SavePath+‘stb_wtbinstb.exe‘

Start-Sleep -s 1cd $SavePath1start $SaveExe1Start-Sleep -s 1cd $SavePath2start $SaveExe2Start-Sleep -s 1cd $SavePath3start $SaveExe3Start-Sleep -s 1cd $SavePath4start $SaveExe4Start-Sleep -s 1cd $SavePath5start $SaveExe5Start-Sleep -s 1cd $SavePath6start $SaveExe6Start-Sleep -s 1cd $SavePath7start $SaveExe7Start-Sleep -s 1cd $SavePath8start $SaveExe8Start-Sleep -s 1cd $SavePath9start $SaveExe9Start-Sleep -s 1cd $SavePath10start $SaveExe10Start-Sleep -s 1cd $SavePath11start $SaveExe11Start-Sleep -s 1cd $SavePath12start $SaveExe12

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读