我想在ping中仅显示TTL在100-225之间的结果
Pinging x.x.x.x with 32 bytes of da
Reply from x.x.x.x: bytes=32 time=124ms TTL=128
Reply from x.x.x.x: bytes=32 time=148ms TTL=64
Reply from x.x.x.x: bytes=32 time=127ms TTL=64
Reply from x.x.x.x: bytes=32 time=140ms TTL=128
感谢
答案 0 :(得分:2)
您可以使用const store = Rx.Observable.create(function(observer) {
let state = { commands: [
{key: 'arrows', isEnabled: true, activeState: 0, numStates: 2 },
{key: 'focus', isEnabled: false, hotKey: 'f' },
{key: 'geometry', isEnabled: true, activeState: 1, numStates: 2 },
{key: 'goToEnd', isEnabled: true }]
};
observer.next(state);
state = { commands: [
{key: 'arrows', isEnabled: true, activeState: 1, numStates: 2 },
{key: 'focus', isEnabled: true, hotKey: 'f' },
{key: 'geometry', isEnabled: true, activeState: 1, numStates: 2 },
{key: 'goToEnd', isEnabled: true }]
};
observer.next(state);
state = { commands: [
{key: 'arrows', isEnabled: true, activeState: 1, numStates: 2 },
{key: 'focus', isEnabled: true, hotKey: 'f' },
{key: 'geometry', isEnabled: true, activeState: 1, numStates: 2 },
{key: 'goToEnd', isEnabled: true }]
};
observer.next(state);
});
const subscribe = store.map( state => {
const commands = state.commands.filter( cmd => cmd.key === 'arrows' );
if( commands.length == 0 ) {
return undefined;
}
const result = {
isEnabled: commands[0].isEnabled,
activeState: commands[0].activeState,
};
return result;
})
.distinctUntilChanged( ( a, b ) => a.isEnabled === b.isEnabled && a.activeState === b.activeState )
.subscribe(val => console.log(val));
cmdlet执行此操作。例如:
Test-Connection
答案 1 :(得分:1)
批处理文件的选项。
@echo off
setlocal enabledelayedexpansion
for /F "delims=" %%G in ('ping 10.28.2.38 ^|findstr /B /C:"Reply from"') do (
set "ping=%%G"
set "TTL=!ping:*TTL=!"
SET "TTL=!TTL:~1!"
IF !TTL! GEQ 100 IF !TTL! LEQ 225 echo %%G
)