Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <ol> <li>Always take filename it quotes becouse it can have spaces.</li> <li><p>Delete quotes from filename. More: set /?</p> <pre><code>set F=%F:"=% </code></pre></li> <li><ol> <li><p>Make sure the input is not empty. Command 'if not "%F%"==""' - checks that input isn't empty. Command 'if EXIST "%F%"' checks that file exist.</p> <pre><code>:: Delete variable %F% SET "F=" set /p F=Folder or a File Target: set F=%F:"=% if not "%F%"=="" if EXIST "%F%" attrib +s +h +r "%F%" </code></pre></li> <li><p>If you have too many commands that can't be runned without input you can add procedure in end of file and call it</p> <pre><code>if not "%F%"=="" if EXIST "%F%" call :HideChecked :: There are your code. Remember, that call :Label always returns back &amp; keeps batch execution. Read more: call /? :: So there your code ends. And new procedure starts. :: Prevent crazy parsing exit /b :HideChecked attrib +s +h +r %F% :: exit /b == return back exit /b </code></pre></li> </ol></li> <li><p>Always say to user, where is his error</p> <pre><code>if not "%F%"=="" if EXIST "%F%" call :HideChecked if "%F%"=="" ( echo You must choose something REM in 'IF ()' your can use only REM for comments. REM &gt;nul - means command 'pause' will print nothing (except errors) pause&gt;nul goto Hide ) if NOT EXIST "%F%" ( echo No such file. File list: REM dir /? for help dir /P/B pause&gt;nul goto Hide ) </code></pre></li> <li><p>In start of file add 'goto Input'. After each procedure (:Hide :Show :Exit) add 'goto Input' to prevent crazy parsing. </p> <pre><code>:: At start of file goto Input :: There can be some code :Show :: And there goto Input :Hide @echo off cls Color 0c ECHO. ECHO. :: Delete variable %F% SET "F=" set /p F=Folder or a File Target: set F=%F:"=% if not "%F%"=="" if EXIST "%F%" call :HideChecked if "%F%"=="" ( echo You must choose something REM in 'IF ()' your can use only REM for comments. REM &gt;nul - means command 'pause' will print nothing (except errors) pause&gt;nul goto Hide ) if NOT EXIST "%F%" ( echo No such file. File list: REM dir /? for help dir /P/B pause&gt;nul goto Hide ) goto Input :Input @echo off CLS ECHO. ECHO. ECHO ###################################################### ECHO # # ECHO # 1 - Set Other System Attribute To a Folder or file # ECHO # 2 - Remove System Attribute From a Folder or file # Echo # 3 - Exit # ECHO # # ECHO ###################################################### ECHO. ECHO. :: Delete variable %A% SET "A=" SET /P A=Set Your Choice And Press Enter: IF "%A%"=="1" GOTO Hide IF "%A%"=="2" GOTO Show IF "%A%"=="3" GOTO Exit echo You must choose something pause&gt;nul GOTO Input :: Prevent crazy parsing exit /b :HideChecked attrib +s +h +r "%F%" :: exit /b == return back exit /b </code></pre></li> </ol>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload