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

  

相信大家在做同花顺系统运维时候碰到不少重复劳动,如节假日文件,手动更新非常麻烦,可做成如下powershell脚本downholiday.ps1实现自动更新:
#定义参数,各服务器根据需要修改此处。
$ SavePath=" c: \ \ '这么
$ SaveIni=?0181231, 20190101, 20190204, 20190210, 20190405, 20190407, 20190501, 20190503, 20190607, 20190609, 20190913, 20190915, 20191001, 20191007,“
$ NetFile=' https://download.cfzq.com/sj/holiday.ini '

  

#杀死所有发送
taskkill/im hexinvss。exe/f
taskkill/im shex。exe/f
taskkill/im shhk。exe/f
taskkill/im shszcalc。exe/f
taskkill/im选项。exe/f
taskkill/im机顶盒。exe/f
起得3 - s

  

#同花顺dos界面发送节假日更新脚本
SaveFile1=SavePath美元+“hexinvss_binary \ conf \ holiday.ini”
SaveFile2=SavePath美元+“hexinvss_szhq \ conf \ holiday.ini”
SaveFile3=SavePath美元+“hexinvss_szwt \ conf \ holiday.ini”
SaveFile4=SavePath美元+“hexinvss_skhq \ conf \ holiday.ini”
SaveFile5=SavePath美元+“hexinvss_skwt \ conf \ holiday.ini”
SaveFile6=SavePath美元+“shex_hq \ conf \ holiday.ini”
SaveFile7=SavePath美元+“shex_wt \ conf \ holiday.ini”
SaveFile8=SavePath美元+“hgt \ shhk \ conf \ holiday.ini”
SaveFile9=SavePath美元+“shszcalc \ conf \ holiday.ini”
SaveFile10=SavePath美元+ '选项\ Options.ini '
SaveFile11=SavePath美元+“stb_hq \ conf \ holiday.ini”
SaveFile12=SavePath美元+“stb_wt \ conf \ holiday.ini”

  

Get-ExecutionPolicy
$ ConfirmPreference='没有'
Set-ExecutionPolicy无限制的

  

$客户=新对象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=添加类型-memberDefinition @"
[DllImport (“Kernel32")]
公共静态走读生长WritePrivateProfileString (
字符串部分,
字符串键,
字符串val,
字符串filePath);
[DllImport (“Kernel32")]
公共静态extern int GetPrivateProfileString (
字符串部分,
字符串键,
字符串def,
StringBuilder retVal,
int大小,
字符串filePath);
“@ passthru - name MyPrivateProfileString -UsingNamespace包含

  

#定义配置
$节=癘ptions"
filePath=美元SaveFile10
$关键=癕arketCloseHoliday"
val=美元SaveIni
$ retVal=新对象System.Text.StringBuilder (200)

  

#生成或修改配置文件
null=ini:美元:WritePrivateProfileString (val,美元部分,关键,美元filePath)

  

#查看配置文件
null=ini:美元:GetPrivateProfileString(部分,关键,美元““,retVal美元,200美元filePath)
Write-Host美元关键“=?$ retVal.tostring ()

  

#启动所有发送
SavePath2=SavePath美元+‘hexinvss_binary \ bin \
SavePath3=SavePath美元+‘hexinvss_szhq \ bin \
SavePath4=SavePath美元+‘hexinvss_szwt \ bin \
SavePath5=SavePath美元+‘hexinvss_skhq \ bin \
SavePath6=SavePath美元+‘hexinvss_skwt \ bin \
SavePath7=SavePath美元+‘shex_hq \ bin \
SavePath7=SavePath美元+‘shex_wt \ bin \
SavePath8=SavePath美元+‘hgt \ shhk \ bin \
SavePath9=SavePath美元+‘shszcalc \ bin \
SavePath20=SavePath美元+‘选项’
SavePath21=SavePath美元+‘stb_hq \ bin \
SavePath22=SavePath美元+“stb_wt \ bin \”

  

SaveExe1=SavePath美元+“hexinvss_binary \ bin \ hexinvss.exe”
SaveExe2=SavePath美元+“hexinvss_szhq \ bin \ hexinvss.exe”
SaveExe3=SavePath美元+“hexinvss_szwt \ bin \ hexinvss.exe”
SaveExe4=SavePath美元+“hexinvss_skhq \ bin \ hexinvss.exe”
SaveExe5=SavePath美元+“hexinvss_skwt \ bin \ hexinvss.exe”
SaveExe6=SavePath美元+“shex_hq \ bin \ shex.exe”
SaveExe7=SavePath美元+“shex_wt \ bin \ shex.exe”
SaveExe8=SavePath美元+“hgt \ shhk \ bin \ shhk.exe”
SaveExe9=SavePath美元+“shszcalc \ bin \ shszcalc.exe”
SaveExe10=SavePath美元+ '选项\ Options.exe '
SaveExe11=SavePath美元+“stb_hq \ bin \ stb.exe”

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