windows下特定字符搜索功能
注:本人博客全部可读,并不收费。如若需要付费观看,与我本人无关。可能是系统收的钱。请不要误伤。
今天运行了一个好久不用的开发板,打印出了特定字符。这时候我忽然想找到它内部的程序,
那么该怎么找呢?
好在接触过内核,我知道在linux中可以通过命令行,配合指定的文件名找到。但是说实话,根据文件中包含的特定字符找文件这个操作,即使在内核中,我好像也没用过。
报着试一试的态度,搜了下,找到了这个帖子:
windows 查找目录下文件中包含某个字符串_windows查找文件中是否有字符串-CSDN博客
喜出望外啊,激动的我一试:
> 引用文本
C:\Users\LiYanhong>E
'E' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
C:\Users\LiYanhong>E:
E:\>findstr.exe /s /i "init ok......test for _yizhi" *.*
$RECYCLE.BIN\S-1-5-21-2535704113-129615377-453231384-1001\$R25Z0Q0:F!鳜縺刁魑齹?傀?FreeRTOS-Kernel/tasks.cxTaskCreateStatic(uint32_t)(puxStackBuffer != ((void*)0))(uint32_t)(pxTaskBuffer != ((void*)0))(uint32_t)(xSize == sizeof( TCB_t ))vTaskDelete(uint32_t)(uxSchedulerSuspended == 0)vTaskDelayeTaskGetState(uint32_t)(pxTCB)vTaskSuspendvTaskResume(uint32_t)(xTaskToResume)xTaskResumeFromISRIDLEvTaskStartScheduler(uint32_t)(xReturn != ( -1 ))xTaskResumeAll(uint32_t)(uxSchedulerSuspended)pcTaskGetNamexTaskGetIdleTaskHandle(uint32_t)(( xIdleTaskHandle != ((void*)0) ))xTaskCatchUpTicksxTaskIncrementTick(uint32_t)(( ( ( ( pxDelayedTaskList )->uxNumberOfItems == ( UBaseType_t ) 0 ) ? ( ( BaseType_t ) 1 ) : ( ( BaseType_t ) 0 ) ) ))vTaskSwitchContext(uint32_t)(( ( &( pxReadyTasksLists[ uxTopPriority ] ) )->uxNumberOfItems ) > 0)vTaskPlaceOnEventList(uint32_t)(pxEventList)vTaskPlaceOnUnorderedEventList(uint32_t)(uxSchedulerSuspended != 0)vTaskPlaceOnEventListRestrictedxTaskRemoveFromEventList(uint32_t)(pxUnblockedTCB)vTaskRemoveFromUnorderedEventList(uint32_t)(uxSchedulerSuspended != ( ( BaseType_t ) 0 ))vTaskSetTimeOutState(uint32_t)(pxTimeOut)xTaskCheckForTimeOut(uint32_t)(pxTicksToWait)vTaskSetThreadLocalStoragePointer(uint32_t)(pxTCB != ((void*)0))xTaskPriorityDisinherit(uint32_t)(pxTCB == pxCurrentTCB)(uint32_t)(pxTCB->uxMutexesHeld)vTaskPriorityDisinheritAfterTimeout(uint32_t)(pxTCB != pxCurrentTCB) %c %u %u %u
$RECYCLE.BIN\S-1-5-21-2535704113-129615377-453231384-1001\$R25Z0Q0:ulTaskGenericNotifyTake(uint32_t)(uxIndexToWait < (1))xTaskGenericNotifyWaitxTaskGenericNotify(uint32_t)(uxIndexToNotify < (1))(uint32_t)(xTaskToNotify)(uint32_t)(xTickCount == ( TickType_t ) 0)(uint32_t)(( ( &( pxTCB->xEventListItem ) )->pvContainer ) == ((void*)0))xTaskGenericNotifyFromISRvTaskGenericNotifyGiveFromISRxTaskGenericNotifyStateClear(uint32_t)(uxIndexToClear < (1))prvInitialiseNewTask(uint32_t)(( ( ( uint32_t ) pxTopOfStack & ( uint32_t ) ( 0x0007 ) ) == 0UL ))prvTaskIsTaskSuspended(uint32_t)(xTask)prvDeleteTCB(uint32_t)(pxTCB->ucStaticallyAllocated == ( ( uint8_t ) 2 ))FreeRTOS-Kernel/queue.cxQueueGenericReset(uint32_t)(pxQueue)xQueueGenericCreateStatic(uint32_t)(uxQueueLength > ( UBaseType_t ) 0)(uint32_t)(pxStaticQueue != ((void*)0))(uint32_t)(!( ( pucQueueStorage != ((void*)0) ) && ( uxItemSize == 0 ) ))(uint32_t)(!( ( pucQueueStorage == ((void*)0) ) && ( uxItemSize != 0 ) ))(uint32_t)(xSize == sizeof( Queue_t ))xQueueGenericCreate(uint32_t)(( uxItemSize == 0 ) || ( uxQueueLength == ( xQueueSizeInBytes / uxItemSize ) ))(uint32_t)(( sizeof( Queue_t ) + xQueueSizeInBytes ) > xQueueSizeInBytes)xQueueGiveMutexRecursive(uint32_t)(pxMutex)xQueueTakeMutexRecursivexQueueCreateCountingSemaphoreStatic(uint32_t)(uxMaxCount != 0)(uint32_t)(uxInitialCount <= uxMaxCount)xQueueCreateCountingSemaphorexQueueGenericSend(uint32_t)(!( ( pvItemToQueue == ((void*)0) ) && ( pxQueue->uxItemSize != ( UBaseType_t ) 0U ) ))(uint32_t)(!( ( xCopyPosition == ( ( BaseType_t ) 2 ) ) && ( pxQueue->uxLength != 1 ) ))(uint32_t)(!( ( xTaskGetSchedulerState() == ( ( BaseType_t ) 0 ) ) && ( xTicksToWait != 0 ) ))xQueueGenericSendFromISR(uint32_t)(cTxLock != ( ( int8_t ) 127 ))xQueueGiveFromISR(uint32_t)(pxQueue->uxItemSize == 0)(uint32_t)(!( ( pxQueue->pcHead == ((void*)0) ) && ( pxQueue->u.xSemaphore.xMutexHolder != ((void*)0) ) ))xQueueReceive(uint32_t)(( pxQueue ))(uint32_t)(!( ( ( pvBuffer ) == ((void*)0) ) && ( ( pxQueue )->uxItemSize != ( UBaseType_t ) 0U ) ))xQueueSemaphoreTake(uint32_t)(xInheritanceOccurred == ( ( BaseType_t ) 0 ))xQueuePeekxQueueReceiveFromISR(uint32_t)(!( ( pvBuffer == ((void*)0) ) && ( pxQueue->uxItemSize != ( UBaseType_t ) 0U ) ))(uint32_t)(cRxLock != ( ( int8_t ) 127 ))xQueuePeekFromISR(uint32_t)(pxQueue->uxItemSize != 0)uxQueueMessagesWaiting(uint32_t)(xQueue)uxQueueSpacesAvailableuxQueueMessagesWaitingFromISRvQueueDeletexQueueIsQueueEmptyFromISRxQueueIsQueueFullFromISRWARNING: %s:%d: [IPC RPMSG] Message send to remote core %d @ %d end point truncated due to lack of space in vring buffer !!!
$RECYCLE.BIN\S-1-5-21-2535704113-129615377-453231384-1001\$R25Z0Q0:ipc_rpmsg/ipc_rpmsg.cRPMessage_constructsizeof(RPMessage_Object) >= sizeof(RPMessage_Struct)Tmr SvcFreeRTOS-Kernel/timers.cxTimerCreateTimerTask(uint32_t)(xReturn)xTimerCreateStatic(uint32_t)(xSize == sizeof( Timer_t ))(uint32_t)(pxTimerBuffer)xTimerGenericCommand(uint32_t)(xTimer)xTimerGetTimerDaemonTaskHandle(uint32_t)(( xTimerTaskHandle != ((void*)0) ))xTimerGetPeriodvTimerSetReloadModeuxTimerGetReloadModexTimerGetExpiryTimepcTimerGetNamexTimerIsTimerActivepvTimerGetTimerIDvTimerSetTimerIDxTimerPendFunctionCall(uint32_t)(xTimerQueue)prvInitialiseNewTimer(uint32_t)(( xTimerPeriodInTicks > 0 ))prvSwitchTimerLists(uint32_t)(xResult)prvProcessExpiredTimerprvProcessReceivedCommands(uint32_t)(pxCallback)(uint32_t)(( pxTimer->xTimerPeriodInTicks > 0 ))TmrQmcspi/v0/mcspi_v0.cMCSPI_initNULL != objMCSPI_openNULL != gMcspiDrvObj.lockNULL != config->attrsMCSPI_closeMCSPI_chConfigMCSPI_dmaChConfigMCSPI_transferNULL != obj->transferSemMCSPI_transferCancelMCSPI_masterIsrMCSPI_slaveIsrMCSPI_configInstanceNULL != config->objectMCSPI_setChConfigERROR: %s:%d: [MCSPI] Callback should be provided when using callback mode !!!
$RECYCLE.BIN\S-1-5-21-2535704113-129615377-453231384-1001\$R25Z0Q0:MCSPI_checkChConfigportable/TI_ARM_CLANG/ARM_CM4F/port.cxPortStartScheduler(uint32_t)((0xE0U))vPortEndScheduler(uint32_t)(uxCriticalNesting == 1000UL)vPortEnterCritical(uint32_t)(( ( *( ( volatile uint32_t * ) 0xe000ed04 ) ) & ( 0xFFUL ) ) == 0)vPortExitCritical(uint32_t)(uxCriticalNesting)ERROR: %s:%d: [FreeRTOS] Stack overflow detected for task [%s]vApplicationStackOverflowHookprvTaskExitError(uint32_t)(uxCriticalNesting == ~0UL)ipc_notify/v0/ipc_notify_v0.cIpcNotify_sendMsgmailboxBaseAddr!=NULLIpcNotify_initparams->selfCoreId < CSL_CORE_ID_MAXparams->numCores > 0params->coreIdList[core] < CSL_CORE_ID_MAXparams->coreIdList[core] != params->selfCoreIdpInterruptConfig->numCores > 0pInterruptConfig->coreIdList[core] < CSL_CORE_ID_MAXpInterruptConfig->coreIdList[core] != gIpcNotifyCtrl.selfCoreIdTask (DPL)dpl/common/TaskP_freertos.cTaskP_constructsizeof(TaskP_Struct) <= sizeof(TaskP_Object)params != NULLtaskObj != NULLparams->stackSize >= TaskP_STACK_SIZE_MIN(params->stackSize & (sizeof(configSTACK_DEPTH_TYPE) - 1)) == 0params->stack != NULL((uintptr_t)params->stack & (sizeof(configSTACK_DEPTH_TYPE) - 1)) == 0params->taskMain != NULLuart/v0/uart_v0.cUART_initNULL != objectUART_openNULL != gUartDrvObj.lockobject->prms.intrNum != 0xFFFFUART_closeNULL != attrsUART_writeUART_readUART_writeCancelUART_readCancelUART_flushTxFifoFALSE == timeoutElapsedUART_configInstanceNULL != config->attrsNULL != config->objectUART_masterIsrdpl/m4/ClockP_freertos_m4.cClockP_initgClockConfig.timerInputPreScaler != 0gClockConfig.timerInputClkHz != 0gClockConfig.usecPerTick != 0gClockConfig.timerBaseAddr != 0WARNING: %s:%d: FreeRTOS configTICK_RATE_HZ (%d), does not match ClockP tick rate Hz (%d)
$RECYCLE.BIN\S-1-5-21-2535704113-129615377-453231384-1001\$R25Z0Q0:..ss..?$@Y@@廆埫@j鳣€?A?cA勛桝e屯Aipc_rpmsg/ipc_rpmsg_vring.cRPMessage_vringResetvringSize <= params->vringSize[IPC RPMSG ECHO] Remote Core waiting for messages at end point %d ... !!!
FINDSTR: 写入错误
看来前博主是闭眼搬运。好在我也是bug王练出来的,会自己找答案。于是:

