2021年3月7日 星期日

只要用滑鼠點兩下,開啟與關閉五種不同瀏覽器瀏覽特定的網頁_使用教學

   延伸想法:
           1.一次設定,大量產生中文批次檔來管理
           2.一次設定,產生帶有連結的網頁
   本篇文章之目的是教大家如何修改程式碼,來符合需求。強調的是教學
   在日後的架構所佔的位置如下:

零、初始目的:
       最近想要用不同的瀏覽器去開啟相同網頁,測試HTML5、PHP、Javascript與jQuery的效果。發現要點好幾次瀏覽器。覺得很麻煩!!根據1.利用BAT 讓Chrome瀏覽器自動開啟網頁與關閉網頁,發現只能開啟預設瀏覽器。那預設瀏覽器不是Chrome、FireFox等就有點麻煩。因此,想要讓自己開發方便,只要點兩下,就能用五種不同的瀏覽器開啟相同的網頁。

一、使用步驟:
1.確認自己要檢視的網頁
2.確認使用者名稱
3.複製修改OpenDifferentBrowsersIf.bat
4.對OpenDifferentBrowsersIf.bat點兩下

二、對各步驟詳細解說:
1.確認自己要檢視的網頁
      在Windows 主機開發php、javascript、jQuery等程式,我們會在本機觀看自己開發的網頁效果,比方說我們要檢視的網頁為 http://127.0.0.1/test.php

2.確認使用者名稱
比方說我們的使用者名稱為m

3.複製修改OpenDifferentBrowsersIf.bat
檔案名稱:OpenDifferentBrowsersIf.bat
檔案內容:
@echo off
REM 設定指定的網頁
set homepage01=http://127.0.0.1/test.php
REM 設定使用者
set UserName=m
REM 以IE瀏覽器開啟google網頁
if exist "C:\Program Files\Internet Explorer\iexplore.exe" (
  start C:\"Program Files\Internet Explorer\iexplore.exe" %homepage01%
)
REM 以Chrome瀏覽器開啟google網頁
if exist "C:\Program Files\Google\Chrome\Application\chrome.exe" (
  start C:\"Program Files\Google\Chrome\Application\chrome.exe" %homepage01%
)
REM 以Firefox瀏覽器開啟google網頁
if exist "C:\Program Files\Mozilla Firefox\firefox.exe" (
  start C:\"Program Files\Mozilla Firefox\firefox.exe" %homepage01%
)
REM 以Edge瀏覽器開啟google網頁
if exist "C:\Windows\SystemApps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\MicrosoftEdge.exe" (
  start microsoft-edge:%homepage01%
)
REM 以Opera瀏覽器開啟google網頁
if exist "C:\Users\%UserName%\AppData\Local\Programs\Opera\launcher.exe" (
  start C:\"Users\%UserName%\AppData\Local\Programs\Opera\launcher.exe" %homepage01%
)
 
4.對OpenDifferentBrowsersIf.bat點兩下

三、影片教學:
     現在將上述的使用步驟,以影片教學的方式呈現,希望能夠讓大家更清楚。

2021年3月5日 星期五

只要用滑鼠點兩下,開啟與關閉五種不同瀏覽器瀏覽特定的網頁

    最近想要用不同的瀏覽器去開啟相同網頁,測試HTML5、PHP、Javascript與jQuery的效果。發現要點好幾次瀏覽器。覺得很麻煩!!根據1.利用BAT 讓Chrome瀏覽器自動開啟網頁與關閉網頁,發現只能開啟預設瀏覽器。那預設瀏覽器不是Chrome、FireFox等就有點麻煩。因此,想要讓自己開發方便,只要點兩下,就能用五種不同的瀏覽器開啟相同的網頁。最下面

        現在將自己構思的想法整理成心智圖,其心智圖(可下載)如下:


        後來經過測試,發現三個問題,其具體說明如下:
   1.Windows 7的時代瀏覽器有64位元與32位元,Windows 10的時代瀏覽器都改為64位元。而Windows 7 以已於2020年1月14日停止更新,所以採用64位元的瀏覽器寫法。
   2.此外,IE、Edge、Chrome與FireFox會安裝在特定位置,但是Opera瀏覽器卻會安裝在使用者的AppData下。問題是使用者的名稱會變動。
   3.Windows 10 的Edge的使用方式跟IE、Chrome與FireFox等方式不同。使用方式為      start microsoft-edge:特定網頁,例如:   start microsoft-edge:https://www.google.com.tw

