rss
Search : in
By : Relevance Date Username
Statut : Not resolved

Open a file with spaces from batch file?

Branflakes91093, on Sunday July 27, 2008 07:46:47 PM
Hello,
I have made a batch file that will ask you what file name you want to open and what directory it's in.
The only problem is that i can't open files with spaces in the name because it treats the first word as the whole file.
Can someone help me?
Here's the code:

cls
@echo off
:CD
cls
echo Change directory?
echo.
set /p "cho=>"
if %cho%==y goto Change
if %cho%==Y goto Change
if %cho%==n goto Open
if %cho%==N goto Open
cls
echo That's not a valid choice, dumbass.
pause
goto CD
:Open
cls
echo What would you like to open? (Name and Extension) Or type "End" to exit.
echo.
set /p "n=>"
if %n%==End goto End
if %n%==end goto End
if %n%=="End" goto End
if %n%=="end" goto End
start %n%
goto Open
goto End
:Change
cls
echo Enter the desired directory.
echo.
set /p "x=>"
CHDIR %x%
goto Open
:end

Placing quotes around the input variables opens up another cmd window for some reason...
Thanks.
Configuration: Windows XP
Internet Explorer 7.0
Reply to Branflakes91093  Report this message to moderators Go to last message

1


  • This message seems useful, vote!
  • Report this message to moderators
 Branflakes91093, on Monday July 28, 2008 01:08:41 AM
BTW have vista 32 bit
Reply to Branflakes91093
Software found in the relevant downloads
Download CCleaner 2.09.618CCleaner - CCleaner is a freeware cleaning tool to ensure privacy by deleting unused and temporary files from your system /!\ Do not...Category: Anonymity / Privacy
License: Freeware/gratuit
Download SIW 1.73SIW - SIW is an advanced System Information for Windows tool that gathers detailed information about your system properties and...Category: Diagnosis
License: Freeware/gratuit
Download OpenOffice 2.4.1OpenOffice - OpenOffice is a free office application suite, including a word processor, spreadsheet, presentation tool, drawing package...Category: Office suite
License: Open Source
Download  Avira AntiVir Personal free for Linux / FreeBSD / OpenBSD / Solaris 2.1.12-19 Avira AntiVir Personal free for Linux / FreeBSD / OpenBSD / Solaris - <h1>For Linux / FreeBSD / OpenBSD / Solaris</h1> Avira AntiVir PersonalEdition Classic is a very good and free...Category: Antivirus
License: Freeware/gratuit
More freeware about « Open a file with spaces from batch file? »