I am trying to write a script to run to save data to c:\users\username\appdata..... How do I script username so that is is a variable for the user logged on? I don't want to have to change it every time I install it.
Also is there a way I can package this to do a silent install with my license key?
Also is there a way I can package this to do a silent install with my license key?
How do I script username so that is is a variable for the user logged on?There are some Windows environment variables that can help you to do so. For example:
Code: Select all
For me, the script shows:
$current_user=GETENV("USERNAME")
$home_path=GETENV("HOMEPATH")
PRINT($current_user)
PRINT($home_path)
CarlosThere are many other environment variables that are very helpful for writing scripts. I post them here for reference:
\Users\Carlos
- Variable and Typical value (May vary, depending on system)
- ALLUSERSPROFILE C:\Documents and Settings\All Users
- APPDATA C:\Documents and Settings\{username}\Application Data
- COMPUTERNAME {computername}
- COMSPEC C:\Windows\System32\cmd.exe
- HOMEDRIVE C:
- HOMEPATH \Documents and Settings\{username}
- PATH C:\Windows\System32\;C:\Windows\;C:\Windows\System32\Wbem
- PATHEXT .COM; .EXE; .BAT; .CMD; .VBS; .VBE; .JS ; .WSF; .WSH
- PROGRAMFILES Directory containing program files, usually C:\Program Files
- PROMPT Code for current command prompt format. Code is usually $P$G
- SYSTEMDRIVE The drive containing the Windows XP root directory, usually C:
- SYSTEMROOT The Windows XP root directory, usually C:\Windows
- TEMP and TMP C:\DOCUME~1\{username}\LOCALS~1\Temp
- USERNAME {username}
- USERPROFILE C:\Documents and Settings\{username}
- WINDIR C:\Windows
Also is there a way I can package this to do a silent install with my license key?No, sorry.
liked Script FTP? Try our other product Email Parser