五個瀏覽器安裝位置如下:
chrome位置
C:\Program Files\Google\Chrome\Application\chrome.exe
opera位置
C:\Users\使用者名稱\AppData\Local\Programs\Opera\launcher.exe
firefox位置
C:\Program Files\Mozilla Firefox\firefox.exe
IE位置
C:\Program Files\Internet Explorer\iexplore.exe
Edge位置
C:\Windows\SystemApps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\MicrosoftEdge.exe  

        本程式是用來說明比較"的位置不同,導致開啟的瀏覽器是預設的瀏覽器還是指定的瀏覽器。即使我們找到了程式位置,卻會因為"的位置不同,導致結果非預想的那樣。
檔案名稱:OpenDifferentBrowsersCompare.bat
檔案內容:
@echo off
REM 設定指定的網頁
set homepage01=https://www.google.com.tw
REM 設定使用者
set UserName=mark2470mark
REM 以windows 預設瀏覽器開啟google網頁 
start "C:\Program Files\Internet Explorer\iexplore.exe" %homepage01%
start "C:\Program Files\Google\Chrome\Application\chrome.exe" %homepage01%
start "C:\Program Files\Mozilla Firefox\firefox.exe" %homepage01%
start "C:\Windows\SystemApps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\MicrosoftEdge.exe" %homepage01%
start "C:\Users\%UserName%\AppData\Local\Programs\Opera\launcher.exe" %homepage01%
REM 以IE瀏覽器開啟google網頁
start C:\"Program Files\Internet Explorer\iexplore.exe" %homepage01%
REM 以Chrome瀏覽器開啟google網頁
start C:\"Program Files\Google\Chrome\Application\chrome.exe" %homepage01%
REM 以Firefox瀏覽器開啟google網頁
start C:\"Program Files\Mozilla Firefox\firefox.exe" %homepage01%
REM 以Edge瀏覽器開啟google網頁
start "C:\Windows\SystemApps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\MicrosoftEdge.exe" %homepage01%
REM 以Opera瀏覽器開啟google網頁
start C:\"Users\%UserName%\AppData\Local\Programs\Opera\launcher.exe" %homepage01%

       值得注意的是下列程式碼,均是開啟Windows預設瀏覽器。
start "C:\Program Files\Internet Explorer\iexplore.exe" %homepage01%
start "C:\Program Files\Google\Chrome\Application\chrome.exe" %homepage01%
start "C:\Program Files\Mozilla Firefox\firefox.exe" %homepage01%
start "C:\Windows\SystemApps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\MicrosoftEdge.exe" %homepage01%
start "C:\Users\%UserName%\AppData\Local\Programs\Opera\launcher.exe" %homepage01%

       只有將這個符號",移往C:\後,即是C:\",才會開啟相對應的瀏覽器,如下
REM 以IE瀏覽器開啟google網頁
start C:\"Program Files\Internet Explorer\iexplore.exe" %homepage01%
REM 以Chrome瀏覽器開啟google網頁
start C:\"Program Files\Google\Chrome\Application\chrome.exe" %homepage01%
REM 以Firefox瀏覽器開啟google網頁
start C:\"Program Files\Mozilla Firefox\firefox.exe" %homepage01%
REM 以Edge瀏覽器開啟google網頁
start C:\"Windows\SystemApps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\MicrosoftEdge.exe" %homepage01%
REM 以Opera瀏覽器開啟google網頁
start C:\"Users\%UserName%\AppData\Local\Programs\Opera\launcher.exe" %homepage01%

       因此,只要將OpenDifferentBrowsersCompare.bat修正。刪除預設瀏覽器的部分,就可得到我們要的,開啟不同的瀏覽器。
