I want to know that how can i set help utility in my own batch file command. I am using windows 7 operating system. we can check the syntax of command in windows command promt by just typing
help "command name"
like
help attrib
so i have created batch file which takes path/folder name as argument and setting it as hidden and system file. The code has three line
@echo off
attrib %1 +s +h
echo File/Folder hide successfully...
i saved it as "hide.bat" at C:\windows\system32 so i can use it from any directory. But i want to know that how can i set help utility for my command. i want to display
attrib [file/folder name] +s +h
+ to set an attribute
when user type
help hide
hide is my command name(batch file name)
I have changed my code to display help content when user pass blank argument
@echo off
IF ["%1"]==[""] goto showhelp
goto done
:done
attrib "%1" +s +h
echo File/Folder hide successfully...
goto close
:showhelp
echo attrib [file/folder name] +s +h
echo + to set an attribute
:close
But it is not enough for me i want to display my help content when user type
help hide
so tell me how can i set it?
Yes, it is possible. Save this as help.bat
and put it a folder that is earlier in the PATH than the \windows\system32
folder.
There may be an earlier folder already - type set path
and look at the folders before system32 - or you can add one yourself.
@echo off
if /i "%~1"=="hide" (
echo attrib [file/folder name] +s +h
echo + to set an attribute
) else (
"%Windir%\system32\help" %*
)