Showing posts with label Default. Show all posts
Showing posts with label Default. Show all posts

May 23, 2023

Change default directory for Windows command prompt and Powershell when running with admin privileges

 Hi all,

It's been a while since I posted things.

Here is my previous post where the non-admin user changes the default directory for the command prompt and PowerShell.

https://psrdotcom.blogspot.com/2022/03/change-default-directory-of-windows.html

But in this post, I will be explaining about running the command prompt / powershell with admin rights and setting the default directory. Because, when you are running with admin privileges, it by default goes to the SYSTEM32 folder of Windows.

Environment

I use the command prompt and PowerShell, which are pinned to the taskbar of Windows.

Run the application with the admin rights

  • Right-click on the application icon -> click on Properties
  • Go to the "Compatibility" tab
  • Check "Run this program as administrator"

Run the shortcut with the admin rights

  • Right-click on the shortcut icon -> click on Properties
  • Go to the "Shortcut" tab
  • Click on the "Advanced" button
  • Check "Run this program as administrator"

Change the command prompt default directory

  • We need to have a .bat file with the following content
    • @echo off
    • cd <default_directory>
Now use the .bat file in the shortcut properties
  • Right-click on the shortcut icon -> click on Properties
  • Go to the "Shortcut" tab
  • In the "Target" field append the below text
    • /k "batfile_dirpath\batfile.bat"

Change the PowerShell default directory

  • Right-click on the shortcut icon -> click on Properties
  • Go to the "Shortcut" tab
  • In the "Target" field append the below context after powershell.exe
    • -NoExit -command "& {Set-Location <default_directory>}"
  • Click on "OK"

Hope, this helps you to reduce the frequent directory changes in the command prompt and PowerShell.

Feel free to provide your valuable feedback and comments to psrdotcom@gmail.com

March 14, 2022

Change default directory of Windows command prompt and Windows PowerShell

 Hi all,

Today I will explain the steps to change the default directory for Windows command prompt and Windows PowerShell.

The default directory for both the command prompt and PowerShell is the "system32" folder of the OS installed directory (By default: "C:\windows\system32").

Day in - Day out, we will open the terminals (command prompt / PowerShell) and navigate the source directory. It sometimes irritates and wastes lots of time.

I have come across this situation and want to avoid re-entry the change directory command.

Environment,

I use the command prompt and PowerShell, which are pinned to the taskbar of Windows.


Change default directory of Windows Command Prompt

  1. Right-click on the taskbar pinned Command Prompt icon
  2. Right-click on the "Command Prompt" menu
  3. Select the "Properties" item
  4. Under the "Shortcut" tab, you will find the "Start in:" label
  5. In the respective text box, enter the path you want to navigate by default.
  6. For example, "C:\Projects".