檔案名稱:OpenDifferentBrowsers.bat
檔案內容:
@echo off
REM 設定指定的網頁
set homepage01=https://www.google.com.tw
REM 設定使用者
set UserName=mark2470mark
REM 以IE瀏覽器開啟google網頁
start C:\"Program Files\Internet Explorer\iexplore.exe" %homepage01%
REM 以Chrome瀏覽器開啟google網頁
start C:\"Program Files\Google\Chrome\Application\chrome.exe" %homepage01%
REM 以Firefox瀏覽器開啟google網頁
start C:\"Program Files\Mozilla Firefox\firefox.exe" %homepage01%
REM 以Edge瀏覽器開啟google網頁
start microsof-edge:%homepage01%
REM 以Opera瀏覽器開啟google網頁
start C:\"Users\%UserName%\AppData\Local\Programs\Opera\launcher.exe" %homepage01%

       有時,該瀏覽器並未安裝,需要一個判斷式來判斷。電腦內沒有的瀏覽器就不會開啟。因此,我們修改OpenDifferentBrowsers.bat,加上判斷式。其程式碼如下:

檔案名稱:OpenDifferentBrowsersIf.bat
檔案內容:
@echo off
REM 設定指定的網頁
set homepage01=https://www.google.com.tw
REM 設定使用者
set UserName=mark2470mark
REM 以IE瀏覽器開啟google網頁
if exist "C:\Program Files\Internet Explorer\iexplore.exe" (
  start C:\"Program Files\Internet Explorer\iexplore.exe" %homepage01%
)
REM 以Chrome瀏覽器開啟google網頁
if exist "C:\Program Files\Google\Chrome\Application\chrome.exe" (
  start C:\"Program Files\Google\Chrome\Application\chrome.exe" %homepage01%
)
REM 以Firefox瀏覽器開啟google網頁
if exist "C:\Program Files\Mozilla Firefox\firefox.exe" (
  start C:\"Program Files\Mozilla Firefox\firefox.exe" %homepage01%
)
REM 以Edge瀏覽器開啟google網頁
if exist "C:\Windows\SystemApps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\MicrosoftEdge.exe" (
  start microsoft-edge:%homepage01%
)
REM 以Opera瀏覽器開啟google網頁
if exist "C:\Users\%UserName%\AppData\Local\Programs\Opera\launcher.exe" (
  start C:\"Users\%UserName%\AppData\Local\Programs\Opera\launcher.exe" %homepage01%
)

程式目的:一次關閉五種瀏覽器IE、Chrome、Firefox、Edge、Opera
檔案名稱:StopDifferentBrowsers.bat
檔案內容:
@echo off
REM 關閉IE
taskkill /im iexplore.exe /f
REM 關閉Chrome
taskkill /im chrome.exe /f
REM 關閉Firefox
taskkill /im firefox.exe /f
REM 關閉Edge
taskkill /im MicrosoftEdge.exe /f
REM 關閉Opera
taskkill /im opera.exe /f


資料來源: 





2021年3月4日 星期四

只要會用滑鼠點兩下,一鍵設定電腦主機手動校時與開機完成自動校時

 感恩彰興國中陳宏盈組長協助

一鍵完成電腦手動校時
當電腦主機無法自動校時,如何手動校時?一步一步設定太麻煩了,可不可寫個BAT,用滑鼠點兩下就完成校時呢?

一鍵設定電腦開機自動校時
當電腦主機無法自動校時,如何開機完成後就進行校時。一步一步設定太麻煩了,可不可寫個bat,當主機開完機,就自動進行校時。

如何使用?
1.請先確認

2.檔案下載,解壓密碼demo1234

3.解壓縮AutoNtpDate.rar->產生資料夾AutoNtpDate
4.對資料夾AutoNtpDate內的Copy2Startup.bat點兩下,即完成設定。


一鍵完成電腦主機手動校時
檔名:NtpDate.BAT
內容:
@echo off
REM :: BatchGotAdmin (Run as Admin code starts)
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B
:gotAdmin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
pushd "%CD%"
CD /D "%~dp0"
REM :: BatchGotAdmin (Run as Admin code ends)
REM :: Your codes should start from the following line
@echo off
net start w32time
w32tm /config /update /manualpeerlist:"time.stdtime.gov.tw,0x1 watch.stdtime.gov.tw,0x1"
w32tm /resync
net stop w32time
PAUSE
EXIT

