an issue for "echo %temp%" in cmd.exe [closed] - cmd

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
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!!!

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.

Related

How to use program name with out specific path in .cmd file [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
When I usually type following command in command prompt,
pageant "C:\Users\test\.ssh\id_rsa.ppk"
It have worked well.
But on the other hands,when I make test.cmd file like
pageant "C:\Users\test\.ssh\id_rsa.ppk"
And then double click, it didn't work
buttest.cmd in following script
"C:\Program Files\PuTTY\pageant.exe" "C:\Users\test\.ssh\id_rsa.ppk"
work well.
What is the different between them ?
I guess The path was recognized by cmd.
If someone has opinion, please let me know
If the command doesn't contain an absolute path and isn't an internal command then cmd.exe will find the executable in the current folder and then look in the folders in the %PATH% environment variable. It looks like the current folder in your cmd is C:\Program Files\PuTTY so pageant can be found and execute normally. If you cd to a different folder then it won't work unless the folder exists in %PATH%

W10 CMD forfiles [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
Since I had a task where I have to copy recursively files of a nested directory for work, i discovered the forfiles-function in windows cmd.
It worked properly and now I wonder how does the function distinguish between a file and a directory?
If every file had a file extension like .jpg .png .xls or something like that, I could understand it, but some of my files came without extensions, but it still did its job.
As I'm used to linux, I tried to google the sourcecode, but windows applications aren't opensource, so if anybody can explain me, how does it work, it would be very interesting to know.
PS: why does this got downvoted? its a general question
The command will eventually call the Windows FindFirstFile/FindNextFile functions. Those return a WIN32_FIND_DATA structure which may contain a FILE_ATTRIBUTE_DIRECTORY flag. If that flag is not set, it's a file.
Internally there is quite a difference between a file and a directory, and it's no surprise that typical file/directory handling commands know about this. The fact that a file doesn't have an extension (or that a directory is called "directory.jpeg") does not cause any confusion within those commands.
If you check forfiles' "man page" (forfiles /?), you might see that the /C switch gives you access to the #isdir variable, which can tell you the difference: are you dealing with a directory (value:TRUE) or a file (value:FALSE)?

How to make a Logon script secure in windows [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
I have a logon batch script that runs a .reg file for all user when they log in. here's my script
#echo running
REGEDIT.EXE /S "C:\user_files\user.reg"
Now my concern is that the batch file itself is located in
C:\Windows\System32\GroupPolicy\User\Scripts
Every user has access to this directory. So anyone can change the batch and may cause security threat. Is there a way to make it more secure. or is can I do something similar with PowerShell scripting so there's no batch. If someone could point me to the right direction would be very helpful.
your script needs to be readable by your users, but you can take away their rights to modify it -- that's a typical file system feature that every Windows since NT has (aside from windows 9x, of course).
Hence, simply remove the write privileges from the user group in which your users are, and you're fine.

programs running on startup without being in startup folder [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
some program (sort of malware) is running on my windows 7 at startup, but my startup folder is empty (even after removing the hidden and system attrib of all the programs in the folder). But msconfig shows the script that was running.
This means that programs can run on startup without actually being in the startup folder.
Please help me by explaining, how these softwares do this, or any concept of startup that i am missing?
Thanks in advance.
From here:
Add a new startup application
Open your registry and find the key [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run].
For each program you want to start automatically create a new string value using a descriptive name, and set the value of the string to the program executable.
For example, to automatically start Notepad, add a new entry of "Notepad"="c:\windows\notepad.exe".
Goto MSCONFIG and Remove the check mark for that particular App. then you are good go

Mac / Unix: overwritten path variable [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I was starting to type the command export PATH=/newPathAddition:$PATH I think I must have copied in a newline when copying the newPathAddition to paste into the command, because it ran export PATH=/newPathAddition. I know I can manually add things to the path variable, but is there any way to restore it to what it used to be, or find out information about which directories were in the path beforehand? I really don't want to be in a situation in the future where all these commands aren't working on my computer because things vanished from the path that I don't remember.
These changes are local to this one command prompt. Just open another terminal window.
If you need the normal value of $PATH to use in this one specific terminal window, open another one and copy its $PATH value.
If you want changes to $PATH to persist, you need to write a .bashrc file or a .profile file in your home folder with the $PATH-altering commands you wish to use. To revert, take them out.

Resources