This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
rem | |
rem このバッチの説明 | |
rem | |
rem 設定事項 | |
set HOGE="変数の値" | |
rem このバッチが存在するフォルダをカレントに |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pushd %0\.. | |
java -cp ./target.jar com.osd.xxx.clazz.class | |
pause |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//リソースを確保した順と逆順に確実にfinallyでリソースを解放する | |
try { | |
String path = ""; | |
BufferdReader br = null; | |
try { | |
File file = new File(path); | |
String encode = "UTF-8"; | |
// br = new BufferdReader(new FileReader(file)); | |
br = new BufferdReader(new InputStreamReader(new FileInputStream(file), encode)); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BufferdReader br = new BufferdReader(new InputStreamReader(System.in)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 正常系 | |
// 例外はcatchしないことで、JUnit側でStackTraceはかせる | |
public void testOK() throws Exception { | |
} | |
// 異常系 | |
// 検証対象の例外を検証する | |
public void testException() throws Exception { | |
try { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* boolean型Privateフィールド取得 | |
* @throws Exception JUnitでの使用を想定しているため、例外は全てスローする。 | |
*/ | |
private boolean getBooleanByReflection(Class<?> clazz, Object obj String name) throws Exception { | |
Field field = clazz.getDeclaredField(name); | |
field.setAccessible(true); | |
return field.getBoolean(obj); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
rem スクリーンセーバーロックの一時解除バッチ(管理者権限) | |
rem 実行するとスクリーンセーバーロックを無効にします。 | |
rem 一時停止を解除するとスクリーンセーバーロックをを有効にします。 | |
rem param:1(有効)/0(無効) | |
set key="HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Control Panel\Desktop" | |
set secure="ScreenSaverIsSecure" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
echo *********メニュー********* | |
echo 0:ページファイル削除 | |
echo 1:ページファイル作成 | |
echo 2:ページファイル変更 | |
echo ************************** | |
rem コンソール改行 | |
echo. | |
rem cd %~p0 | |
rem 入力値を環境変数に設定 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo off | |
set hoge="aaatestxxx" | |
@echo %hoge% | find "test" > NUL | |
echo %errorlevel% | |
if errorlevel 1 ( | |
echo error!! | |
) else ( | |
echo OK! | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rem 遅延環境変数使用可能オプション | |
@setlocal EnableDelayedExpansion | |
rem 変数 | |
set hoge=xxx | |
echo !hoge! |