將NtpDate.BAT複製到開機啟動資料夾,重啟電腦主機
檔名:Copy2Startup.BAT
內容:
@echo off
REM :: BatchGotAdmin (Run as Admin code starts)
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B
:gotAdmin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
pushd "%CD%"
CD /D "%~dp0"
REM :: BatchGotAdmin (Run as Admin code ends)
REM :: Your codes should start from the following line
@echo off
copy "%~dp0\NtpDate.BAT" "%HomePath%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"
shutdown /r /f /t 0


CPP關於資料結構Stack堆疊的資料

         目前發現CPP對於理解資料結構,真的很好用。此外,還有很多文章能夠促進理解資料結構。因此,闢一個文章,來收集各家對資料結構Stack的解說。如果可以,甚至節錄程式碼。



一、用陣列Array 來寫
01檔名:StackArray01.cpp
內容:
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#define MAX_SIZE 10
void push(int);
void pop(void);
int stack[MAX_SIZE];
int top = 0;
using namespace std;
int main(void) {
    push(0);
    push(1);
    push(2);
    pop();
    pop();
    push(3);
    push(4);
    pop();
    pop();
    pop();
    push(5);
    push(6);
    push(7);
    pop();
    pop();
    pop();

    system("pause");
}
void push(int data) {
if (top == MAX_SIZE) {
cout <<"The Stack is full "<<endl;
} else {
stack[top]=data;
top++;
}
}
void pop(void) {
if (top == 0) {
cout <<"The Stack is empty "<<endl;
} else {
cout <<stack[--top]<<endl;
}
}
輸出結果

02檔名:StackArray02.cpp
內容:
#include <iostream>
using namespace std;

int stack[105],stack_top;
int main() {
string cmd;
int i,j;
stack_top = 0;
cout <<"When the command is 'push 3' We push 3 into the stack!\n";
cout <<"When the command is 'pop' ,we get a element from the stack!\n";
cout <<"When the command is 'All' ,we will get all elements of the stack!\n";
cout <<"When the command is 'exit' ,we will quit the program!\n";
while(cin >> cmd) {
if(cmd == "push") {
cin >> i;
stack[stack_top]=i;
cout <<"stack["<<stack_top<<"]= "<<stack[stack_top]<<endl;
stack_top++;
} else if (cmd == "pop"){
if(stack_top==0) {
cout << "pop: nothing in stack"<<endl;
} else {
cout << "pop: " <<stack[stack_top-1] <<endl;
stack_top--;
}
}
if(cmd == "exit") {
break;
}
if(cmd == "All") {
   for(j=stack_top-1;j>=0;j--) {
    cout <<"stack["<<j<<"]="<<stack[j]<<endl;
   }
}
}
return 0;
}
03檔名:StackArray03.cpp
內容:
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
typedef struct stack {
int top;
int maxTop;
int *data;
}stack_t;
void create_stack(stack_t *st,int size) {
st->top=-1;
st->maxTop=size-1;
st->data=(int *)malloc(sizeof(int)*size);
}
int isEmpty(stack_t *st) {
if (st->top==-1) {
return 1;
}
return 0;
}
int isFull(stack_t *st) {
if (st->top==st->maxTop) {
return 1;
}
return 0;
}
void push(stack_t *st,int num) {
if (isFull(st)==1) {
printf("The stack is full.\n");
} else {
st->top++;
st->data[st->top] = num;
//printf(" st->top is %d\t",st->top);
//printf("st->data[st->top] is %d\n",st->data[st->top]);
}
}
int pop(stack_t *st) {
int TempInt;
if (isEmpty(st)==1) {
printf("The stack is empty.\n");
} else {
TempInt = (st->data[st->top]);
st->top--;
}
return TempInt;
}

void print(stack_t *st) {
if (isEmpty(st)==1) {
printf("The stack is empty.\n");
} else {
for(int i=0;i<=st->top;i++) {
printf(" %d",st->data[i]);
}
printf("\n");
}
}

int main() {
stack_t *s = (stack_t *)malloc(sizeof(stack_t));
printf("Create a stack which size is 5.\n");
create_stack(s,5);
printf("Push:1,2,3,4,5\n");
for(int i=1;i<6;i++) {
push(s,i);
}
print(s);
printf("1st pop,the top is %d.\n",pop(s));
print(s);
printf("2nd pop,the top is %d.\n",pop(s));
print(s);
return 0;
}

