Score:1

Is it possible to open a file within a batch file as another user?

us flag

im trying to run psql.exe (postgreSQL) with an active code page set to 1252. I want to have a batch file that opens up a command prompt with that code page, then navigates to the psql directory to run it as "postgres" user. What I have is below:

start "test" cmd /k "chcp 1252 & cd c:\program files\postgresql\14\bin\psql.exe -U postgres"

how would I go about this? thanks!

djdomi avatar
za flag
you are looking for `runas`
Vanillaice avatar
us flag
I have tried using the runas command however my password is not getting recognised. When settings up postgreSQL a username and password was set up. I believe for the runas command to work I need to specify a domain name, how would I do that? `start cmd /k "chcp 1253 && cd c:\program files\postgresql\14\bin && runas /noprofile /user:postgres psql.exe" `
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.