下面的方法存在兩個問題: 1、是目錄權限的寫入問題 2、是機器執行bat的效率問題,有的可能要幾秒 int main() { string as, m, n; m = '"' + get_home_path() + '\lngid.bat' + '"' ; n = get_home_path() + '\lngid.bat' ; as = 'for /f "tokens=3,*" '; as = as + "%%" + "i in "; as = as + "('reg query "; as = as + '"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\Language"'; as = as + " /v default ') do (echo %%i "; as = as + ' >' + m; as = as + ' )'; file_write(n, as); system(m); sleep(1);//这个时间不好把握(不同配置机器执行速度差异),希望system/shell能添加等候执行完毕的参数 db_read_txt_file(n); if (str_trim(db_res(0)) != '0404') {warn('非繁体环境');} else {msg('繁体环境');} file_unlink(n); return 1; }; |