China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-12 01:35
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » How can a batch file handle a path containing \??\ ?? View 906 Replies 0
Original Poster Posted 2010-09-26 17:42 ·  中国 广西 来宾 电信
初级用户
Credits 67
Posts 40
Joined 2007-11-05 20:02
18-year member
UID 101808
Gender Male
Status Offline
I used the following batch file
-----------------------------------------------------------------------------------------------------
@echo off
rem Use the reg command to read the registry and get the path as a path variable
for /f "tokens=2*" %%a in ('REG QUERY "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WMDrive" /v ImagePath^|findstr "ImagePath"') do (
set MyPath=%%b
)
echo %MyPath%
pause
------------------------------------------------------------------------------------------------------
and got this result: \??\C:\WINDOWS\system32\drivers\WMDrive.sys

Among it, I want to use the path \??\C:\WINDOWS\system32\drivers as the path for the md5 check in the batch file below
-------------------------------------------------------------------------------------------------------
@echo off
title=md5sum
echo ************************************
echo This program is used for md5sum verification
echo ************************************
echo.

set site=C:\WINDOWS\system32\drivers
cd /d %site%

for /f "delims=" %%a in ('dir /b /od %site%') do set WMDrive.sys=%%a
if "%WMDrive.sys%"=="" goto eof

md5sum %WMDrive.sys%
goto theend

:eof
echo There is no file in location: %site%

:theend
echo. &pause
-------------------------------------------------------------------------------------------------------
I wonder if that can be done?

In other words, if these two batch files are combined and run together, how can I make the second batch file use the path obtained by the first one? Since the path contains characters like \??\, I don't understand how to modify it.

Hope any brothers who know can help, thanks.
Forum Jump: