Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Write a program to print the current folder name in the local system.
05-15-2009, 10:22 AM
Post: #1
Write a program to print the current folder name in the local system.

Hi can anyone answer my question quickly please.


Question:

Write a program to print the current folder name in the local system.
Find all posts by this user
Quote this message in a reply
01-05-2010, 07:38 PM
Post: #2
RE: Write a program to print the current folder name in the local system.
(05-15-2009 10:22 AM)kannan_panneerselvam Wrote:  Hi can anyone answer my question quickly please.


Question:

Write a program to print the current folder name in the local system.

Hi, It will give you the path of a folder

dim f,fso

set fso=createobject("scripting.filesystemobject")

set f=fso.getfolder("E:\Baba_QTP\QTP\Scripts")

msgbox f

D.Baba Fakruddin
Visit this user's website Find all posts by this user
Quote this message in a reply
01-05-2010, 08:10 PM
Post: #3
RE: Write a program to print the current folder name in the local system.
Hi Kannan,

In addition to Baba's solution, You can try in the below way for Printing the required FolderName in QuickTest Print Log.

Code:
Dim f,fso
set fso=createobject("scripting.filesystemobject")
set f=fso.getfolder("C:\Documents and Settings\csreekanth\Desktop\Srirama-ELC")
Print f.Name

Never limit your challenges , Challenge your limits
Visit this user's website Find all posts by this user
Quote this message in a reply
01-05-2010, 11:52 PM
Post: #4
RE: Write a program to print the current folder name in the local system.
use inbuilt environment variable
Find all posts by this user
Quote this message in a reply
01-06-2010, 04:35 PM
Post: #5
RE: Write a program to print the current folder name in the local system.
Hi,

Here is the code to get the only folder name not all the path of a folder.

Code:

dim f,fso

set fso=createobject("scripting.filesystemobject")

set f=fso.getfolder("E:\Baba_QTP\QTP\Scripts")

msgbox "Path of the Folder : "&f

ext=split(f,"\")

msgbox "Exact Folder Name : "&Exact

Function Exact()

for i=0 to ubound(ext)

Exact=ext(i)

Next

End Function

D.Baba Fakruddin
Visit this user's website Find all posts by this user
Quote this message in a reply
01-07-2010, 04:17 PM
Post: #6
RE: Write a program to print the current folder name in the local system.
@D.Baba Fakruddin - The query was to get the current folder name which can be retrieved by environment variable suggested by azar80.
what you are doing is just parsing the path string which is required to be passed, right?

Thanks,
~Saket Kumar
[Linkedin][pdf Api for QTP]
It's so hard when I have to, and so easy when I want to...
Find all posts by this user
Quote this message in a reply
01-09-2010, 07:07 PM
Post: #7
RE: Write a program to print the current folder name in the local system.
(01-07-2010 04:17 PM)Saket Wrote:  @D.Baba Fakruddin - The query was to get the current folder name which can be retrieved by environment variable suggested by azar80.
what you are doing is just parsing the path string which is required to be passed, right?

Hello Saket,

Thanks for your advice. I think you do understand the question, Question is to write a script to get a Stored Folder Name. as per azar80 comments one line script. I don't think that is exact answer for this question. Any how, Ask for a question to Kannan_Paneersalvam once again and provide your valuable Answer. I am waiting for that.

I know only the above way to get a Folder Name. If you have any other way to get Folder Name other than above two ways. Please let me know.

Thanks & regards,
Baba Fakruddin.D

D.Baba Fakruddin
Visit this user's website Find all posts by this user
Quote this message in a reply
07-06-2011, 05:26 PM
Post: #8
RE: Write a program to print the current folder name in the local system.
I think this may help you

set WshShell = WScript.CreateObject("WScript.Shell")
Dir=WshShell.CurrentDirectory
arrydir=split(dir,"\")
msgbox arrydir(ubound(arrydir))

Thanks
Gowtham
Find all posts by this user
Quote this message in a reply
07-09-2011, 11:10 AM
Post: #9
RE: Write a program to print the current folder name in the local system.
Well i have seen that commentators are arguing with their answer....actually the question is not clear.....

what exactly u want????

1. The current folder name only where you are present???
2. Or u need the full path of that folder where you are present???

The answer of 1st question is what exactly gowtham.m.h has suggested.....

and the answer of 2nd question is to use inbuilt Environment variable ("TestDir") what exactly azar80 has suggested.....

And i dont think bfakruddin has suggested any logical answer...he has just passed the string and printed that....but if i dnt know the string then what??? i guess exactly this thing is being asked in this question that how to get that string.......


So better try gowtham.m.h or azar80 suggestion as per ur need.....
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  "How to write Batch Script runner program" suresz449 2 552 12-19-2011 05:15 PM
Last Post: Munna.Sarfraz
  "VBScript Program" suresz449 0 428 12-19-2011 09:55 AM
Last Post: suresz449
  Write a program to Capture Desktop Screen shot kumarmoyilla 3 1,418 07-27-2011 12:36 PM
Last Post: ferr
  How to use the system while running the regression set from QC rahuldps 2 727 06-08-2011 12:58 PM
Last Post: rahuldps
  How can i write a script in QTP to poll a folder for a new file? geethwind 5 1,423 05-19-2011 07:04 PM
Last Post: deepaksporty

Forum Jump:


User(s) browsing this thread: 1 Guest(s)