04檔名:StackArray04.cpp
內容:
#include <stdio.h>
#include <stdlib.h>
#include <conio.h> 
#define MAX 10
void push_f(void);
void pop_f(void);
void list_f(void);
char item[MAX][20];
int top = -1;

int main() {
char option;
while(1) {
printf("\n ----------------------------------\n");
printf(" (1) insert (push)\n");
printf(" (2) delete (pop)\n");
printf(" (3) list\n");
printf(" (4) quit\n");
printf("\n ----------------------------------\n");
printf(" Please enter your choice...");
option = getche();
switch(option) {
case '1':
push_f();
break;
case '2':
pop_f();
break;
case '3':
list_f();
break;
case '4':
printf("\n");
return 0;
}
}
}
void push_f(void) {
if (top>=MAX-1) {
printf("\nStack is full !\n");
} else {
top++;
printf("\n Please enter item to insert: ");
gets(item[top]);
}
}
void pop_f(void) {
if (top<0) {
printf("\nNo item,stack is empty!\n");
} else {
printf("\n Item %s deleted \n",item[top]);
top--;
}
}
void list_f(void) {
int count = 0,i;
if (top < 0) {
printf("\nNo item,stack is empty!\n");
} else {
printf("\n Item\n");
printf("---------------------\n");
for(i=0;i<=top;i++) {
printf(" %-20s\n",item[i]);
count++;
if(count % 20 ==0) getch();
}
printf("---------------------\n");
printf("Total item: %d\n",count);
getch();
}
}


二、用鏈結串列LinkedList 來寫
檔名:StackLinkedList001.cpp
內容:

題目練習



二林國小紀明村老師的二林網管 PDO + SQLite 程式寫作工具箱2014.07

整理:

前篇:用shell 在 ubuntu 16.04 x64 桌面版本快速安裝 運動檢錄系統

         
        感恩二林國小紀明村老師的指導,提供二林網管 PDO + SQLite 程式寫作工具箱2014.07
可以快速產生php模組。

         但是有很多不懂,需要參考很多資料才能寫出模組。因此,將自己參考那些資料記錄下來。目前還不知道要處理的資料是哪個,只知道是SQLite。因此,要利用phpliteadmin。
我們現在要新增、修改、刪除學生。
從phpliteadmin可以看到資料庫名稱、資料表名稱與資料表架構
將此所得到的資訊依圖示順序填入,即可看到程式碼。

以下為phpliteadmin的安裝
1.安裝phpliteadmin
$wget https://bitbucket.org/phpliteadmin/public/downloads/phpLiteAdmin_v1-9-8-2.zip

2.建立phpliteadmin
$mkdir ~/html/phpliteadmin

3.解壓
$mv phpLiteAdmin_v1-9-8-2.zip ~/html/phpliteadmin/
$cd ~/html/phpliteadmin/
$unzip phpLiteAdmin_v1-9-8-2.zip

4.更名
$sudo mv phpliteadmin.config.sample.php phpliteadmin.config.php

5.更改admin密碼
$sudo geany phpliteadmin.config.php



6.更改資料庫位置。
$sudo geany phpliteadmin.config.php
由於資料庫的位置放在/home/Sport_data/
7.網頁瀏覽 http://伺服器IP/phpliteadmin/phpliteadmin.php

只要輸入步驟5.更改admin密碼的密碼,即可進入資料庫。

8.安全性設定



只要關燈,電腦自動關機(使用Arduino Leonardo)

 一、成果影片

二、應用情境:
1.夜深人靜,用完電腦。只想上床睡覺。只要關燈,電腦就關機。

三、使用技能:
1.使用Arduino Leonardo
2.光敏電阻-感應關燈
3.鍵盤-命令電腦關機

四、接線圖:

五、圖形化程式碼(ArduBlock):
六、Arduino 程式碼
檔名:ProjectNo0001
內容:
#include <Keyboard.h>

/*
 These core libraries allow the 32u4 and SAMD based boards 
 (Leonardo, Esplora, Zero, Due and MKR Family) 
 to appear as a native Mouse and/or Keyboard to a connected computer.
 */

void setup(){  // put your setup code here, to run once:
  Keyboard.begin(); // initialize control over the keyboard
  Keyboard.releaseAll();

}

void loop(){  // put your main code here, to run repeatedly:
  if ( analogRead( A0 ) < 600 ) {
    PcShutDown();
  }
}

void PcShutDown() { //customised function

    pinMode(4,INPUT_PULLUP); //make pin 4 an input and turn on the pullup resistor so it goes high unless connected to ground
  if(digitalRead(4)==LOW){  // do nothing until pin 4 goes low
    Keyboard.press(131); //the key to press (ASCII code)
  }
  pinMode(4,INPUT_PULLUP); //make pin 4 an input and turn on the pullup resistor so it goes high unless connected to ground
  if(digitalRead(4)==LOW){  // do nothing until pin 4 goes low
    Keyboard.press('r'); //the key to press (ASCII code)
  }
  Keyboard.releaseAll();

  pinMode(4,INPUT_PULLUP); //make pin 4 an input and turn on the pullup resistor so it goes high unless connected to ground
  if(digitalRead(4)==LOW){  // do nothing until pin 4 goes low
    Keyboard.print("shutdown /s /f /t 0"); //Send the message
  }
  Keyboard.releaseAll();

  pinMode(4,INPUT_PULLUP); //make pin 4 an input and turn on the pullup resistor so it goes high unless connected to ground
  if(digitalRead(4)==LOW){  // do nothing until pin 4 goes low
    Keyboard.press(176); //the key to press (ASCII code)
  }
  Keyboard.releaseAll();
  delay( 5000 ); // waits a few milliseconds 
}


資料來源:
1.【Arduino冷知識5】
3.

只要會用滑鼠點兩下,一鍵完成Windows 電腦滑鼠指標大小鍵設定

 情境說明:

        由於補校學生在學校電腦教室上電腦課。補校學生年紀大,經常找不到滑鼠。希望能夠讓補校學生一鍵完成Windows 電腦滑鼠指標大小鍵設定。或者是資訊組長需為補校學生設定滑鼠大小,但是一台一台設定太麻煩了。希望能夠一鍵完成Windows 電腦滑鼠指標大小鍵設定。

範例檔案,解壓密碼:demo1234
使用方法:
1.下載範例檔案
2.解壓縮,解壓密碼demo1234
3.0.對資料夾內的BigMouse.bat點兩下--->--->重開機,滑鼠指標變大,
3.1.對資料夾內的NormalMouse.bat點兩下--->重開機,滑鼠指標變正常大小
3.2.對資料夾內的MouseSettingShow.bat點兩下--->出現滑鼠設定面板。
以下方法分析:
一、使用Bat
        優點:完成之後即時生效,不需要重新開機。
        缺點: 一鍵出現面板,但還需選擇[設定]
        檔案名稱:MouseSettingShow.bat
        檔案內容:
        control main.cpl
      
二、使用Bat與Registry
        優點:確實可達到目的_一鍵完成設定。
        缺點:完成之後,需要重新開機。 
        目前是將滑鼠設定好,將HKEY_CURRENT_USER\Control Panel\Cursors 匯出。

一、利用Registry
檔名:BigMouse.bat
程式功能:匯入BigMouse.reg
內容:
@echo off
REM :: BatchGotAdmin (Run as Admin code starts)
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B
:gotAdmin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
pushd "%CD%"
CD /D "%~dp0"
REM 將滑鼠指標變大
regedit.exe /s "%~dp0BigMouse.reg"
echo "Mouse big. Finish! Reboot now"
PAUSE
shutdown /r /f /t 0

檔名:NormalMouse.bat
程式功能:匯入NormalMouse.reg
內容:
@echo off
REM :: BatchGotAdmin (Run as Admin code starts)
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B
:gotAdmin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
pushd "%CD%"
CD /D "%~dp0"
REM 將滑鼠指標變正常大小
regedit.exe /s "%~dp0NormalMouse.reg"
echo "Mouse normal. Finish! Reboot now"
PAUSE
shutdown /r /f /t 0


只要點兩下,就能將input資料夾內所有m4a 轉檔為 mp3

         最近需要將m4a檔案轉檔為mp3,所以寫python程式來處理。希望將很多的m4a放進input資料夾內,只要點兩下滑鼠就能將這些m4a 通通轉檔為 mp3。          Recently, I needed to convert M4A files in...