E:\> help findstr
在文件中寻找字符串。
FINDSTR [/B] [/E] [/L] [/R] [/S] [/I] [/X] [/V] [/N] [/M] [/O] [/P] [/F:file]
[/C:string] [/G:file] [/D:dir list] [/A:color attributes] [/OFF[LINE]]
strings [[drive:][path]filename[ ...]]
/B 在一行的开始配对模式。
/E 在一行的结尾配对模式。
/L 按字使用搜索字符串。
/R 将搜索字符串作为一般表达式使用。
/S 在当前目录和所有子目录中搜索
匹配文件。
/I 指定搜索不分大小写。
/X 打印完全匹配的行。
/V 只打印不包含匹配的行。
/N 在匹配的每行前打印行数。
/M 如果文件含有匹配项,只打印其文件名。
/O 在每个匹配行前打印字符偏移量。
/P 忽略有不可打印字符的文件。
/OFF[LINE] 不跳过带有脱机属性集的文件。
/A:attr 指定有十六进位数字的颜色属性。请见 "color /?"
/F:file 从指定文件读文件列表 (/ 代表控制台)。
/C:string 使用指定字符串作为文字搜索字符串。
/G:file 从指定的文件获得搜索字符串。 (/ 代表控制台)。
/D:dir 查找以分号为分隔符的目录列表
/Q:qflags 静音模式标志:
u 抑制对不支持的 Unicode 格式发出警告
strings 要查找的文字。
[drive:][path]filename
指定要查找的文件。
除非参数有 /C 前缀,请使用空格隔开搜索字符串。
例如: 'FINDSTR "hello there" x.y' 在文件 x.y 中寻找 "hello" 或
"there"。'FINDSTR /C:"hello there" x.y' 文件 x.y 寻找
"hello there"。
一般表达式的快速参考:
. 通配符: 任何字符
* 重复: 以前字符或类出现零或零以上次数
^ 行位置: 行的开始
$ 行位置: 行的终点
[class] 字符类: 任何在字符集中的字符
[^class] 补字符类: 任何不在字符集中的字符
[x-y] 范围: 在指定范围内的任何字符
\x Escape: 元字符 x 的文字用法
\<xyz 字位置: 字的开始
xyz\> 字位置: 字的结束
有关 FINDSTR 常见表达法的详细情况,请见联机命令
参考。
一番查询,我就知道上面那不适合我连基本命令都没整对。与是根据提示我找到了适合自己的搜索。
E:\>FINDSTR /s /i "for _yizhi" main.c
$RECYCLE.BIN\S-1-5-21-2535704113-129615377-453231384-1001\$RAIJHY1\User\App\main.c:union IAP_information //升级信息
$RECYCLE.BIN\S-1-5-21-2535704113-129615377-453231384-1001\$RAIJHY1\User\App\main.c: for(i = 0; i < 8; i++)
$RECYCLE.BIN\S-1-5-21-2535704113-129615377-453231384-1001\$RPRI8IV\User\App\main.c:union IAP_information //升级信息
$RECYCLE.BIN\S-1-5-21-2535704113-129615377-453231384-1001\$RPRI8IV\User\App\main.c: for(i = 0; i < 8; i++)
$RECYCLE.BIN\S-1-5-21-2535704113-129615377-453231384-1001\$RQJW1UJ\User\App\main.c:union IAP_information //升级信息
$RECYCLE.BIN\S-1-5-21-2535704113-129615377-453231384-1001\$RQJW1UJ\User\App\main.c: for(i = 0; i < 8; i++)
$RECYCLE.BIN\S-1-5-21-2535704113-129615377-453231384-1001\$RU2PWH4\main.c: * Redistribution and use in source and binary forms, with or without
$RECYCLE.BIN\S-1-5-21-2535704113-129615377-453231384-1001\$RU2PWH4\main.c: * Redistributions in binary form must reproduce the above copyright
$RECYCLE.BIN\S-1-5-21-2535704113-129615377-453231384-1001\$RU2PWH4\main.c: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
$RECYCLE.BIN\S-1-5-21-2535704113-129615377-453231384-1001\$RU2PWH4\main.c: * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRE
。。。(一下省略几百行吧)
这时候我正要说自己也不靠谱的时候,再认真阅读解释发现了这个,
“ 除非参数有 /C 前缀,请使用空格隔开搜索字符串。
例如: 'FINDSTR "hello there" x.y' 在文件 x.y 中寻找 "hello" 或
"there"。'FINDSTR /C:"hello there" x.y' 文件 x.y 寻找
"hello there"。
哦,不严谨的是我,因为有空格的参与,我的搜索句子被分割了。于是我留下了特定字符重新找:

完美的结局。
在我解决问题后,发现之前博主是自己发挥多了,他参考的帖子还是比较靠谱的。但是我自己通过帮助也找到了。多查帮助真的能少很多不必要的帮助,又是进步的一天。
靠谱的参考:在某个目录下的所有文件中查找包含某个字符串的Windows命令 - sfesly - 博客园
