RedBelly
RedBelly

Reputation: 89

explorer command not working in batch file

i have a batch file that opens an item in a list of paths but the explorer command is not working (final is a list of paths ) can anyone tellme why this command isnt working

its sending the message:'explorer' is not recognized as an internal or external command,operable program or batch file.

setlocal enabledelayedexpansion
set path=c:\users\user1\desktop
set numz=0 
set /p go=
for %%k in (%final%) do (
set /a "numz=!numz!+1"
if [!numz!]==[%go%] (explorer %%k)
) 

Upvotes: 0

Views: 3947

Answers (1)

Stephan
Stephan

Reputation: 56208

you changed the %path% variable. Don't do that (use another variable name). Windows uses the %path% variable to know where to find it's executables. Because you deleted that info, Windows is not able to find explorer.exe any more - hence the error message.

Gladly, this concerns only the current cmd session (and it's daughter-processes). Change the variable name, close the cmd window, open a new one and it should work fine.

Upvotes: 2

Related Questions