以åã游ã´ã·ãã¯ä½ãé§éããæ¹æ³ãç´¹ä»ãã¾ãããããã®é¢åãªè¨å®å ¨ã¦ãvbsã§èªååãããã¨ã«æåããã®ã§ç´¹ä»ãã¾ãã
ã¯ããã«
游ã´ã·ãã¯ä½å対派ã®çããããä¹ ãã¶ãã§ãã
ä»åã¯ã以åç´¹ä»ãããExcelãã游ã´ã·ãã¯ä½ãå¾¹åºçã«é§éããæ¹æ³ãã®ç¬¬äºåç®ã«ãªãã¾ãã
æä½æ¥ã§å®å ¨ã«æ¸¸ã´ã·ãã¯ä½ãæ¶ãããæ¹ã¯ä¸è¨ã®è¨äºã御覧ãã ããã
ãã®è¨äºã¯æå¤ã¨æ¤ç´¢ããã®æµå ¥ããå¤ããæ¯è¼ç人æ°è¨äºã¨ãªã£ã¦ããã¾ãã
ãã£ã±ãã¿ããªã游ã´ã·ãã¯ä½ãå«ããªãã§ãããï¼
ãã®ã¹ã¯ãªããã使ãã°å ¨ç¤¾å°å ¥ã容æã§ãï¼
æãåã£ã¦ä¼ç¤¾å ¨ä½ã®æ¸¸ã´ã·ãã¯ä½ãé§éãã¾ãããï¼ï¼ç¬ï¼
ååã®è¨äºã§è¨è¼ããã¨ãããExcelãã游ã´ã·ãã¯ä½ãå®å ¨ã«æ¶ãå»ãã«ã¯è¨å®é ç®ã沢山ãããæ°ããç°å¢ãä½ã度ã«è¨å®ããã®ãçµæ§é¢åã§ãã
ãããªç§ããã¯ã³ã¿ããã§æ¸¸ã´ã·ãã¯ä½ãé§éã§ããã¹ãããªã¹ã¯ãªãããã¤ãã«å®æããã¾ããï¼
ãã¡ãããã¯ã³ã¿ããã§å ã«æ»ãäºãã§ãã¾ãã®ã§ãå®å¿ãã ããã
å¤æ´å 容
Part1ããã®å¤æ´å 容ã¯ä»¥ä¸ã®ã¨ããã§ãã
- ã¹ã¯ãªããã®å®è¡é »åº¦ãå¢å
- ã¤ã³ã¹ãã¼ã«ï¼ã¢ã³ã¤ã³ã¹ãã¼ã«ã®ç°¡ç´ å
- ä¸ç¬ã³ãã³ãããã³ããã表示ãããåé¡ã解æ¶
ã¹ã¯ãªããã®å®è¡é »åº¦ãå¢å
以åã®è¨äºã«æ¸ããã¹ã¯ãªããã§ã¯ã/onlogon
ã¤ã¾ããPCã®é»æºãå
¥ãã度ã«å¿ã
ããã¢ãããã¼ããããªã«ããªã¼ãã¦ããã¦ãã¾ãã
ã¨ããããå½ç¶ã¨ããã°å½ç¶ãã¢ãããã¼ãã¯é»æºãå ¥ã£ã¦ããã¨ãã«è¡ãããããããã¾ã«æ¸¸ã´ã·ãã¯ä½ã§ç«ã¡ä¸ããã¨ããããã¾ãã
ä»æ¹ãªãã®ã§æ¸¸ã´ã·ãã¯ä½ãåºç¾ããæã¯ãæ³£ãæ³£ãExcelãéãã¦ã¹ã¯ãªãããç´æ¥å®è¡ã»ã»ã»ãã¦ããã®ã§ãããããã¯ããã§é¢åã§ãã
ã¾ãã¯ãããæ¹åãããã
ã¨ããããã§ã»ã»ã»1åæ¯ã«æ´æ°ããããã«ãã¦ã¿ã¾ããã
ã¿ã¹ã¯ã®å®è¡ã®ã¿ã¤ãã³ã°ã1åæ¯ã«è¨å®ããæã¯ã/sc minute /mo 1
ã¨æ¸ãããã§ãã
schtasks /create /tn "MyTask" /tr "hogehoge.vbs" /sc minute /mo 1
ã¤ã³ã¹ãã¼ã«ï¼ã¢ã³ã¤ã³ã¹ãã¼ã«ã®ç°¡ç´ å
ãããã游ã´ã·ãã¯ä½ãé§éããã«ã¯ãåæè¨å®ã¨ãã¦å¤æ°ã®è¨å®å¤æ´ãå¿ è¦ã§ãæ°ããç°å¢ã«çµã¿è¾¼ãã®ãé¢åã§ãã
ã§ããã°å ¨ã¦ã®è¨å®ãã¯ã³ã¯ãªãã¯ã§è¡ãããã
ããã«å®è¡é »åº¦ãä¸ãããã¨ã§ã游ã´ã·ãã¯ä½ã®åãæ¶ããå°é£ã«ãªã£ãã®ã§ãã¢ã³ã¤ã³ã¹ãã¼ã«ããããã
ã¨ããããã§ãã¤ã³ã¹ãã¼ã«ï¼ã¢ã³ã¤ã³ã¹ãã¼ã«ç¨ã®vbsãæ¸ãã¦ã¿ã¾ãããï¼ã³ã¼ãå ¨æã¯å¾ã»ã©ï¼
ã¢ã³ã¤ã³ã¹ãã¼ã«å¦çã®ã¤ã¡ã¼ã¸ã¯ããã£ã¨ãããªã¨ããã§ãã
- ã¿ã¹ã¯ã¹ã±ã¸ã¥ã¼ã©ããã®åé¤
wsh.exec "schtasks /delete /tn """ & APP_NAME & """ /F"
- æ¸ãæããã¬ã¸ã¹ããªã®åé¤
wsh.RegDelete "HKCR\.xls\ShellNew\FileName"
- ãã¼ã¿ãã¡ã¤ã«ã®åé¤
- ãã³ãã¬ã¼ããã¡ã¤ã«ã®åé¤
- æ°è¦ä½æãã¡ã¤ã«ã®åé¤
fso.DeleteFile "C:\Program Files\Microsoft Office\root\VFS\Windows\SHELLNEW\EXCEL12.XLSX"
ä¸ç¬ã³ãã³ãããã³ããã表示ãããã®ã解æ¶
Windowsã«ã¯ãvbsãå®è¡ããããã®ããã°ã©ã ã2種é¡çµã¿è¾¼ã¾ãã¦ãã¾ãã
cscript | wscript | |
---|---|---|
å©ç¨æ³å®ç°å¢ | ã³ã³ã½ã¼ã«åã | 対話åã |
ã¡ãã»ã¼ã¸ããã¯ã¹ | ç¡è¦ | ã¦ã¼ã¶ã¼ã®å¿çå¾ ã¡ |
ã³ãã³ãããã³ãã | ä¸ç¬è¡¨ç¤ºããã | 表示ãããªã |
ãªããåè¨äºã®ã¹ã¯ãªããã¯cscript
ã使ã£ã¦ãããããwscript
ã«å¤æ´ãã¾ããã
ã¡ãªã¿ã«ãvbsãããã«ã¯ãªãã¯å®è¡ããã¨ãã«é»ãç»é¢ãè¦ããå ´åã¯ãvbsã®é¢é£ä»ããcscript
ã«ãªã£ã¦ãããã¨ã示ãã¦ãã¾ãã
ã³ãã³ãããã³ããã§ãcscript //h:wscript
ã¨å®è¡ããã°é¢é£ä»ããåãæ¿ããããã§ãã
ãããwscript
ã«å¤æ´ãããã¨ã§ä¸ã¤ã ãåé¡ãããã¾ãã
ä¸è¨ã®è¡¨ã®éãã¡ãã»ã¼ã¸ããã¯ã¹ã®æåãå¤ãããããã®ã§ãã
ã¹ã¯ãªããã®æ«å°¾ã«ã¯ä»¥ä¸ã®ãããªã³ã¼ããæãã¾ããã
MsgBox "å®äº",, "Excel ãã©ã³ãèªåå¤æ´"
å¾ã£ã¦ã以åã®ã³ã¼ãã§ã¯ç¡è¦ããã¦ããã®ã§ããããã®ã¡ãã»ã¼ã¸ã表示ããã¦ãã¾ãããã«ãªãã¾ããã
å®è¡é »åº¦ã1åæ¯ã«å¤ããããããã®ã¾ã¾ã§ã¯ä»¥ä¸ã®ã¡ãã»ã¼ã¸ããã¯ã¹ã1åãã¨ã«åºã¦ãã¾ããç¬ãã¾ãããã
--------------------------- Excel ãã©ã³ãèªåå¤æ´ --------------------------- å®äº --------------------------- OK ---------------------------
ã¨ããããã§ãExcel_FontChange.vbs
ã®å®è¡æãã©ã¡ã¼ã¿ã«/hide
ã追å ãã¦ã
- ããã«ã¯ãªãã¯æã¯ãå®äºãã表示
- ã¿ã¹ã¯ã¹ã±ã¸ã¥ã¼ã©ããã®èµ·åæã¯ä½ã表示ããªã
ã¨ããåãã«ãªãããã«èª¿æ´ãã¾ããã
wsh.exec "schtasks /create /tn " & APP_NAME & " /tr ""wscript \""" & VBS_PATH & "\"" \""/hide\"""" /sc minute /mo 1 /rl highest /F"
ãã®ããã«ã¯ã©ã¼ãã¼ã·ã§ã³ã®æ°ã®èª¿æ´ã«ã¨ã¦ãè¦å´ãã¾ããã
ã³ãã³ãããã³ããã§é常ã®exeã1åæ¯ã«ç®¡çè ã¨ãã¦å®è¡ããã¿ã¹ã¯ãç»é²ããæã¯ããã§ãã
schtasks /create /tn ã¿ã¹ã¯å /tr hoge.exe /sc minute /mo 1 /rl highest /F
ãããå®è¡ãã¡ã¤ã«ã®ãã¹ã«åè§ã¹ãã¼ã¹ãå«ã¾ããå ´åã¯ãããã«ã¯ã©ã¼ãã¼ã·ã§ã³ã§å²ãå¿ è¦ããã"æåå"`ã¨ãã¾ãã
schtasks /create /tn ã¿ã¹ã¯å /tr "C:\Program Files\fuga\hoge.exe" /sc minute /mo 1 /rl highest /F
ç»é²ããexeã«å®è¡æãã©ã¡ã¼ã¿/hide
ã渡ãå ´åã¯`"å®è¡ããã°ã©ã (åè§ã¹ãã¼ã¹)ãã©ã¡ã¼ã¿"ã¨ãã¾ãã
schtasks /create /tn ã¿ã¹ã¯å /tr "C:\Program Files\fuga\hoge.exe /hide" /sc minute /mo 1 /rl highest /F
ã¨ããããå®è¡æãã©ã¡ã¼ã¿ã«ãã¹ã渡ãã¨ãªãã¨ãããã«åè§ã¹ãã¼ã¹ãå«ãã§ããäºããããããã³ã³ã§ããã«ããã«ã¯ã©ã¼ãã¼ã·ã§ã³ã§å²ãæªç½®ãå¿ è¦ã«ãªãã¾ãã
ãããããã®å ´åã¯ã¨ã¹ã±ã¼ãããå¿
è¦ãããããã§ã\"æåå\"
ã¨ããããã§ãã
/hide
ã®ããã«åè§ã¹ãã¼ã¹ãå«ã¾ãªãã®ã§ããã°ä¸è¨ã®ããã«ç©ºæ¬ã§ãOKã§ãã
schtasks /create /tn ã¿ã¹ã¯å /tr "C:\Program Files\fuga\hoge.exe \"C:\Program Files\hoge\fuga.vbs\" /hide" /sc minute /mo 1 /rl highest /F
ããã¾ã§ã³ãã³ãããã³ããï¼batï¼ã®å ´åã§ããããvbsã«ããã¨schtasks
ãå®è¡ããã°ã©ã ã«ãªãã®ã§ãæ´ã«å
¨ä½ãããã«ã¯ã©ã¼ãã¼ã·ã§ã³ã§å²ããªããã°ãªãã¾ããã
vbsã«ãããã¨ã¹ã±ã¼ãæåã¯ããã«ã¯ã©ã¼ãã¼ã·ã§ã³ã¯""
ï¼ããã«ã¯ã©ã¼ãã¼ã·ã§ã³ï¼ã¤ï¼ãªã®ã§ããã®ããã«ä¿®æ£ããã¨ãããªãã¾ãã
wsh.exec "schtasks /create /tn ã¿ã¹ã¯å /tr ""C:\Program Files\fuga\hoge.exe \"C:\Program Files\hoge\fuga.vbs\" /hide"" /sc minute /mo 1 /rl highest /F"
ãããã¦ãæåã«è¨è¼ãããããªã³ã¼ããçã¾ãã¾ããã
ã¹ã¯ãªãã
管çè 権éã«ææ ¼
ã¹ã¯ãªããã管çè 権éã§å®è¡ãããããã«ãèªåèªèº«ãææ ¼ãã¦åå®è¡ãããããã®ã¹ã¯ãªããã§ãã
ã¿ã¹ã¯ã¹ã±ã¸ã¥ã¼ã©ã«ç»é²ããæç¹ã§ã管çè 権éã§å®è¡ããããã«ç»é²ããããæ¬æ¥ã¯å¿ è¦ãªãã®ã§ãããvbsãããã«ã¯ãªãã¯ãã¦ç´æ¥èµ·åãããã¨ããããã®ã§ãåºæ¬çã«vbsã«ã¯å ¥ããããã«ãã¦ãã¾ãã
ããã·ã¼ã¸ã£CheckAdmin()
ã«æ¼ãè¾¼ãã§ããã®ã¯ãä¸è¦ç¡æå³ã«è¦ãã¾ãããå¤æ°ã®ã¹ã³ã¼ããå¶éãã¦ãå¾ã
ã®ã¹ã¯ãªããã¨ç«¶åãèµ·ãããªãããã®å·¥å¤«ã«ãªãã¾ãã
vbsã«ã¤ãã¦æ·±ãåå¼·ãããã¨ããªãããããããä¸è¬çãªææ³ãªã®ãã©ããã¯ç¥ãã¾ããã
ã¤ã³ã¹ãã¼ã«ãããExcelã®ãã¹ã®ç¢ºèª
EXCEL.EXE
ãæå®ã®å ´æã«ãããã©ããã§ãã¤ã³ã¹ãã¼ã«ããã¦ããExcelã32bitçã64bitçããå¤å®ãããã³ãã¬ã¼ããã©ã«ããªã©ãå¤åãã¾ãã
ä»å¾ã®ã¢ãããã¼ããªã©ã§ãã¹ãå¤ããã¨ãä¸è¨ã®2ç®æãå¤æ´ããªãã¨ãããªãããããã¾ããã
æ¬ãã¼ã«ã®ã¤ã³ã¹ãã¼ã«å
ã¯ãOSã®ãããæ°ãOfficeã®ãã¼ã¸ã§ã³ã«é¢ä¿ãªãC:\Program Files\Excel_FontChange\
åºå®ã§ãã
ä¾ãã°2016ããå¢ãã¦ããUWPçã«ã¯å¯¾å¿ãã¦ãã¾ããã
Excel_FontChange.vbsã®æ¬ä½
ã¿ã¹ã¯ã¹ã±ã¸ã¥ã¼ã©ããå¼ã°ããã¹ã¯ãªããã«é¢ãã¦ã¯ã次ã®ããã«æ¹å¤ãã¾ããã
- 管çè 権éã«ææ ¼
- ã¤ã³ã¹ãã¼ã«ãããExcelã®ãã¹ã®ç¢ºèª
- "EXCEL8.XLS", "EXCEL12.XLSM", "EXCEL12.XLSX"ã®æ´æ°
Excel_FontChange_Install.vbs
ã®æ¬ä½
èªåã¤ã³ã¹ãã¼ã«ãè¡ãã¹ã¯ãªããã«é¢ãã¦ã¯ã次ã®ãããªæ§æã§ãã
管çè 権éã«ææ ¼
ã¤ã³ã¹ãã¼ã«ãããExcelã®ãã¹ã®ç¢ºèª
ã¤ã³ã¹ãã¼ã«ï¼ã¢ã³ã¤ã³ã¹ãã¼ã«ãé¸æ
ã¤ã³ã¹ãã¼ã«ã®å ´å
- Excelã®ãªãã·ã§ã³ã®ãã©ã³ãå¤æ´
vb wsh.RegWrite "HKCU\Software\Microsoft\Office\16.0\Excel\Options\Font", "ï¼ï¼³ ï¼°ã´ã·ãã¯,11", "REG_SZ"
- ãã³ãã¬ã¼ãï¼æ°è¦ä½æã®ãã¡ã¤ã«äºåæºå
vb fso.CopyFolder gScriptPath & APP_NAME, Left(APP_PATH, Len(APP_PATH) - 1), True
- 1åããã«å®è¡ããã¿ã¹ã¯ã¹ã±ã¸ã¥ã¼ã©ç»é²
vb wsh.exec "schtasks /create /tn " & APP_NAME & " /tr ""wscript \""" & VBS_PATH & "\"" \""/hide\"""" /sc minute /mo 1 /rl highest /F"
- ç´ã¡ã«ãã©ã³ãæ¸ãæããå®è¡
vb wsh.exec "schtasks /run /tn " & APP_NAME & ""
- xlsxã®æ°è¦ä½æã®ãã³ãã¬ã¼ã(EXCEL12.XLSX)ãããã¯ã¢ãã
vb fso.CopyFile PATH_NEW & "EXCEL12.XLSX", PATH_NEW & "EXCEL12_base.XLSX"
- æ°è¦ä½æã¬ã¸ã¹ããªã®ç»é²
vb wsh.RegWrite "HKCR\.xls\ShellNew\FileName", PATH_NEW & "EXCEL8.XLS", "REG_SZ"
ã¢ã³ã¤ã³ã¹ãã¼ã«ã®å ´å
- ã¿ã¹ã¯ã¹ã±ã¸ã¥ã¼ã©ããã®åé¤
vb wsh.exec "schtasks /delete /tn """ & APP_NAME & """ /F"
- æ¸ãæããã¬ã¸ã¹ããªã®åé¤
vb wsh.RegDelete "HKCR\.xls\ShellNew\FileName"
- ãã¼ã¿ãã¡ã¤ã«ã®åé¤
- ãã³ãã¬ã¼ããã¡ã¤ã«ã®åé¤
- æ°è¦ä½æãã¡ã¤ã«ã®åé¤
vb fso.DeleteFile "C:\Program Files\Microsoft Office\root\VFS\Windows\SHELLNEW\EXCEL12.XLSX"
å¾®å¦ã«è¦å´ããã®ããæ°è¦ä½æã«*.xlsã追å ããæ¹æ³ã§ãå¾æ¥(Excel 2007,2010)ã®é ã¯"HKCR.xls\ShellNew\FileName"ã«è¿½å ããã ãã§è¯ãã£ãã®ã§ãããExcel 2016ãOffice365ã§ã¯ã³ã³ã«æ¸ãè¾¼ãã ã ãã§ã¯å¢ãã¾ããã
試è¡é¯èª¤ããçµæã"HKCU\Software\Classes\xls_auto_file"
ã«ãã¡ã¤ã«ã®ç¨®é¡ãæ¸ãè¾¼ããã¨ã§ãæ°è¦ä½æãæå¹ã«ãªããã¨ããããã¾ããã
ã¡ãªã¿ã«ãã®é¨åãæ°è¦ä½æã¡ãã¥ã¼ã®å称ã«ãªã£ã¦ããããã§ãã
ãã£ã¨ç©ºæ¬ã ã¨ã¡ãã¥ã¼è¡¨ç¤ºåºæ¥ãªãã£ã¦ãã¨ãªãã§ããããã
wsh.RegWrite "HKCR\.xls\ShellNew\FileName", PATH_NEW & "EXCEL8.XLS", "REG_SZ" Rem [ãã¡ã¤ã«ã®ç¨®é¡]ã®å®ç¾©ãã³ã³ã空æ¬ã ã¨ShellNewã«ç»é²ãã¦ãã¡ãã¥ã¼ã«å¢ããªãã wsh.RegWrite "HKCU\Software\Classes\xls_auto_file", "Microsoft Excel 97-2003 äºæããã¯", "REG_SZ" Rem æ¢å®å¤ã¯\ã§çµäº wsh.RegWrite "HKCR\xls_auto_file\", "Microsoft Excel 97-2003 äºæããã¯", "REG_SZ"
å®æåãã¼ã¿ä¸å¼ãã¦ã³ãã¼ã
ãã¦ã³ãã¼ã
游ã´ã·ãã¯ä½ãé§éããããã®ã¹ã¯ãªããã»ãã³ãã¬ã¼ãä¸å¼ãè©°ãè¾¼ãã ZIPããGitHubã«ã¦å ¬éãã¾ããã
GitHubãªãã¸ããªãé²è¦§
注æ
Officeã®ã¤ã³ã¹ãã¼ã«æ¹æ³ã«ãã£ã¦ã¯åä½ãã¾ããã
æ¨ä»ã¯Windows10ã«UWPçãããªã¤ã³ã¹ãã¼ã«ããã¦ãããã¨ãå¤ãã®ã§ãç¥ããã«UWPçã使ã£ã¦ãã人ãå¢ãã¦ãã¾ãããUWPçã§ã¯å¶ç´ãããåä½ãã¾ããã
åé¡ãèµ·ãã人ã¯Microsoftã®Officeåé¤ãã¼ã«ãªã©ã§å®å ¨æ¶å»ãã¦ãããå ¬å¼ã®ãªã³ã©ã¤ã³ãã¦ã³ãã¼ãã«ã¦ãã¹ã¯ãããçã¢ããªãå ¥ãç´ãããã«ãããã¨ãæ¨å¥¨ãã¾ãã
æ ã·ã¹ã®æ¹ã¯ãã¹ã¯ãããã¢ããªçã«å ¥ãæ¿ãã¦ããåºè·ãã¦ãããã¨è¯ããã¨æãã¾ãã
ã¾ã¨ã
ã¨ãããããããã§ã·ãã³ã¤æ¸¸ã´ã·ãã¯ä½ãããExcelãå®ãè¡ãæã«å ¥ãã¾ããï¼
ãã£ã¨ãã£ã¨Excelãå¿«é©ã«ä½¿ããããã«ãã¦ããã¾ãããâª
以ä¸
2019/7/21 ç¶ç·¨ãå·çãã¾ããã
ä½ã御座ãã¾ãããã³ã¡ã³ãæ¬ãã¾ãã¯Twitterããã©ããâª
ããã§ã¯ã¾ãæ¥é±âªãã¡ã ãã¡ã ã(ã»8ã»)