Computing.Net > Forums > Programming > Batch files

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Batch files

Reply to Message Icon

Name: vallegowni
Date: June 3, 2009 at 21:50:55 Pacific
OS: Windows XP
Subcategory: Batch
Comment:

Currently im facing a issue with batch script while creating new folder.
Ex., set foldername1= C:\BI_Reports\%date:~4,2%-%date:~10,4%
md %foldername1%
The above batch script will create new folder called "06-2009".
We are not able to create a new folder under this location-->
set foldername1= C:\BI Reports\%date:~4,2%-%date:~10,4%
md %foldername1%
(Using Space inbetween "BI Reports"). Is it possible to create a new folder using above script? If YES, then please advise.

Many thanks in Advance.



Sponsored Link
Ads by Google

Response Number 1
Name: Valerie (by Garibaldi)
Date: June 4, 2009 at 02:15:50 Pacific
Reply:

When there is a space in the foldername use double quotes e.g.

set foldername1= C:\BI Reports\%date:~4,2%-%date:~10,4%
md "%foldername1%"



0

Response Number 2
Name: klint
Date: June 4, 2009 at 06:25:40 Pacific
Reply:

Also, leave out the space after the equals-sign:

set foldername1=C:\BI Reports\%date:~4,2%-%date:~10,4%

and not

set foldername1= C:\BI Reports\%date:~4,2%-%date:~10,4%

Otherwise, the value of the variable starts with an unwanted space character.


0

Response Number 3
Name: vallegowni
Date: June 6, 2009 at 23:51:35 Pacific
Reply:

Thanks you its working


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


find and replace ultra wi... Merging two text files, a...



Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Batch files

Batch file to count a specific character in a www.computing.net/answers/programming/batch-file-to-count-a-specific-character-in-a/19751.html

FTP batch file www.computing.net/answers/programming/ftp-batch-file/9027.html

batch file www.computing.net/answers/programming/batch-file/13936.html