Skip to content
View in the app

A better way to browse. Learn more.

MSFN

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Whoa, I found something that's actually better in Win 10

Featured Replies

In Windows 8.1...

If you run a scheduled task as a particular user, and if that user is not logged on at the time, when you use the %USERPROFILE% environment variable, in Win 8.1 you get the default user profile path.  In other words, where I would have expected USERPROFILE to be C:\Users\NoelC, instead it's delivered to the scheduled task as C:\Users\Default.

USERNAME is set as expected (NoelC) though. 

So if one wants to use the user profile area, one has to code the command: SET USERPROFILE=C:\Users\%USERNAME%

In Windows 10...

When I tested it, I actually got C:\Users\NoelC in the USERPROFILE variable.

OMG, I'm going to have to upgrade all my machines immediately to eliminate this horrendous, critical bug!!!!   :crazy:

-Noel

I imagine that this wouldn't affect your situation, but in general I assume it would be better in Windows 8.1 to save the current value of USERPROFILE first, and then restore it after you were done?  Just thinking of situations where more than one user would be involved?  I don't know for sure since it originally had the value in your situation of C:\Users\Default, but just playing devil's advocate.

Cheers and Regards

  • Author

That's a reasonable thought, but the SET command is only in force for the duration of the job, which is a "go gather some system data, log it, and exit", so the change isn't permanent.

Were you thinking the SET command would affect things system-wide?

-Noel

I knew the duration limit was true for "new" variables, but wasn't sure when changing a built-in system variable like USERPROFILE.  I've also only had to mess with a single user system.  I guess I was thinking about the ability to change the value of things like PATH, which would stick after a job was done, but that might be a special case?  No, I'm wrong.  Looking at http://ss64.com/nt/path.html, I see that even changes to PATH via SET are only valid for the session.  Permanent changes require use of the the control panel or AUTOEXEC.BAT.  Oh well, my mistake. Never mind. :) 

Cheers and Regards

22 hours ago, NoelC said:

In Windows 8.1...

If you run a scheduled task as a particular user, and if that user is not logged on at the time, when you use the %USERPROFILE% environment variable, in Win 8.1 you get the default user profile path.  In other words, where I would have expected USERPROFILE to be C:\Users\NoelC, instead it's delivered to the scheduled task as C:\Users\Default.

USERNAME is set as expected (NoelC) though. 

So if one wants to use the user profile area, one has to code the command: SET USERPROFILE=C:\Users\%USERNAME%

Just in case there's been some sort of redirection as opposed to symbolic linking it may be worth not hardcoding the drive letter or even the \Users locations.

Off the top if my head, (untested), something like this may do that:

@For /F "Tokens=2 Delims=," %%a In ('WhoAmI /User /Fo CSV /NH') Do @(
	For /F "Tokens=1* Delims==" %%b In (
		'"WMIc Path Win32_UserProfile Where (SID='%%~a') Get LocalPath /Value"'
	) Do @For %%d In (%%c) Do @Set UserProfile=%%d)

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.