?
Solved

Kix32/.bat files locating local profile path

Posted on 2008-02-06
7
Medium Priority
?
958 Views
Last Modified: 2008-02-06
Hello,

I have a log off script running through  the GP. Every time a user shutdown/logs off specific parts of their profile are backed up.

The only problem is I have hard coded the profile path.

In some instances windows changes the profile path, eg,

Windows will concatenate a .000 onto the profile path, or it might concatenate the domain onto the end of the persons profile name.

The concatenation of these values above causes my statically coded values to become redundant.  I am now looking for a dynamic solution.

Can anyone suggest a way where I can obtain the profile path of a person through "Kix32" or at very least a .bat file.
0
Comment
Question by:blowfly
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 15

Accepted Solution

by:
sr75 earned 2000 total points
ID: 20836899
%userprofile% is the DOS environmental variable that gives you a user's profile path
0
 

Author Comment

by:blowfly
ID: 20837046
I have tried that before but failed.

I was using this in my batch file:

copy %userprofile%\FILE1.txt C:\File.txt

I get the following after:

The system cannot find the file specified.

Can anyone help me with this.
0
 
LVL 5

Expert Comment

by:forrestoff
ID: 20837133
you should have used

copy "%userprofile%\FILE1.txt" C:\File.txt

because %userprofile% has spaces that copy cannot handle.  The quotes extend it to a proper file path.
0
2018 Annual Membership Survey

Here at Experts Exchange, we strive to give members the best experience. Help us improve the site by taking this survey today! (Bonus: Be entered to win a great tech prize for participating!)

 
LVL 5

Expert Comment

by:forrestoff
ID: 20837171
To make it "sweet" do this:

echo @copy /y  "%userprofile%\FILE1.txt" C:\File.txt >routine.bat

This will create a file called "routine.bat" and it will contain a command (copy /y "%userprofile%\FILE1.txt" C:\File.txt) and will execute it silently (@).  Stick this in the shutdown process (or startup process) and all you'll see is the dos-box-flash.  
0
 

Author Comment

by:blowfly
ID: 20837187
I just realised  that I forgot the "  "
0
 
LVL 9

Expert Comment

by:Krompton
ID: 20837188
Yes, help can be found. :)
What forrestoff said is absolutely true and using the quotes should correct the "...cannot find the file..." errors.

Beyond that however;

The concatenation of .000 or the domain name to the users profile folder may indicate that the user no longer has full permissions to ALL files within their folders. This often happens when a script copies a file into the users profile or is running under other credentials and creates a new file. At least thats one possibility.

In general terms; what is the script intended to accomplish?

You've indicated you are using XP Operating System. I'm guessing it is probably XP Pro SP2 and is in a Domain environment since you indicated the script is driven by Group Policy. Please correct my assumptions if they are not accurate.

0
 
LVL 9

Expert Comment

by:Krompton
ID: 20837195
Guess I should have refreshed page before posting. :)
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension . This reminded me of questions that come up here at EE along the lines of, "How can I tell the type of file from its cont…
A few solutions to a problem some of us have been having when trying to add Hostgator email accounts to Outlook 2016 (will probably work with Outlook 2013 as well).
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

600 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question