On Windows Xp environment, can I write a BAT file (under DOS) that can read
the name of a directory and them assign that name to a file in another or
the same directory? (filename.ext <= directory name)
"2007-User" <no-email@noemail.com> wrote in message
news:uQnn$8XgHHA.2432@TK2MSFTNGP03.phx.gbl...
> On Windows Xp environment, can I write a BAT file (under DOS) that can
read
> the name of a directory and them assign that name to a file in another or
> the same directory? (filename.ext <= directory name)
>
> Thanks in advance.
The short answer to your question is "Yes, you can".
I suspect you would like to know how it's done. It would
be best if you gave an actual example to avoid having to
guess.
2007-User wrote:
> On Windows Xp environment, can I write a BAT file (under DOS) that
> can read the name of a directory and them assign that name to a file
> in another or the same directory? (filename.ext <= directory name)
>
> Thanks in advance.
For the experts in XP batch files, try:
alt.msdos.batch.nt
Those guys not only can do everything, but usually are great about sharing
the needed code.
"2007-User" <no-email@noemail.com> wrote in message
news:uQnn$8XgHHA.2432@TK2MSFTNGP03.phx.gbl...
> On Windows Xp environment, can I write a BAT file (under DOS) that can
> read
> the name of a directory and them assign that name to a file in another or
> the same directory? (filename.ext <= directory name)
>
> Thanks in advance.
Since VBScript is installed by default on most XP systems, why not use that?
It is easier to understand and debug.
For example, the following three lines can be copied & pasted to notepad and
saved to a file named CurFldr.vbs:
MsgBox "Started in folder " & vbCrLf & _
WScript.CreateObject("WScript.Shell").CurrentDirec tory
MsgBox "Done - quitting"
Wow thank you so much Paul I didn't know anything about that ,
could you please tell me how it is possible to convert below batch file to
VBSCRIPT?
@ECHO ON
MD NEW-PROJECT
CD NEW-PROJECT
xcopy /d C:\007-JO~1\*.* D:\Documents and Settings\AFDESKTOP.001\Desktop
MD 09-Origfiles
MD 01-Sketches
MD 02-Received_Emails
MD 02-Sent_Emails
MD 01-Pictures
MD 03-Layouts
CD 03-Layouts
MD Drawings
MD Calculations
CD..
cls
tree
exit
Thank you.
2007-User
"Paul Randall" <paulr901@cableone.net> wrote in message
news:OnZh1UfgHHA.3852@TK2MSFTNGP04.phx.gbl...
>
> "2007-User" <no-email@noemail.com> wrote in message
> news:uQnn$8XgHHA.2432@TK2MSFTNGP03.phx.gbl...
>> On Windows Xp environment, can I write a BAT file (under DOS) that can
>> read
>> the name of a directory and them assign that name to a file in another or
>> the same directory? (filename.ext <= directory name)
>>
>> Thanks in advance.
>
> Since VBScript is installed by default on most XP systems, why not use
> that? It is easier to understand and debug.
>
> For example, the following three lines can be copied & pasted to notepad
> and saved to a file named CurFldr.vbs:
> MsgBox "Started in folder " & vbCrLf & _
> WScript.CreateObject("WScript.Shell").CurrentDirec tory
> MsgBox "Done - quitting"
>
> Double click click the file to run the script.
>
> -Paul Randall
>
VBScript is far more powerful than batch files. On the other
hand, batch files are far simpler to write for everyday tasks
such as making a few folders or perfoming some simple copy
commands, if only because they use standard Command
Prompt commands.
What has happened to your original question? Change of scope?
The batch file you posted has a few problems - see below.
"2007-User" <no-email@noemail.com> wrote in message
news:etKfSajgHHA.208@TK2MSFTNGP05.phx.gbl...
> Wow thank you so much Paul I didn't know anything about that ,
> could you please tell me how it is possible to convert below batch file to
> VBSCRIPT?
>
> @ECHO ON
> MD NEW-PROJECT
*** Much better to write it like so:
*** md "d:\documents and settings\User\New-Project"
*** Now you know exactly where the folder will be created.
> CD NEW-PROJECT
*** Ditto:
*** cd /d "d:\documents and settings\User\New-Project"
> xcopy /d C:\007-JO~1\*.* D:\Documents and Settings\AFDESKTOP.001\Desktop
*** This won't work - you have embedded spaces. Do this instead:
*** xcopy /d C:\007-JO~1 "D:\Documents and Settings\AFDESKTOP.001\Desktop\"
> MD 09-Origfiles
*** As above - add drive & folder name!
> MD 01-Sketches
> MD 02-Received_Emails
> MD 02-Sent_Emails
> MD 01-Pictures
> MD 03-Layouts
> CD 03-Layouts
> MD Drawings
> MD Calculations
> CD..
*** What is the point of this command? Get rid of it!
> cls
*** What is the point of this command? Get rid of it!
> tree
> exit
*** What is the point of this command? Get rid of it!
> Thank you.
> 2007-User
>
>
> "Paul Randall" <paulr901@cableone.net> wrote in message
> news:OnZh1UfgHHA.3852@TK2MSFTNGP04.phx.gbl...
> >
> > "2007-User" <no-email@noemail.com> wrote in message
> > news:uQnn$8XgHHA.2432@TK2MSFTNGP03.phx.gbl...
> >> On Windows Xp environment, can I write a BAT file (under DOS) that can
> >> read
> >> the name of a directory and them assign that name to a file in another
or
> >> the same directory? (filename.ext <= directory name)
> >>
> >> Thanks in advance.
> >
> > Since VBScript is installed by default on most XP systems, why not use
> > that? It is easier to understand and debug.
> >
> > For example, the following three lines can be copied & pasted to notepad
> > and saved to a file named CurFldr.vbs:
> > MsgBox "Started in folder " & vbCrLf & _
> > WScript.CreateObject("WScript.Shell").CurrentDirec tory
> > MsgBox "Done - quitting"
> >
> > Double click click the file to run the script.
> >
> > -Paul Randall
> >
>
>
Well, I got so excited and forgot about my original question! ... certainly
I'll try to learn about this vbscripts in the near future ... until then,
let me ask you about my first question,
I need to read a folder's name and then assign this name to a file (rename
an existing file with this name) without touching the extension of this
file.
by the way thank you so much for your answer about my batch file.
---------------------------------------------------------------------------------------------------------------------------
"Pegasus (MVP)" <I.can@fly.com> wrote in message
news:O4Pe2MkgHHA.1216@TK2MSFTNGP03.phx.gbl...
> VBScript is far more powerful than batch files. On the other
> hand, batch files are far simpler to write for everyday tasks
> such as making a few folders or perfoming some simple copy
> commands, if only because they use standard Command
> Prompt commands.
>
> What has happened to your original question? Change of scope?
>
> The batch file you posted has a few problems - see below.
>
> "2007-User" <no-email@noemail.com> wrote in message
> news:etKfSajgHHA.208@TK2MSFTNGP05.phx.gbl...
>> Wow thank you so much Paul I didn't know anything about that ,
>> could you please tell me how it is possible to convert below batch file
>> to
>> VBSCRIPT?
>>
>> @ECHO ON
>> MD NEW-PROJECT
> *** Much better to write it like so:
> *** md "d:\documents and settings\User\New-Project"
> *** Now you know exactly where the folder will be created.
>> CD NEW-PROJECT
> *** Ditto:
> *** cd /d "d:\documents and settings\User\New-Project"
>> xcopy /d C:\007-JO~1\*.* D:\Documents and Settings\AFDESKTOP.001\Desktop
> *** This won't work - you have embedded spaces. Do this instead:
> *** xcopy /d C:\007-JO~1 "D:\Documents and
> Settings\AFDESKTOP.001\Desktop\"
>> MD 09-Origfiles
> *** As above - add drive & folder name!
>> MD 01-Sketches
>> MD 02-Received_Emails
>> MD 02-Sent_Emails
>> MD 01-Pictures
>> MD 03-Layouts
>> CD 03-Layouts
>> MD Drawings
>> MD Calculations
>> CD..
> *** What is the point of this command? Get rid of it!
>> cls
> *** What is the point of this command? Get rid of it!
>> tree
>> exit
> *** What is the point of this command? Get rid of it!
>
>> Thank you.
>> 2007-User
>>
>>
>> "Paul Randall" <paulr901@cableone.net> wrote in message
>> news:OnZh1UfgHHA.3852@TK2MSFTNGP04.phx.gbl...
>> >
>> > "2007-User" <no-email@noemail.com> wrote in message
>> > news:uQnn$8XgHHA.2432@TK2MSFTNGP03.phx.gbl...
>> >> On Windows Xp environment, can I write a BAT file (under DOS) that can
>> >> read
>> >> the name of a directory and them assign that name to a file in another
> or
>> >> the same directory? (filename.ext <= directory name)
>> >>
>> >> Thanks in advance.
>> >
>> > Since VBScript is installed by default on most XP systems, why not use
>> > that? It is easier to understand and debug.
>> >
>> > For example, the following three lines can be copied & pasted to
>> > notepad
>> > and saved to a file named CurFldr.vbs:
>> > MsgBox "Started in folder " & vbCrLf & _
>> > WScript.CreateObject("WScript.Shell").CurrentDirec tory
>> > MsgBox "Done - quitting"
>> >
>> > Double click click the file to run the script.
>> >
>> > -Paul Randall
>> >
>>
>>
>
>
If you don't mind and is going to be easy for you please answer this
question as well,
I would like to have a file that can do this: when I execute it, ask me
about a name in a dialog box and then create a folder with that name?
I really appreciate all of your helps
=================================================
"Pegasus (MVP)" <I.can@fly.com> wrote in message
news:O4Pe2MkgHHA.1216@TK2MSFTNGP03.phx.gbl...
> VBScript is far more powerful than batch files. On the other
> hand, batch files are far simpler to write for everyday tasks
> such as making a few folders or perfoming some simple copy
> commands, if only because they use standard Command
> Prompt commands.
>
> What has happened to your original question? Change of scope?
>
> The batch file you posted has a few problems - see below.
>
> "2007-User" <no-email@noemail.com> wrote in message
> news:etKfSajgHHA.208@TK2MSFTNGP05.phx.gbl...
>> Wow thank you so much Paul I didn't know anything about that ,
>> could you please tell me how it is possible to convert below batch file
>> to
>> VBSCRIPT?
>>
>> @ECHO ON
>> MD NEW-PROJECT
> *** Much better to write it like so:
> *** md "d:\documents and settings\User\New-Project"
> *** Now you know exactly where the folder will be created.
>> CD NEW-PROJECT
> *** Ditto:
> *** cd /d "d:\documents and settings\User\New-Project"
>> xcopy /d C:\007-JO~1\*.* D:\Documents and Settings\AFDESKTOP.001\Desktop
> *** This won't work - you have embedded spaces. Do this instead:
> *** xcopy /d C:\007-JO~1 "D:\Documents and
> Settings\AFDESKTOP.001\Desktop\"
>> MD 09-Origfiles
> *** As above - add drive & folder name!
>> MD 01-Sketches
>> MD 02-Received_Emails
>> MD 02-Sent_Emails
>> MD 01-Pictures
>> MD 03-Layouts
>> CD 03-Layouts
>> MD Drawings
>> MD Calculations
>> CD..
> *** What is the point of this command? Get rid of it!
>> cls
> *** What is the point of this command? Get rid of it!
>> tree
>> exit
> *** What is the point of this command? Get rid of it!
>
>> Thank you.
>> 2007-User
>>
>>
>> "Paul Randall" <paulr901@cableone.net> wrote in message
>> news:OnZh1UfgHHA.3852@TK2MSFTNGP04.phx.gbl...
>> >
>> > "2007-User" <no-email@noemail.com> wrote in message
>> > news:uQnn$8XgHHA.2432@TK2MSFTNGP03.phx.gbl...
>> >> On Windows Xp environment, can I write a BAT file (under DOS) that can
>> >> read
>> >> the name of a directory and them assign that name to a file in another
> or
>> >> the same directory? (filename.ext <= directory name)
>> >>
>> >> Thanks in advance.
>> >
>> > Since VBScript is installed by default on most XP systems, why not use
>> > that? It is easier to understand and debug.
>> >
>> > For example, the following three lines can be copied & pasted to
>> > notepad
>> > and saved to a file named CurFldr.vbs:
>> > MsgBox "Started in folder " & vbCrLf & _
>> > WScript.CreateObject("WScript.Shell").CurrentDirec tory
>> > MsgBox "Done - quitting"
>> >
>> > Double click click the file to run the script.
>> >
>> > -Paul Randall
>> >
>>
>>
>
>
I am still unclear about your original question. As I said before,
an actual example would go a long way towards clarifying it.
This batch file will prompt you for your name:
@echo off
set /p name=Please enter your name:
echo Hello %name%, please clarify your question.
"2007-User" <no-email@noemail.com> wrote in message
news:OMnLPBlgHHA.4064@TK2MSFTNGP03.phx.gbl...
> Well, I got so excited and forgot about my original question! ...
certainly
> I'll try to learn about this vbscripts in the near future ... until then,
> let me ask you about my first question,
> I need to read a folder's name and then assign this name to a file (rename
> an existing file with this name) without touching the extension of this
> file.
>
> by the way thank you so much for your answer about my batch file.
> --------------------------------------------------------------------------
-------------------------------------------------
>
> "Pegasus (MVP)" <I.can@fly.com> wrote in message
> news:O4Pe2MkgHHA.1216@TK2MSFTNGP03.phx.gbl...
> > VBScript is far more powerful than batch files. On the other
> > hand, batch files are far simpler to write for everyday tasks
> > such as making a few folders or perfoming some simple copy
> > commands, if only because they use standard Command
> > Prompt commands.
> >
> > What has happened to your original question? Change of scope?
> >
> > The batch file you posted has a few problems - see below.
> >
> > "2007-User" <no-email@noemail.com> wrote in message
> > news:etKfSajgHHA.208@TK2MSFTNGP05.phx.gbl...
> >> Wow thank you so much Paul I didn't know anything about that ,
> >> could you please tell me how it is possible to convert below batch file
> >> to
> >> VBSCRIPT?
> >>
> >> @ECHO ON
> >> MD NEW-PROJECT
> > *** Much better to write it like so:
> > *** md "d:\documents and settings\User\New-Project"
> > *** Now you know exactly where the folder will be created.
> >> CD NEW-PROJECT
> > *** Ditto:
> > *** cd /d "d:\documents and settings\User\New-Project"
> >> xcopy /d C:\007-JO~1\*.* D:\Documents and
Settings\AFDESKTOP.001\Desktop
> > *** This won't work - you have embedded spaces. Do this instead:
> > *** xcopy /d C:\007-JO~1 "D:\Documents and
> > Settings\AFDESKTOP.001\Desktop\"
> >> MD 09-Origfiles
> > *** As above - add drive & folder name!
> >> MD 01-Sketches
> >> MD 02-Received_Emails
> >> MD 02-Sent_Emails
> >> MD 01-Pictures
> >> MD 03-Layouts
> >> CD 03-Layouts
> >> MD Drawings
> >> MD Calculations
> >> CD..
> > *** What is the point of this command? Get rid of it!
> >> cls
> > *** What is the point of this command? Get rid of it!
> >> tree
> >> exit
> > *** What is the point of this command? Get rid of it!
> >
> >> Thank you.
> >> 2007-User
> >>
> >>
> >> "Paul Randall" <paulr901@cableone.net> wrote in message
> >> news:OnZh1UfgHHA.3852@TK2MSFTNGP04.phx.gbl...
> >> >
> >> > "2007-User" <no-email@noemail.com> wrote in message
> >> > news:uQnn$8XgHHA.2432@TK2MSFTNGP03.phx.gbl...
> >> >> On Windows Xp environment, can I write a BAT file (under DOS) that
can
> >> >> read
> >> >> the name of a directory and them assign that name to a file in
another
> > or
> >> >> the same directory? (filename.ext <= directory name)
> >> >>
> >> >> Thanks in advance.
> >> >
> >> > Since VBScript is installed by default on most XP systems, why not
use
> >> > that? It is easier to understand and debug.
> >> >
> >> > For example, the following three lines can be copied & pasted to
> >> > notepad
> >> > and saved to a file named CurFldr.vbs:
> >> > MsgBox "Started in folder " & vbCrLf & _
> >> > WScript.CreateObject("WScript.Shell").CurrentDirec tory
> >> > MsgBox "Done - quitting"
> >> >
> >> > Double click click the file to run the script.
> >> >
> >> > -Paul Randall
> >> >
> >>
> >>
> >
> >
>
>
Thanks for your reply, can you please give me the equivalent VBscript of the
batch file that I have posted here?
if it is not that easy could show me a good reference so I can figure that
out by myself?
Thanks.
"Pegasus (MVP)" <I.can@fly.com> wrote in message
news:ugQ1LLngHHA.1008@TK2MSFTNGP05.phx.gbl...
>I am still unclear about your original question. As I said before,
> an actual example would go a long way towards clarifying it.
>
> This batch file will prompt you for your name:
> @echo off
> set /p name=Please enter your name:
> echo Hello %name%, please clarify your question.
>
>
> "2007-User" <no-email@noemail.com> wrote in message
> news:OMnLPBlgHHA.4064@TK2MSFTNGP03.phx.gbl...
>> Well, I got so excited and forgot about my original question! ...
> certainly
>> I'll try to learn about this vbscripts in the near future ... until then,
>> let me ask you about my first question,
>> I need to read a folder's name and then assign this name to a file
>> (rename
>> an existing file with this name) without touching the extension of this
>> file.
>>
>> by the way thank you so much for your answer about my batch file.
>> --------------------------------------------------------------------------
> -------------------------------------------------
>>
>> "Pegasus (MVP)" <I.can@fly.com> wrote in message
>> news:O4Pe2MkgHHA.1216@TK2MSFTNGP03.phx.gbl...
>> > VBScript is far more powerful than batch files. On the other
>> > hand, batch files are far simpler to write for everyday tasks
>> > such as making a few folders or perfoming some simple copy
>> > commands, if only because they use standard Command
>> > Prompt commands.
>> >
>> > What has happened to your original question? Change of scope?
>> >
>> > The batch file you posted has a few problems - see below.
>> >
>> > "2007-User" <no-email@noemail.com> wrote in message
>> > news:etKfSajgHHA.208@TK2MSFTNGP05.phx.gbl...
>> >> Wow thank you so much Paul I didn't know anything about that ,
>> >> could you please tell me how it is possible to convert below batch
>> >> file
>> >> to
>> >> VBSCRIPT?
>> >>
>> >> @ECHO ON
>> >> MD NEW-PROJECT
>> > *** Much better to write it like so:
>> > *** md "d:\documents and settings\User\New-Project"
>> > *** Now you know exactly where the folder will be created.
>> >> CD NEW-PROJECT
>> > *** Ditto:
>> > *** cd /d "d:\documents and settings\User\New-Project"
>> >> xcopy /d C:\007-JO~1\*.* D:\Documents and
> Settings\AFDESKTOP.001\Desktop
>> > *** This won't work - you have embedded spaces. Do this instead:
>> > *** xcopy /d C:\007-JO~1 "D:\Documents and
>> > Settings\AFDESKTOP.001\Desktop\"
>> >> MD 09-Origfiles
>> > *** As above - add drive & folder name!
>> >> MD 01-Sketches
>> >> MD 02-Received_Emails
>> >> MD 02-Sent_Emails
>> >> MD 01-Pictures
>> >> MD 03-Layouts
>> >> CD 03-Layouts
>> >> MD Drawings
>> >> MD Calculations
>> >> CD..
>> > *** What is the point of this command? Get rid of it!
>> >> cls
>> > *** What is the point of this command? Get rid of it!
>> >> tree
>> >> exit
>> > *** What is the point of this command? Get rid of it!
>> >
>> >> Thank you.
>> >> 2007-User
>> >>
>> >>
>> >> "Paul Randall" <paulr901@cableone.net> wrote in message
>> >> news:OnZh1UfgHHA.3852@TK2MSFTNGP04.phx.gbl...
>> >> >
>> >> > "2007-User" <no-email@noemail.com> wrote in message
>> >> > news:uQnn$8XgHHA.2432@TK2MSFTNGP03.phx.gbl...
>> >> >> On Windows Xp environment, can I write a BAT file (under DOS) that
> can
>> >> >> read
>> >> >> the name of a directory and them assign that name to a file in
> another
>> > or
>> >> >> the same directory? (filename.ext <= directory name)
>> >> >>
>> >> >> Thanks in advance.
>> >> >
>> >> > Since VBScript is installed by default on most XP systems, why not
> use
>> >> > that? It is easier to understand and debug.
>> >> >
>> >> > For example, the following three lines can be copied & pasted to
>> >> > notepad
>> >> > and saved to a file named CurFldr.vbs:
>> >> > MsgBox "Started in folder " & vbCrLf & _
>> >> > WScript.CreateObject("WScript.Shell").CurrentDirec tory
>> >> > MsgBox "Done - quitting"
>> >> >
>> >> > Double click click the file to run the script.
>> >> >
>> >> > -Paul Randall
>> >> >
>> >>
>> >>
>> >
>> >
>>
>>
>
>