Change default directory of Windows PowerShell

  1. Open the PowerShell with administrator privileges
  2. Create a profile by using the following steps
    1. New-item -type file -force $Profile
  3. This will create a file "Microsoft.PowerShell_profile.ps1" in the current user documents PowerShell folder.
    1. Syntax
        • C:\Users\<UserName>\Documents\WindowsPowerShell
      1. Example
          • C:\Users\PSR\Documents\WindowsPowerShell
      2. Edit file
          • notepad.exe $Profile
        1. Change the default directory
          1. Syntax
              • Set-Location <Directory Path>
            1. Example
                • Set-Location C:\Projects
                  • Clear-Host # To clear the PowerShell screen
              1. Save and close the file
              2. In the PowerShell window, enter the following command to change the profile
                  • . $Profile
                1. It immediately changes from the current directory to the updated default directory.
                2. Close the PowerShell and try to open the PowerShell again to see the change in the directory.
                Hope the above information is helpful to you reduce the change directories in day-to-day life.

                Send me your valuable feedback to psrdotcom@gmail.com.

                November 26, 2018

                Oracle Create User with custom tablespace and datafile

                Hi all,

                Through I have explained the procedure to delete/drop the user with tablespace and datafiles. I though of giving information about creating a user with custom tablespace and datafile.

                Pre-requisites


                1. Oracle database
                2. Login as sys as sysdba

                Procedure

                Create tablespace

                Syntax: CREATE TABLESPACE DATAFILE SIZE ;
                Example: CREATE TABLESPACE sample_tablespace DATAFILE 'C:\\samplets.dbf' SIZE 100M;
                Example: CREATE TABLESPACE sample_tablespace DATAFILE '\usr\local\datafiles\samplets.dbf' SIZE 100M;

                User creation

                Alter session
                ALTER SESSION SET "_ORACLE_SCRIPT"=true;

                Create User
                Syntax: CREATE USER IDENTIFIED BY DEFAULT TABLESPACE ;
                Example: CREATE USER sampleuser IDENTIFIED BY samplepwd DEFAULT TABLESPACE sample_tablespace;

                Grant privilieges
                Syntax: GRANT ALL PRIVILEGES to ;
                Example: GRANT ALL PRIVILEGES to sampleuser;

                Commit the commands
                commit;

                Now, you should be able to create the tablespace and made that as default tablespace for the newly created user.

                Hope, this information helps you.

                Please send your comments and feedback to psrdotcom@gmail.com

                February 22, 2017

                Tomcat issue "windows could not start apache tomcat on local computer" after java update issue with resolution

                Hi friends,

                Today I have faced an issue with Tomcat service starting. I would like to share with you the resolution as well. Please find the details below.

                Root cause

                Updated java version

                Resolution


                • Navigate to you apache installed folder
                • Go bin folder
                • Double click on "Tomcat(X)w.exe" where X the version of tomcat.
                • In my case it is "Tomcat8w.exe" because the version is 8
                • Select "Use Default". So that, it uses the JAVA_HOME version by default.
                • Click on OK
                • Start the Tomcat service and enjoy deploying


                Please send your comments and feedback to psrdotcom@gmail.com

                December 13, 2016

                E Aadhaar password for mail copy PDF received from aadhaar@uidai.gov.in

                Hi friends,

                I have updated my Aadhaar details from Aadhaar update center.
                It is mentioned that within 72 hours, my details will be updated.

                Before 72 hours of my updated application, I had received an email from aadhaar@uidai.gov.in with an attachment which is password protected.

                As I was unable to find the password to open the file in the sent mail, I have googled to find the answer. I have found mulitple options. You can try the following procedure to open the file with your password.

                Procedure to open the document


                1. Download the file
                2. Rename the file by adding .pdf extension, if missing
                3. Try the following passwords
                  • Password length is 8 characters
                    • First 4 characters of your name as mentioned in Aadhaar card (All small letters)
                    • Next 4 characters are your year of birth which is mentioned in Aadhaar card
                  • Password length is 6 characters
                    • Pin code of your address as per Aadhaar records
                    • Pin code of your enrolled area where you have applied the Aadhaar card
                4. For me, 8 character password (first 4 characters of my name as mentioned in Aadhaar card + year of birth) worked.
                Please send your feedback and queries to psrdotcom@gmail.com

                August 22, 2015

                Ubuntu Windows dual boot order changes GRUB

                Hi friends,

                From long time, I was thinking of modifying my default boot option to Windows instead of Ubuntu. Finally today, I've done those changes in my laptop.

                My system has Windows 10 and Ubuntu 14.04 dualboot and Ubuntu OS is my default boot option with 10 seconds timeout.

                I thought of sharing the information with everyone.

                Please open the terminal and run the followin commands in sequence 
                1. sudo add-apt-repository ppa:danielrichter2007/grub-customizer
                2. sudo apt-get update
                3. sudo apt-get install grub-customizer
                By now, grub-customizer will be successfully installed in your PC.

                Please follow the below step to do the necessary changes in boot order

                • Open the grub-customizer
                 

                • Grub customizer lists the installed OS with versions
                 

                • Rename the OS entry by right clicking and selecting "Rename" option [Optional]
                 

                • Choose the default boot option by navigating to "General Settings"
                • Select options from "predefined" entry


                • Click on "Save" option to save all the changes.
                • You can revert the changes by clicking the "Revert" option, if you feel like going back to original/initial options

                Hope it would help you in changing the default boot order

                Please send your comments and feedback to psrdotcom@gmail.com

                July 31, 2008

                Change Default Localhost File in Linux

                Hi friends,

                Whenever you type localhost or 127.0.0.1 in browser, you will be getting some default file.

                If you would like to change the default file and wants to put your own desired file then follow this procedure.

                1. Login into Linux as root
                2. Open the terminal
                3. cd etc/httpd/conf
                4. You can see the httpd.conf for configuration of httpd
                5. Place your .html file in /var/www/html
                6. Change the file name as index.html
                7. cd /etc --Change the directory to /etc folder
                8. service httpd start -- For starting the service
                9. service httpd restart -- To restart the service
                10. Now you open the browser
                11. In address bar of the browser type http://localhost/
                12. Now you will get your own html as default localhost
                For further queries/comments, please mail to psrdotcom@gmail.com

                Featured Post

                Java Introdcution

                Please send your review and feedback to psrdotcom@gmail.com