There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
audio avg avg 8 bios boot browser bsod computer cpu crash css dell desktop driver dvd email error excel explorer firefox firefox 3 freeze game graphics hard drive hardware help please hijackthis hjt install internet internet explorer itunes javascript lan laptop malware missing monitor msn network networking openoffice outlook outlook 2003 outlook express php popups problem problems router seo slow sound sp3 spyware startup trojan usb video virtumonde virus vista vundo windows windows vista windows xp winxp wireless word
DOS/PDA/Other
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Operating Systems > DOS/PDA/Other >
Solved: Batchfile getting random filename with spaces


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

 
Thread Tools
johnie1795's Avatar
Junior Member with 2 posts.
 
Join Date: Apr 2008
21-Apr-2008, 03:46 AM #1
Solved: Batchfile getting random filename with spaces
Hey there !

I am trying to do following:

for %%i in ("...\_Shared\šbergabe_Abnahmeprotokoll\IN\*.pdf") do set "Datei=%%~nxi"

Everytime a new .pdf is put in the specific folder it does some editing ( code comes below but is not inportant for my problem ) It works perfeclty as long as the specific .pdf has no empty spaces.

e.g XY.pdf generates a perfect result, wheras X Y.pdf only takes the X into the variable and therefore generates no result whatsoever. Hay anybody got a suggestion here ? I tried using "" but that doesn`t work.

Thanks
devil_himself's Avatar
Distinguished Member with 4,779 posts.
 
Join Date: Apr 2007
Location: India
Experience: Advanced
21-Apr-2008, 04:44 AM #2
Greetings johnie1795 , Welcome To TSG !

The Code Is Working Perfectly !

Try Adding This Line And Test The Batch Script .. See If It Echoes File Name With Spaces Without Any Problem

Code:
for %%i in ("...\_Shared\šbergabe_Abnahmeprotokoll\IN\*.pdf") do set "Datei=%%~nxi"
echo %Datei%
pause
Or Try Using

Code:
for %%i in ("...\_Shared\šbergabe_Abnahmeprotokoll\IN\*.pdf") do set Datei="%%~nxi"
johnie1795's Avatar
Junior Member with 2 posts.
 
Join Date: Apr 2008
21-Apr-2008, 04:52 AM #3
Oh mann! I just relaized the mistkae was further down in the code as i used %Datei% instead of "%Datei%" ... But thanks for your Help !

Regards, !!
devil_himself's Avatar
Distinguished Member with 4,779 posts.
 
Join Date: Apr 2007
Location: India
Experience: Advanced
21-Apr-2008, 05:21 AM #4
Glad You Got It Resolved

You Can Use The "Thread Tools" At The Top To Mark The Thread As "Solved"

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are Off
Refbacks are Off

You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 10:46 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.