Batch File Input Shortcuts

April 1, 2009 at 10:27:21
Specs: Windows Vista
In a batch file, i want the user to input a directory to save a file.
however, i want an option to input '#' and the directory of the batch file will be selected (using %~dp0).

i don't know how to make it so that by typing in #, it will do it.

Here is what i have so far:

:startup
title Network Users

:1
cls
@echo off
Echo This Batch File allows you to save any Command from Command Prompt
Echo as a text file.
Echo It even allows you to choose where you save it, and what it's called!!
ECHO.
ECHO.
set /p command= What Command would you like to save (full Command Prompt Line needed)?:

:2
cls
@echo off
Echo This Batch File allows you to save any Command from Command Prompt
Echo as a text file.
Echo It even allows you to choose where you save it, and what it's called!!
ECHO.
ECHO.
set /p where= Where would you like to save it?:

:3
cls
@echo off
Echo This Batch File allows you to save any Command from Command Prompt
Echo as a text file.
Echo It even allows you to choose where you save it, and what it's called!!
ECHO.
ECHO.
set /p name= What would you like to name it?:

:4
cls
@echo off
%command% > "%where%/%name%.txt"
goto 5

:5
cls
@echo off
Echo Thank You for Using!
Echo You file should be saved by now!
Echo Email me at jcgun@hotmail.co.uk!
ECHO.
set choice=
set /p choice=Press Enter to Exit:
if not '%choice%'=='' set choice=%choice:~0,1%
Echo.

:6
goto Crash


See More: Batch File Input Shortcuts

Report •


#1
April 2, 2009 at 01:41:43
what was the question?
and what is #??

Report •

#2
April 2, 2009 at 02:32:34
Not clear about the intent, but to answer the question:

==================================
@echo off & setLocal EnableDelayedExpansion

set /p where=dir to put? use # for current dir
if !where! equ # set where=%CD%


=====================================
If at first you don't succeed, you're about average.

M2


Report •

Related Solutions


Ask Question