[SOLVED] The Old "WINDOWS CANNOT FIND"..Error

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Dos_Probie
Posts: 233
Joined: 21 Nov 2010 08:07
Location: At My Computer

[SOLVED] The Old "WINDOWS CANNOT FIND"..Error

#1 Post by Dos_Probie » 13 Sep 2012 14:42

Windows cannot find 'CCleaner.sfx.exe'.Make sure you typed the name correctly,and then try again.


Probably something simple but this code Works when I run it From the same directory with my sfx files and installs just fine, but with the batch Outside the directory(from desktop)I get the "Windows cannot find" yada..yada error on each file,I would like the ability to run outside the directory (from desktop) as well and not as Shortcut..
Any Ideas or Suggestions? Thanks for the help.. :P

Code: Select all

@echo off&color e
:: Multi.Installer.cmd-Dos_Probie
:: AUTO INSTALLS MULTIPLE .SFX APPS

:: INSTALL
for /f %%a in ('dir/b %systemdrive%\Installs\sw\*.exe') do (
echo == Installing Apps == "%%a"
echo.
:: DELAY
ping -n 4 localhost 1>nul
start /wait  %%a
)
echo.
echo  All Apps Installed Successfully!
echo.
echo.
echo.
echo == Press any [KEY] to Close This Screen ==&pause>nul
echo.
exit
Last edited by Dos_Probie on 15 Sep 2012 02:18, edited 1 time in total.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: The Old "WINDOWS CANNOT FIND"..Error

#2 Post by foxidrive » 13 Sep 2012 23:13

Code: Select all

@echo off&color e
:: Multi.Installer.cmd-Dos_Probie
:: AUTO INSTALLS MULTIPLE .SFX APPS

:: INSTALL
for /f %%a in ('dir/b "%systemdrive%\Installs\sw\*.exe"') do (
echo == Installing Apps == "%%a"
echo.
:: DELAY
ping -n 4 localhost 1>nul
start "" /wait  "%systemdrive%\Installs\sw\%%a"
)
echo.
echo  All Apps Installed Successfully!
echo.
echo.
echo.
echo == Press any [KEY] to Close This Screen ==&pause>nul
echo.
exit

Dos_Probie
Posts: 233
Joined: 21 Nov 2010 08:07
Location: At My Computer

Re: The Old "WINDOWS CANNOT FIND"..Error

#3 Post by Dos_Probie » 14 Sep 2012 20:07

Thanks for the help Foxi, works both ways now :P
hey Question why did you add the quotation marks in the for / f string is that just good practice or what :?:

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: The Old "WINDOWS CANNOT FIND"..Error

#4 Post by foxidrive » 14 Sep 2012 20:10

Dos_Probie wrote:hey Question why did you add the quotation marks in the for / f string is that just good practice or what :?:


Yes, it's good practice. It allows one to use long pathnames without errors.

Post Reply