Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
hi all,
I want to set the value of topdir dynamically in the following batch.
For example, I have a simple html file as following<html><head><title></title></head>
<body>click here to continue</body></html>when user click on the link in above html file, it fires the batch.bat. I want to select the path which is before batch.bat and set it as a top directory.
Is it possible to do that in dos?
Thanks,
Sajjad
----------------------batch.bat--------------
@echo off
set topdir=C:\kix\Enterprise0311141\Enterprise
set tempdir=C:\temp
set style=C:\tree.xsl
set look4file=xmlinterlinks.xml

i have figured it out with a little issue
when i pass it to my batch file as following
c:\1xml>copyfile.bat "c:\1xml\test\test1"
it copies the file.
But if there is a string like "c:\1xml\test\test1 cont\cont" then it does not work
any suggestion?

i have resolved this issue as well but still i am having issue with white space created at the end!
any suggestion about stripping the white space?
here is the new batch
set topdir=%1
:beginloop
if "%1"=="" goto endloop
shiftset topdir=%topdir% %1
goto beginloop:endloop
echo %topdir%

If the target is just to catch into the variable ALL the command tail, use the following
Set topdir=%*
that disregards blanks before and after the last string typed but retains that interspersed ones. If all the typed input has to be stored into one variable, it is the straigthforward method.

hi all,
here is the command
call construct_xml_doc "%topdir%\dirlist.txt" "%topdir%\dirlist.xml"1) when i set the top directory without spaces, the command works fine. e.g
set topdir=c:\a\folder\to\process
2) when i set the top directory with spaces, it does not work at all e.g
set topdir=c:\a\folder\with spaces\to\processany suggestions, why it is giving the error "system can not find the file spaces"
regards,
/s*********construct_xml_doc*********************
@Echo Off:: LST2XML.BAT Syntax: Lst2Xml File_In File_Out
Echo ^<?xml version="1.0" encoding="ISO-8859-1"?^>> %~f2
Echo ^<someURIs^>>> %~f2
For /F "tokens=*" %%A in (%~f1) Do Echo ^<file^>%%A\file.xml^</file^>>> %~f2
Echo ^</someURIs^>>> %~f2
**************************************************

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

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