473,395 Members | 1,949 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

%USERPROFILE% - What is this?

Hello All,
I have Perl code that looks like the following. $file is pointing to a directory on the C: drive that has 2 text files in it (let's say text_file_name1.txt and text_file_name2.txt).The lines of code to print out the names of the text files in the directory are:

[HTML]foreach $file(@result_files)
{
print "$file\n";
}[/HTML]

Can someone tell me why the print out gives me this:

C:/%USERPROFILE$
C:/text_file_name1.txt
C:/text_file_name2.txt

What is %USERPROFILE$? And why is it showing up???

Terra
Nov 28 '07 #1
8 6917
KevinADC
4,059 Expert 2GB
might be a file that is usually hidden from the user but perl picks it up.
Nov 28 '07 #2
numberwhun
3,509 Expert Mod 2GB
If you go into your file system browser and go to Tools->Folder Options, then go to the view tab in the window that appears, there is an option to "Show hidden files and folders". Select that radio button, hit Ok, and go to the folder and see what is there.

Regards,

Jeff
Nov 28 '07 #3
Thank you for your responses. i went into the Options folder and selected the ' Show hidden files and folders'. nothing showed up in my folder except the files that i expected. but Perl still picks up the %USERPROFILE%. Interesting.

Is there a way for Perl to ignore it? I tried to use shift(), which removes the first element in the array (and i thought it wouldd remove the %USERPROFILE% since it shows up first), but it didn't, it removed the first real file in my folder that i need to keep and kept printing the %USERPROFILE%.

This %USERPROFILE% is really messing up my overall script!!!

Help please!!
Nov 29 '07 #4
Here's a follow up to my previous reply...

I found a line that is supposed to ignore hidden files:

[HTML]next if $file =~ /^\./;[/HTML]

But Perl is still printing out the hidden file %USERPROFILE%. Does anyone know if this is close to being correct?


However, i think that %USERPROFILE% is a Windows Environment Variable, that should be dealt with differently than a hidden file...

Terra
Nov 29 '07 #5
eWish
971 Expert 512MB
See if this works for you.

Expand|Select|Wrap|Line Numbers
  1. foreach my $file (@array) {
  2.     next if $file =~ (/^\%/);
  3.     print $file, "\n";
  4. }
--Kevin
Nov 29 '07 #6
Well,
I figured out a solution, unless there is a better way to do it.

This line of code skips over the %USERPROFILE% hidden file as it goes through the array:

[HTML]foreach $file(@result_files)
{
next if $file eq 'C:\Folder Name\%USERPROFILE%';
print "$file\n";
}[/HTML]

It works, so i'm happy!

Terra
Nov 29 '07 #7
numberwhun
3,509 Expert Mod 2GB
Well,
I figured out a solution, unless there is a better way to do it.

This line of code skips over the %USERPROFILE% hidden file as it goes through the array:

foreach $file(@result_files)
{
next if $file eq 'C:\Folder Name\%USERPROFILE%';
print "$file\n";
}

It works, so i'm happy!

Terra
Thank you for letting us know! Thanks for assisting the OP with this problem eWish!

Regards,

Jeff
Nov 29 '07 #8
docdiesel
297 Expert 100+
Hi,

What is %USERPROFILE%? And why is it showing up???
as you guessed, %USERPROFILE% is a windows environment variable. It points to your windows settings and documents folder, usually paced under c:\docs and settings\username . What windows version are you working with? Is it Vista? I'm not sure, but afaik Vi$ta is working with some special and sometimes hidden entries in the home filesystem. This could be one of it.

Regards,

Bernd
Dec 1 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: James | last post by:
I have a from with 2 fields: Company & Name Depening which is completed, one of the following queries will be run: if($Company){ $query = "Select C* From tblsample Where ID = $Company...
5
by: Scott D | last post by:
I am trying to check and see if a field is posted or not, if not posted then assign $location which is a session variable to $location_other. If it is posted then just assign it to...
2
by: Nick | last post by:
Can someone please tell me how to access elements from a multiple selection list? From what ive read on other posts, this is correct. I keep getting an "Undefined variable" error though... Form...
1
by: Madhusudan Singh | last post by:
<script language="Javascript1.1" type="text/javascript"> function xso_popup(url,name,options) { var cw=window.open(url,name,options); cw.opener=this; cw.focus(); } Link :
2
by: Alexander Ross | last post by:
I have a variable ($x) that can have 50 different (string) values. I want to check for 7 of those values and do something based on it ... as I see it I have 2 options: 1) if (($x=="one") ||...
6
by: JerryP | last post by:
Hello, is there a way to launch the property dialogue for a directory from my c# app ? I would also like to launch the User Account Properties from Active Directory Users and Computers, and the...
2
by: msnews.microsoft.com | last post by:
Hi All I m facing a problem. My Scenario is that i have a table in database with the name of "userprofile". In my web site the user enters his personal information for building his profile in...
11
by: bsagert | last post by:
In xp when I try os.path.getmtime("%userprofile/dir/file%") Python bites back with "cannot find the path specified" Since my script has to run on machines where the username is unspecified I need a...
1
by: bsagert | last post by:
The python community is very helpful to newbies like me. I did however manage to solve my problem in the meantime. I needed the modification time of certain files on various computers, but I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.