chkdsk and set /p

Hewlett-packard / Sd2100
January 1, 2010 at 13:54:07
Specs: Windows 7, 1024

set /p=
set HDD=

set /p=Drive
echo y| chkdsk %HDD% /f /r

my issue, it says it cant find the drive, why?

See More: chkdsk and set /p

Report •

January 1, 2010 at 14:07:54
You don't understand the correct syntax for set /P command

set /P HDD=Enter the Drive^>

echo y| chkdsk %HDD% /f /r 

Report •

January 1, 2010 at 14:14:26
IVO, please explain it to me if you would so i get a understanding.

Report •

January 1, 2010 at 14:30:57
When you set an environment variable assigning a value you code

set MyVar=MyValue

The syntax to prompt for entering a value is

set /P Var_Name=Prompting String

Example: the statement

set /P Drive=Enter Drive Name:

prompts displayng

Enter Drive Name:

and what you type is assigned to the variable Drive.

The ^> symbols sequence allows the use of character > in the prompting string. That is inessential. To know more at prompt type Set /? to get a quick tutorual.

Report •

Related Solutions

January 1, 2010 at 14:49:17
I don't know why you're clearing the var HDD and trying to use it a couple lines later. But I'll stay tuned.

Helping others achieve escape felicity


Report •

January 1, 2010 at 15:08:34
well this is my code that i am using, trying to figure out why code doesnt work,

set Choice=
>$$$.vbs echo wsh.echo inputbox("Enter Drive letter:",,,6000,8000)

for /f "tokens=*" %%a in ('cscript//nologo $$$.vbs') do set Choice=%%a

IF Exist %Choice%:\nul goto usedr7 ELSE(
goto nodr7

>$$$.vbs echo wscript.quit msgbox("No Drive Found!",16,"ERROR")
cscript//nologo $$$.vbs

echo y|chkdsk %Choice% /F /R

color 1e

>$$$.vbs echo wscript.quit msgbox("Do you Want to Restart to scan for errors?", vbyesno)
cscript//nologo $$$.vbs

IF /I '%errorlevel%'=='6' GOTO yes
IF /I '%errorlevel%'=='7' GOTO no
shutdown -r -c "Computer Restarting to Finish Scan Disk"


not sure why it wont work, says the path cant be found.

thank you for all you help.

Report •

January 1, 2010 at 22:42:22
colon after c fixed it here... also removed the /f /r because
windows can't do "hotpatch" repair drives (i don't think.
too many other things trying to run).

echo y|chkdsk %Choice%:

everything else worked fine, but i would suggest prompting the user NOT to put a colon in the window, or else changeing your code to test for it. I had to figure it out by trial and error if the colon was wanted or not... (not, it turned out!)
i liked your use of vbs btw, i've never done that, but the msgbox window always comes up down low and i have to move it up to see the dialogue. still, pretty good.

Report •

January 1, 2010 at 23:37:40
Thank you, yeah the VBS inputs are nice.

Report •

Ask Question