-1

I'm facing a strange issue, when I executed the following command in a CMD.exe, will get different result in diff WKS. All WKS are windows-xp sp3.

c:\> echo %temp%

one is: C:\DOCUME~1\HWU\LOCALS~1\Temp
the other is: C:\Documents and Settings\HWU\LOCALS~1\Temp

I know, both results are the same position, but the second one will block our some batch file and I cannot modify batch file.

So how can I modify some settings let result looks like the first one?

Would anyone please advise?

Thanks a lot!!!

Fisher Wei
  • 23
  • 1
  • 5
  • 1
    I think, because the second one has spaces inside it, you need to surround the path by " ", like "C:\Documents and Settings\HWU\LOCALS~1\Temp" –  Jul 02 '13 at 09:08
  • The proper advice is: fix your scripts. They're supposed to have double quotes around variables containing paths since ages. Long filenames were introduced in the last century. – Ansgar Wiechers Jul 02 '13 at 09:10
  • @user2511414 Yes, if I used "", it should be OK, but I cannot modify script. – Fisher Wei Jul 02 '13 at 09:35
  • @AnsgarWiechers I cannot modify script, because of the *.bat file is on the server's shared folder, it will be executed directly. – Fisher Wei Jul 02 '13 at 09:36
  • so maybe yo need to check this [http://stackoverflow.com/questions/10227144/convert-long-filename-to-short-filename-using-cmd-exe](http://stackoverflow.com/questions/10227144/convert-long-filename-to-short-filename-using-cmd-exe) –  Jul 02 '13 at 09:54
  • @user2511414 Doesn't help, since the `%TEMP%` variable is used in scripts he said he can't modify. – Ansgar Wiechers Jul 02 '13 at 10:04

1 Answers1

1

You need to manually adjust the %TEMP% variable for all user profiles on the host in question.

After you did that, check the value of NtfsDisable8dot3NameCreation in the registry key [HKLM\SYSTEM\CurrentControlSet\Control\FileSystem] on that host. Change it to 0 in case it's set to 1 (requires a reboot). That doesn't fix the exisiting %TEMP% variables (those are static after being created during profile creation), but it will prevent future profiles from being created with non-8.3 paths in the %TEMP% variable.

Still, I'd strongly recommend to get your scripts fixed. It's the solution to the root-cause of the problem.

Ansgar Wiechers
  • 193,178
  • 25
  • 254
  • 328
  • NtfsDisable8dot3NameCreation is 0 in all WKS. But some WKS don't have dos 8.3 shortname checking by dir /x. I don't why. And I cannot add shortname by using "fsutil file setshortname xxx yyy", return "access denied", so I have to boot in a WinPE from USB key, and set shortname. It seems work. – Fisher Wei Jul 02 '13 at 10:53