Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
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

Not clear about the intent, but to answer the question:
==================================
@echo off & setLocal EnableDelayedExpansionset /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

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |